Chat: charts in replies, Copy on code blocks, and a marked task update #2

Merged
kubus merged 1 commit from t3code/styled-message-viz into main 2026-10-10 23:53:25 +00:00
Owner

Summary

  • Charts in replies: ```chart blocks hold JSON (type "line" or "bar", title, unit, x labels, series with data). Line charts show trends over time with hover readout and arrow-key navigation; bar charts compare values across categories. Both platforms render with colour-blind-safe palette and responsive layout.
  • Copy on code blocks: web and iOS add a button in the corner; click/tap copies to clipboard with momentary checkmark feedback.
  • Marked task update: replies and task cards now show "Updated [time]" when the task's result changed after the message was sent. Divider separates the reply text from a result that arrived later.
  • Prompt updated to guide the bot: when a trend is the point, draw a chart block instead of a table or list of numbers.

Testing

  • Create a chat request that results in a chart (e.g., memory usage over time, spending by category)
    • Web: verify the chart renders, hover shows readout, arrow keys navigate x-axis, legend appears for multiple series
    • iOS: verify the chart renders, drag/swipe shows readout, correct colours and formatting
    • Both: title displays, unit formats correctly (%, GiB, $, etc.), single series has no legend
  • Copy code blocks: web and iOS, check clipboard contains the code, button shows checkmark briefly
  • Task message updates: trigger a task that updates its result after sending (e.g., a schedule that runs), verify the message shows "Updated [time]" and the divider appears before the result
  • Edge cases: malformed chart JSON (falls back to code block), chart block still streaming (placeholder skeleton), gap in series data (line lifts the pen), zero values in bar chart
## Summary - Charts in replies: ```chart blocks hold JSON (type "line" or "bar", title, unit, x labels, series with data). Line charts show trends over time with hover readout and arrow-key navigation; bar charts compare values across categories. Both platforms render with colour-blind-safe palette and responsive layout. - Copy on code blocks: web and iOS add a button in the corner; click/tap copies to clipboard with momentary checkmark feedback. - Marked task update: replies and task cards now show "Updated [time]" when the task's result changed after the message was sent. Divider separates the reply text from a result that arrived later. - Prompt updated to guide the bot: when a trend is the point, draw a chart block instead of a table or list of numbers. ## Testing - Create a chat request that results in a chart (e.g., memory usage over time, spending by category) - Web: verify the chart renders, hover shows readout, arrow keys navigate x-axis, legend appears for multiple series - iOS: verify the chart renders, drag/swipe shows readout, correct colours and formatting - Both: title displays, unit formats correctly (%, GiB, $, etc.), single series has no legend - Copy code blocks: web and iOS, check clipboard contains the code, button shows checkmark briefly - Task message updates: trigger a task that updates its result after sending (e.g., a schedule that runs), verify the message shows "Updated [time]" and the divider appears before the result - Edge cases: malformed chart JSON (falls back to code block), chart block still streaming (placeholder skeleton), gap in series data (line lifts the pen), zero values in bar chart
- Hatbot can draw a line or bar chart with a ```chart block of JSON (up to
  3 series). The web draws it as SVG with a hover readout; iOS uses Swift
  Charts. Series colours (amber, blue, teal) pass the colour-blind checks on
  the bot bubble in light and dark. A block still streaming shows a
  placeholder; a malformed one stays a code block.
- Code blocks get a Copy button.
- A task's result under the reply that started it gets a rule above it, like
  text after a tool call, and Copy joins them with ---.
- A message a task result changed shows "Updated 10:58" after its time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kubus merged commit 93976c4f0e into main 2026-10-10 23:53:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kubus/hatbot!2
No description provided.