Conversation
Review Summary by QodoRefactor thinking text storage to use thought property
WalkthroughsDescription• Replace meta_data.thinking_text with thought.thinking_text property • Update chat message handling to use new thought object structure • Refactor message streaming logic to access thinking text from thought property • Update type definitions to include thought property in ChatResponseModel Diagramflowchart LR
A["meta_data.thinking_text"] -->|"Replace with"| B["thought.thinking_text"]
C["Chat message handling"] -->|"Updated to use"| B
D["Message streaming logic"] -->|"Refactored to access"| B
E["Type definitions"] -->|"Extended with"| B
File Changes1. src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
|
Code Review by Qodo
1. No legacy thinking-text fallback
|
| const thinkingText = message.thought?.thinking_text || ''; | ||
| if (thinkingText) { | ||
| if (!dialogs[dialogs.length - 1].meta_data) { | ||
| dialogs[dialogs.length - 1].meta_data = { thinking_text: '' }; | ||
| if (!dialogs[dialogs.length - 1].thought) { | ||
| dialogs[dialogs.length - 1].thought = { thinking_text: '' }; | ||
| } | ||
| dialogs[dialogs.length - 1].meta_data.thinking_text += thinkingText; | ||
| dialogs[dialogs.length - 1].thought.thinking_text += thinkingText; |
There was a problem hiding this comment.
1. No legacy thinking-text fallback 🐞 Bug ≡ Correctness
The UI now reads thinking text only from message.thought.thinking_text, but message ingestion paths (dialogs history + SignalR stream) pass payloads through without normalizing legacy meta_data.thinking_text into thought. This causes thinking text (and avatar visibility during thinking-only) to disappear for existing conversations or any producers still populating meta_data.
Agent Prompt
### Issue description
The UI now relies on `message.thought.thinking_text`, but inbound messages are not normalized from legacy `meta_data.thinking_text`. This breaks display of thinking text for persisted/history messages and any stream events still using `meta_data`.
### Issue Context
Messages come from two main ingress paths:
- Dialog history: `getDialogs()` returns `response.data` directly.
- Realtime stream: SignalR handlers do `JSON.parse()` and forward `obj` directly.
### Fix Focus Areas
Implement one of these (prefer normalization once at ingress):
1) **Ingress normalization**: when loading dialogs and when receiving SignalR messages, map legacy fields:
- If `msg.thought` is missing, set `msg.thought = { thinking_text: msg.meta_data?.thinking_text ?? '' }`.
- Optionally also keep `meta_data` for compatibility.
2) **UI fallback** (if you can’t normalize everywhere): change reads to `message?.thought?.thinking_text ?? message?.meta_data?.thinking_text ?? ''`.
Focus edits here:
- src/routes/chat/[agentId]/[conversationId]/chat-box.svelte[575-613]
- src/routes/chat/[agentId]/[conversationId]/chat-box.svelte[2013-2023]
- src/routes/chat/[agentId]/[conversationId]/rich-content/rc-message.svelte[27-31]
- src/lib/services/conversation-service.js[87-95]
- src/lib/services/signalr-service.js[173-185]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.