feat(frontend): add fade+pill truncation for long chat messages#4344
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Railway Preview Environment
Updated at 2026-05-19T14:34:00.110Z |
478e43c to
8609ab1
Compare
…chat messages
Truncation:
- Long message bodies are clamped at 160px with a fade gradient overlay
- Centered "Show more" pill expands to full height, "Show less" collapses
- ResizeObserver detects when truncation is needed
- CSS max-height transition for smooth expand/collapse animation
Tool calls:
- Assistant messages with tool_calls now render each call as a collapsible
tree node showing function name and arguments
- Meta badge shows "N tool calls" instead of "0 chars" for tool-only messages
- Handles both OpenAI format (function.name/function.arguments) and
direct format (name/arguments)
Also carries forward key={text} on EditorProvider to fix stale content
when navigating between spans.
8609ab1 to
a8bb5f9
Compare
…tree Tool messages (role=tool) often contain JSON responses from function calls. Instead of showing raw JSON text in the editor, parse the content and render it as a RecursiveNode tree with the same collapse/expand and copy behavior as tool call arguments.
Summary
Stacked on #4343.
Long chat messages in the beautified JSON view are now clamped with a fade-to-background gradient and a centered "Show more" pill. Clicking the pill expands the message to full height and reveals a "Show less" pill at the bottom. Short messages render as before with no truncation UI.
This also improves trace message rendering for PydanticAI-style message parts. Text parts render as message text, while
tool_callandtool_call_responseparts keep their JSON payloads structured and expandable instead of being flattened into one opaque string.Details
{type: "text", text}and{type: "text", content}{type: "tool-call", toolName, input}and{type: "tool_call", name, arguments}{type: "tool-result", output}and{type: "tool_call_response", name, result}Accessibility
aria-expanded.aria-hidden="true".motion-safetransitions are consistent with the rest of the component.CleanShot.2026-05-15.at.21.46.56.mp4
Test plan
pnpm lint-fixpartscontainingtool_call. Verify tool arguments render as expandable structured JSON.partscontainingtool_call_response. Verify result arrays/objects render as expandable structured JSON.Notes
pnpm --filter @agenta/oss types:checkcurrently fails on existing repo-wide TypeScript errors outside this change; the localBeautifiedJsonViewtimer issue surfaced by that command was fixed.