feat(copilot): render assistant replies as markdown (themed, safe)#197
Conversation
Gemini returns markdown (bold counts, numbered steps, bullet lists) that the chat panel was showing as raw text with literal ** and -. Assistant bubbles now render via the existing SafeMarkdown component (sanitized, error-boundary fallback to plain text). User bubbles stay plain. prose hardcodes gray text that would be unreadable on the dark assistant bubble, so the prose typography colors are mapped onto the app theme tokens (--cp-text/-muted/-accent) for correct light + dark rendering. react-markdown is already bundled (shared vendor chunk), so the page chunk grows only ~0.4 kB. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 763049c21d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| content | ||
| ) : ( | ||
| <div className={MD_THEME}> | ||
| <SafeMarkdown content={content} /> |
There was a problem hiding this comment.
Disable property cards or pass compare handlers
When Ops Copilot returns an inventory answer containing a fenced json, property, or json-property block, SafeMarkdown converts it into a PropertyCard; this usage only passes content, but PropertyCard always renders the Compare button and its click handler calls onToggleCompare(property). In this admin inventory/copilot context, staff clicking that visible Compare action will hit TypeError: onToggleCompare is not a function, so either suppress property-card rendering here or pass a safe handler.
Useful? React with 👍 / 👎.
What
The Ops Copilot's replies from Gemini are markdown — bold counts, numbered steps, bullet lists — but the chat panel rendered them as raw text (literal
**,-,1.). Assistant bubbles now render through the existingSafeMarkdowncomponent (rehype-sanitized, error-boundary fallback to plain text). User bubbles stay plain.Theming
prosehardcodes gray text that's unreadable on the dark assistant bubble, so the prose typography CSS vars are mapped onto the app theme tokens (--cp-text/--cp-muted/--cp-accent) — correct in both light and dark mode.Safety / cost
SafeMarkdownalready wraps an error boundary that falls back to the raw text, so a malformed reply can't break the panel.react-markdownis already in the sharedvendor-markdownchunk → the page chunk grows only ~0.4 kB.vite buildpasses. (No live preview: the page is admin-gated and the chat needs Vertex, so it can't round-trip locally.)🤖 Generated with Claude Code