Skip to content

fix: handle nested response object in report agent chat#31

Open
back2zion wants to merge 1 commit intonikmcfly:mainfrom
back2zion:fix/chat-response-parsing
Open

fix: handle nested response object in report agent chat#31
back2zion wants to merge 1 commit intonikmcfly:mainfrom
back2zion:fix/chat-response-parsing

Conversation

@back2zion
Copy link
Copy Markdown

Summary

  • The /api/report/chat endpoint returns a nested response: {data: {response: {response: "text", sources: [], tool_calls: []}}}
  • The frontend (Step5Interaction.vue) expected res.data.response to be a string, but it's an object
  • This caused the chat UI to spin indefinitely as the object couldn't be rendered as message content

Fix

Added type check to extract the inner string when res.data.response is an object:

// Before
content: res.data.response || res.data.answer || 'No response',

// After
content: (typeof res.data.response === 'object' ? res.data.response.response : res.data.response) || res.data.answer || 'No response',

Test plan

  • Verified /api/report/chat returns nested {response: {response: "..."}} structure
  • Confirmed chat messages now render correctly after the fix

The /api/report/chat endpoint returns a nested response structure:
{data: {response: {response: "text", sources: [], tool_calls: []}}}

But the frontend expected res.data.response to be a string directly,
causing the chat UI to spin indefinitely as the object couldn't be
rendered as message content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant