Repository navigation
feat(chat): show a Site Audit Chat reads as a card with its score gauge and "64 ± 2" - #2149
Merged
Merged
Conversation
…ard and Reports Follow-up to ansvisor#2131: the places it listed as not showing the range now do, by the same rule (scoreRange) and page grouping (auditPageKey). - get_site_audit (MCP, Chat's list_site_audit_issues, the Agent, and GET /api/mcp/site-audits/:id) returns scoreRange: { plusMinus, low, high, audits } in points, or null with fewer than 3 complete audits or for an audit that isn't compared. It's read alongside the signals; a failed read leaves it null. - A shared read, lib/audit/page-trend.ts, reads the page's complete audits before an audit from the brand's, newest first, a slice at a time, until it has the 4 the range needs: the audits GET /api/audits/:id reads for pageTrend. - The Agent's audit card shows "64 ± 2" with ScoreRangeMark and the audit.range sentence. render_audit takes scoreRange; asScoreRange keeps only a range the rule could give. - Reports › Site Audit Score, page and PDF: the range from the page's audits up to the end date, as a new optional payload field (range). Older reports show none. The snapshot reads the page's earlier audits with the shared read instead of the brand's latest 100, so the previous score and the range come from the same audits. The summary prompt says what auditScore.range is. - Help: Score range (read an audit report) and a Site Audit Score section in Generate visibility reports; approved-articles.json refreshed. docs/guides/site-audit.mdx and mcp-server.mdx updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…card Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…ge and range The owner asked for a Site Audit card in the new Chat, on top of ansvisor#2143's scoreRange. After a list_site_audit_issues read, the engine builds the card from the read's own result and emits audit.ready, as What's new and Why do: the run state applies it, a reloaded chat reads it back from chat_run_events, and ChatThreadView draws it with the run's other cards. - The card: the page, its score on the report's ScoreGauge with ScoreRangeMark ("64 ± 2") and the audit.range sentence when scoreRange isn't null, "Audited …" with the change since the page's audit before (audit.scoreChange), and Open report. A partial audit shows the report's note and no range or change; a running, failed or unscored audit shows no card. - Never the model's numbers: a range is kept only if asScoreRange accepts it and the score is in it, on the server and again in the browser. One card per audit, 3 at most per answer. No id in the event but the report link. - get_site_audit (MCP, Chat, the Agent, the REST twin) returns partial, previousScore and previousCreatedAt, from the read the range already does (readPageComparison). The tool descriptions say what they mean. - Help: "A Site Audit in Chat" in Use Chat, and Score range in Read a site audit report; approved-articles.json refreshed. The Site Audit and MCP guides mention the card and the new fields. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…card main now has ansvisor#2143 squashed (e2be79b), which this branch was stacked on; its tree matched the branch's base, so every conflict keeps the branch's side. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 5, 2026
Main brought ansvisor#2146, ansvisor#2148 and ansvisor#2149. help/chat/agents.md's front matter keeps both keyword and synonym lists; approved-articles.json regenerated; schema.sql rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #2143, now merged.
mainis merged into this branch, so the diff shows only this PR's own commit (a2e0d9d).#2143 gave Chat the score's range through
list_site_audit_issues, but the new Chat answered in text only. The owner asked for a card. When Chat reads a Site Audit, a card now shows under the answer with:ScoreGaugewithScoreRangeMark): "64 ± 2".scoreRangeisn't null. It uses feat(audit): show the score's range from the page's own audits (customer priorities item 1) #2131'saudit.range.*strings: "This page's last 5 audits scored 62 to 66, changes to the page included."audit.scoreChangebadge.Other audit states:
How
list_site_audit_issuesread, the engine builds the card from the result (auditCardinweb/src/lib/chat/audit-card.ts) and emits a new event,audit.ready.whats_new.ready) and Why (why.ready) use: the browser applies the event (run-state.ts), a reloaded chat reads it back fromchat_run_events(thread.ts), andChatThreadViewdraws it with the run's other cards.asScoreRange) and the score shown falls inside it. The browser checks again, so a range a model or an older event altered isn't shown.href), whichchatEventalready allows.AuditResultCard. It leaves out the category breakdown and the recommendations; Open report has them.get_site_auditgets three fields, so the card's change comes from the result, as the report's does:previousScore(0–1, liketotalScore) andpreviousCreatedAt: the page's previous audit, named as inGET /api/audits/:id. Both are null for a page audited once, and for an audit that isn't compared.partial.They come from the read the range already does (
readPageComparisoninweb/src/lib/audit/page-trend.ts, whichreadScoreRangenow uses), so there's no extra query. If that read fails, the audit still comes back, without them. MCP'sget_site_audit, the REST twin and the Agent get them as well. The MCP and Chat tool descriptions explain them. Chat's description also tells the model that the card shows the numbers, so the answer doesn't repeat them.Help
approved-articles.jsonis refreshed.docs/guides/site-audit.mdxanddocs/guides/mcp-server.mdxmention the card and the new fields.No migration:
chat_run_events.typetakes any event type.Notes for review
get_site_auditgrows by three fields. The result had no previous score, so the card couldn't show the change the report shows. This PR adds it from the same read instead of leaving the change out. The fields are additive, so MCP clients aren't affected; the owner is fine with that.MAX_AUDIT_CARDS, easy to change.Related issue
None. Follow-up to #2131 and #2143 (customer priorities plan, P0 item 1, score stability): the owner decided to give the new Chat an audit card.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
get_site_auditreturnspartial,previousScoreandpreviousCreatedAt.cd web && npx vitest run src/components/chat/run/audit-card.test.tsx src/lib/chat/audit-card.test.ts src/lib/chat/events.test.ts src/lib/chat/thread.test.ts src/lib/chat/engine.test.ts src/lib/audit src/lib/mcp/site-audit-range.test.ts src/lib/helpChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.mdThe full web checks ran on a2e0d9d's tree, which is also the pushed head's tree (a092e10). The merge of
mainonly adds #2143's squash, which the branch already had. It still merges cleanly into currentmain.formatchanged nothing;format:checkandtypecheckpass.lint: 0 errors. Its 7 warnings are old ones in files this PR doesn't touch.yarn test: 994 files pass (10,652 tests, 1 skipped).yarn buildpasses with CI's placeholder env.main's.Generated by Claude Code