diff --git a/src/components/insights/coach-panel/message-thread.tsx b/src/components/insights/coach-panel/message-thread.tsx index 216c1d3c4..5752528b9 100644 --- a/src/components/insights/coach-panel/message-thread.tsx +++ b/src/components/insights/coach-panel/message-thread.tsx @@ -13,6 +13,7 @@ import { import { cn } from "@/lib/utils"; import { useTranslations } from "@/lib/i18n/context"; +import { stripChartTokens } from "@/lib/insights/chart-tokens"; import { useAuth } from "@/hooks/use-auth"; import { useCoachPrefs } from "@/hooks/use-coach-prefs"; @@ -330,7 +331,17 @@ function ChatBubble({ inProgress && "animate-pulse motion-reduce:animate-none", )} > - {content || (inProgress ? t("insights.coach.thinking") : "")} + {/* v1.4.25 W5b — strip stray Metric/enum leak tokens from + the assistant prose before it lands in the bubble. The + raw `content` is the streamed Coach reply (or the + persisted twin after `done` fires); both paths are AI- + authored so they share the same leak surface as the + insight prose elsewhere. */} + {content + ? stripChartTokens(content) + : inProgress + ? t("insights.coach.thinking") + : ""} {safeError && (
{safeError}
diff --git a/src/components/insights/daily-briefing.tsx b/src/components/insights/daily-briefing.tsx index 8b8872145..91e148b82 100644 --- a/src/components/insights/daily-briefing.tsx +++ b/src/components/insights/daily-briefing.tsx @@ -23,6 +23,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { EmptyState } from "@/components/ui/empty-state"; import { useTranslations } from "@/lib/i18n/context"; import { formatRelativeTime } from "@/lib/i18n/relative-time"; +import { stripChartTokens } from "@/lib/insights/chart-tokens"; import { cn } from "@/lib/utils"; import type { DailyBriefing as DailyBriefingPayload, @@ -143,11 +144,13 @@ function KeyFindingRow({ finding }: { finding: DailyBriefingKeyFinding }) { />{finding.headline}
++ {stripChartTokens(finding.headline)} +
- {finding.detail} + {stripChartTokens(finding.detail)}
{text}
++ {stripChartTokens(text)} +
{typeof confidence === "number" && ({annotation}
++ {stripChartTokens(annotation)} +
{confidence ? ({report.summary}
++ {stripChartTokens(report.summary)} +
{/* Going well */} @@ -200,7 +203,7 @@ export function WeeklyReportPresentation({ accent="text-dracula-green" icon={} > -- {report.dataQualityNotes} + {stripChartTokens(report.dataQualityNotes)}
)}