Skip to content

feat(copilot): render assistant replies as markdown (themed, safe)#197

Merged
arigatoexpress merged 1 commit into
mainfrom
feat/copilot-markdown
Jun 15, 2026
Merged

feat(copilot): render assistant replies as markdown (themed, safe)#197
arigatoexpress merged 1 commit into
mainfrom
feat/copilot-markdown

Conversation

@arigatoexpress

Copy link
Copy Markdown
Owner

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 existing SafeMarkdown component (rehype-sanitized, error-boundary fallback to plain text). User bubbles stay plain.

Theming

prose hardcodes 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

  • SafeMarkdown already wraps an error boundary that falls back to the raw text, so a malformed reply can't break the panel.
  • react-markdown is already in the shared vendor-markdown chunk → the page chunk grows only ~0.4 kB.
  • vite build passes. (No live preview: the page is admin-gated and the chat needs Vertex, so it can't round-trip locally.)

🤖 Generated with Claude Code

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>
@arigatoexpress arigatoexpress merged commit 315c3e6 into main Jun 15, 2026
1 check passed
@arigatoexpress arigatoexpress deleted the feat/copilot-markdown branch June 15, 2026 20:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant