Migrate /try chat to Anthropic /v1/messages + table rendering and UX polish - #5
Merged
Merged
Conversation
Free NVIDIA-hosted models (DeepSeek V4 Flash, Qwen3 Coder, Llama 4
Maverick) leaked raw <tool_call>{...}</tool_call> text into the chat
because the OpenAI-compat gateway path lost fidelity translating tool
schemas for them. Anthropic-native /v1/messages preserves the schema
end-to-end — same path Franklin CLI uses — so every model now actually
calls tools.
Protocol
- CHAT_ENDPOINT → /v1/messages with anthropic-version: 2023-06-01
- Tool schemas: OpenAI function.parameters → Anthropic input_schema
- Request body: system as top-level field, max_tokens required,
tool_choice as {type:"tool", name}
- Response parsing: content[] blocks (tool_use / text) instead of
choices[0].message.tool_calls
- Tool results: Anthropic tool_result content blocks batched into one
user message instead of OpenAI role:"tool" messages
- Vision: OpenAI image_url → Anthropic image.source with auto-detect
for data: URLs vs http(s) URLs
- Proxy allowlist: /messages + forward anthropic-version header
Chat reliability
- Payment-rejection rollback: orphan user msg no longer persists into
the conversation list or leaks to other windows on next hydrate
- Empty conversations auto-delete (sidebar + GCS) instead of becoming
stray "New chat" entries
- Error path clears the activity log so "<model> thinking" no longer
keeps spinning after a wallet rejection
Table rendering
- GFM tables (| col | col | + |---|---|) now render as <table> instead
of falling through as raw text — fixes wide assistant replies (e.g.
smart-money comparison grids)
- TableBlock wraps in a card with header bar: Copy as Markdown,
Download CSV (RFC 4180 quoted), Expand to fullscreen overlay
- Column alignment via :--- / ---: / :---: GFM syntax
- Horizontal scroll wrapper so wide tables don't break the chat column
UI polish
- Wallet pill: single row layout (network chip + balance + address
inline), no dead zone between content and the disconnect icon;
quieter Base chip, ghost disconnect button
- "OpenAI O3" label (was "O3") — aligns with same-group naming
- 3 fresh prediction-market starter prompts replace selfie/cold-call/
character-consistency cases (broad, evergreen, always-returns-data
queries: 24h movers, top sports markets, top AI/tech markets)
Cleanup
- Drop dead streaming chat path (supportsTools() was always true)
- Remove unused streaming state + setStreaming calls
- Drop casePhone i18n key (no longer rendered)
Verified: tsc --noEmit clean; lint clean on touched files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Free NVIDIA-hosted models (DeepSeek V4 Flash, Qwen3 Coder, Llama 4 Maverick) leaked raw `<tool_call>{...}</tool_call>` text into the chat — the OpenAI-compat gateway path was lossy when translating tool schemas for them. Switching the chat endpoint to Anthropic-native `/v1/messages` — the same path Franklin CLI uses — preserves the schema end-to-end so every model (free or paid) actually calls tools.
Verified with Qwen3 Coder 480B in the live dev server: tool calls fire as native `tool_use` blocks, no `<tool_call>` text leak.
Bundles a few related reliability + rendering + UX fixes that surfaced during the migration.
Protocol migration
Chat reliability
GFM table rendering
Wide assistant replies (e.g. smart-money comparison grids, vocab grids) used to fall through as raw `| col | col |` text. Now parsed and rendered.
UI polish
Cleanup
Verification
Follow-ups (not in this PR)