Skip to content

fix(web): render grounded-chat answers as markdown#33

Merged
harrymove-ctrl merged 1 commit into
mainfrom
fix/chat-answer-markdown
Jun 21, 2026
Merged

fix(web): render grounded-chat answers as markdown#33
harrymove-ctrl merged 1 commit into
mainfrom
fix/chat-answer-markdown

Conversation

@harrymove-ctrl

Copy link
Copy Markdown
Owner

Problem

The Memory grounded-chat panel (and the run AI-summary) rendered the model's markdown answer as plain text:

  • splitAiParagraphs collapsed every single newline into a space, flattening bullet lists into one run-on paragraph.
  • Markdown was never parsed, so **bold** showed literal asterisks.
  • Empty sections rendered an ugly KEY POINTS · No items found. card.

Fix

  • New MarkdownText helper routes the answer + each key point through ReactMarkdown + remark-gfm (already dependencies, used for docs): bold, nested bullets, ordered lists, inline code, links, GFM tables. Escaped \n normalized first.
  • AiResultData now drops empty fields → empty KEY POINTS is hidden instead of "No items found." Removed the dead splitAiParagraphs.
  • Compact, on-brand markdown CSS scoped to .aiTextAnswer / .aiAnswerList (olive ::marker, weighted <strong>, green-tinted inline code, dark code blocks, bordered tables, nested-list indentation).

Improves all three answer surfaces consistently: grounded chat panel, playground chat, and run AI summary.

Verification

  • tsc typecheck clean; vite build clean (CSS +2.5KB; JS unchanged — markdown lib was already bundled).
  • Live test on demo:deepbook: answer body renders 10 real <strong> spans, 1 top-level list + 4 nested sub-lists, 0 literal **; KEY POINTS = real bulleted list; no "No items found."

The Memory chat (and run AI summary) rendered the model's markdown answer
as plain text: splitAiParagraphs collapsed single newlines into spaces —
flattening bullet lists into one run-on paragraph — and never parsed
markdown, so **bold** showed literal asterisks. Empty sections also
rendered an ugly "No items found." card.

- Route answer text + each key point through ReactMarkdown + remark-gfm
  (already deps): bold, nested bullets, ordered lists, inline code, links,
  tables. Normalize escaped \n first.
- AiResultData now drops empty fields, so empty KEY POINTS is hidden
  instead of showing "No items found.". Remove dead splitAiParagraphs.
- Add compact, on-brand markdown CSS scoped to .aiTextAnswer/.aiAnswerList
  (olive markers, weighted strong, tinted inline code, code blocks, tables).
@harrymove-ctrl harrymove-ctrl merged commit 16976a5 into main Jun 21, 2026
2 checks passed
@harrymove-ctrl harrymove-ctrl deleted the fix/chat-answer-markdown branch June 21, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants