Skip to content

Comments

Frontend: fix Agent Chat JSON rendering for model outputs#4

Merged
igaurab merged 3 commits intomainfrom
develop
Feb 22, 2026
Merged

Frontend: fix Agent Chat JSON rendering for model outputs#4
igaurab merged 3 commits intomainfrom
develop

Conversation

@igaurab
Copy link
Collaborator

@igaurab igaurab commented Feb 22, 2026

Summary

This PR fixes cases where valid/near-valid model JSON responses were rendered as markdown text in Agent Chat instead of structured JSON.

What changed

  • Updated /Users/igaurab/i/akd-debugger/frontend/src/components/agents/agent-chat-view.tsx parsing logic to:
    • Try full-message JSON parsing first (before markdown/code-fence segmentation).
    • Extract balanced JSON objects/arrays from mixed-content messages.
    • Normalize common model-output quirks before parsing:
      • smart quotes
      • BOM
      • hidden unicode whitespace/control characters
      • trailing commas before } / ]

Why

Some model responses contain small formatting artifacts even when they are conceptually JSON, causing strict parse failure and fallback to markdown rendering.

@igaurab igaurab merged commit 5e5af46 into main Feb 22, 2026
1 check passed
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