feat(platform): improve chat UX with animation fixes and add-agent button#560
Conversation
…tton Fix thinking animation visibility by moving hide logic to ChatMessages. Prevent flicker between multi-step tool calls with robust incomplete message detection. Simplify TypewriterText by removing CSS custom property reveal. Add "Add agent" button to AgentSelector with URL-based dialog state.
Greptile SummaryThis PR improves the chat UX by fixing animation visibility issues and adding an "Add agent" button to the agent selector. Key improvements:
Test coverage:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| services/platform/app/features/chat/components/thinking-animation.tsx | removed hide-when-streaming logic by deleting the check for streamingMessage?.text && toolDetails.length === 0, moving responsibility to parent component |
| services/platform/app/features/chat/components/chat-messages.tsx | added conditional !streamingMessage?.text to hide thinking animation when typewriter text is visible |
| services/platform/app/features/chat/hooks/use-message-processing.ts | improved hasIncompleteAssistantMessage to check for in-flight assistant messages (streaming or pending), preventing flicker between multi-step tool calls |
| services/platform/app/features/chat/components/typewriter-text.tsx | removed CSS custom property mechanism (--reveal-chars, container ref, and useEffect), simplifying component by relying on IncrementalMarkdown directly |
| services/platform/app/hooks/use-dialog-search-param.ts | new hook that manages dialog state via URL search params using useUrlState, providing isOpen, open, close, and onOpenChange methods |
| services/platform/app/features/chat/components/agent-selector.tsx | added "Add agent" button with ability check (canManageAgents), CreateCustomAgentDialog integration, and URL-based dialog state management |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ChatMessages Component] -->|hasIncompleteAssistantMessage| B{Check streamingMessage.text}
B -->|Has text| C[Hide ThinkingAnimation<br/>Show TypewriterText]
B -->|No text| D[Show ThinkingAnimation]
E[use-message-processing] -->|Enhanced Logic| F{Check newest message}
F -->|Not complete| G[Return true]
F -->|Complete| H{Any assistant msg<br/>streaming/pending?}
H -->|Yes| I[Return true<br/>Prevents flicker]
H -->|No| J[Return false]
K[AgentSelector] -->|User clicks Add| L[useDialogSearchParam.open]
L -->|Sets URL param| M[dialog=create-agent]
M -->|Triggers| N[CreateCustomAgentDialog]
O[TypewriterText] -->|Simplified| P[IncrementalMarkdown]
O -.->|Removed| Q[CSS --reveal-chars<br/>Container ref<br/>useEffect]
Last reviewed commit: 666f9ff
📝 WalkthroughWalkthroughThis PR introduces agent creation capabilities to the chat interface with URL-based dialog state management. It adds a new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@services/platform/app/features/chat/components/agent-selector.tsx`:
- Around line 120-123: The CreateCustomAgentDialog can be opened via the URL
param even when the user lacks permission; guard both the programmatic opener
and the dialog render by checking the same permission flag. In
handleAddAgentClick only call createAgentDialog.open() if canManageAgents is
true (and keep the existing setOpen(false) behavior), and ensure anywhere the
URL-driven open (useDialogSearchParam/createAgentDialog.open on mount or effect)
first verifies canManageAgents and otherwise clears the dialog param or forces
the dialog closed. Also wrap/render CreateCustomAgentDialog only when
canManageAgents is true so unauthorized users cannot see it (reference:
canManageAgents, createAgentDialog, CreateCustomAgentDialog,
useDialogSearchParam).
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (11)
services/platform/app/features/chat/components/__tests__/agent-selector.test.tsxservices/platform/app/features/chat/components/__tests__/thinking-animation.test.tsxservices/platform/app/features/chat/components/agent-selector.tsxservices/platform/app/features/chat/components/chat-messages.tsxservices/platform/app/features/chat/components/thinking-animation.tsxservices/platform/app/features/chat/components/typewriter-text.tsxservices/platform/app/features/chat/hooks/use-message-processing.tsservices/platform/app/globals.cssservices/platform/app/hooks/__tests__/use-dialog-search-param.test.tsservices/platform/app/hooks/use-dialog-search-param.tsservices/platform/messages/en.json
💤 Files with no reviewable changes (2)
- services/platform/app/globals.css
- services/platform/app/features/chat/components/thinking-animation.tsx
…check Wrap CreateCustomAgentDialog with canManageAgents guard so unauthorized users cannot open the dialog via URL param (?dialog=create-agent).
Summary
ThinkingAnimationintoChatMessagesfor cleaner component boundarieshasIncompleteAssistantMessageTypewriterTextby removing the CSS custom property reveal mechanism (--reveal-chars,.typewriter-container)AgentSelectorwith a URL-based dialog state hook (useDialogSearchParam)Test plan
thinking-animation.test.tsx,agent-selector.test.tsx,use-dialog-search-param.test.tsSummary by CodeRabbit
New Features
Bug Fixes
Tests