Skip to content

feat(web): render site audit results in agent chat - #386

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:feat/render-site-audit-results-inline
Jul 10, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
BharadwajKanneveti:feat/render-site-audit-results-inline

Conversation

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor

Summary

Adds inline rendering support for completed Site Audit results in the in-product agent chat.

Changes

  • Added a new render_audit agent tool that renders completed Site Audit results inline.
  • Added AgentAuditSpec for the audit rendering payload.
  • Added an AuditToolPart renderer to handle tool-render_audit responses.
  • Added an AuditResultCard component that reuses the existing Site Audit UI (score gauge, category breakdown, and recommendations).
  • Updated the agent system prompt to instruct the model to call render_audit after a completed get_site_audit response.

Related issue

Closes #272

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor Author

Hi @gkhngyk I have raised the PR please let me know if you find any issue.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clean take on #272 — nice reuse of ScoreGauge/barColor and the same "echo tool" pattern as render_chart, and the get_site_audit → render_audit fields line up exactly so the model can pass values straight through. Approving so this isn't blocked. A few small, non-blocking follow-ups you can fold in here or leave for later:

  1. Move AgentAuditSpec out of agent-chart.tsx — the audit spec has nothing to do with charts. Co-locating it with AuditResultCard (or next to the tool in tools.ts) reads better, and it lets you drop the duplicate import … from '@/components/agent/agent-chart' in page.tsx.

  2. Hint the 3-recommendation cap to the model — the card renders recommendations.slice(0, 3), but nothing tells the model that, so it'll pass the full list and spend tokens the card discards. A short "pass the top 3 recommendations" note in the tool description fixes it.

Optional / not blocking:

  1. Schema tightness — categoryScores/recommendations are z.unknown() and cast in the card. That's a defensible choice for an echo tool (and the card is null-safe), but defining at least score and recommendation in the schema would catch a malformed pass earlier. Judgment call — leaving it as-is is fine.

  2. i18n — the card's labels are hardcoded English while audit-report.tsx uses translation keys. No action needed here: the app only ships en.json today, and wiring the remaining dashboard surfaces to next-intl is already tracked in #384 — this component belongs there.

Thanks for this!

@gkhngyk
gkhngyk merged commit 756526a into ansvisor:main Jul 10, 2026
4 checks passed
@gkhngyk gkhngyk mentioned this pull request Jul 12, 2026
7 tasks done
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.

feat(agent): render Site Audit results inline in the chat

2 participants