Skip to content

Add grounded Ask onboarding - #14

Draft
astrowq wants to merge 1 commit into
mainfrom
codex/ask-aperture-onboarding
Draft

Add grounded Ask onboarding#14
astrowq wants to merge 1 commit into
mainfrom
codex/ask-aperture-onboarding

Conversation

@astrowq

@astrowq astrowq commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the /ask Answer Canvas with grounded, typed visibility cards and exact stored-response evidence
  • add a bounded OpenAI tool-calling service backed by five read-only SQLAlchemy tools, honest refusal behavior, and duplicate-tool protection
  • add a six-step conversational onboarding flow that creates the brand, competitors, buyer-intent queries, stores the BYOK key, and launches the first audit
  • hand completed onboarding into the dashboard with active-run polling and responsive navigation
  • configure gpt-5.6-terra as the default Ask reasoning model

Why

New Aperture installs previously required users to understand the Brands, Queries, Settings, and Audits screens before seeing value. This gives them a guided path from an empty installation to their first visibility measurements, then lets them interrogate only their stored audit data conversationally.

User impact

A new user can answer six focused questions, start monitoring immediately, and land in the main dashboard. Existing users get an Ask tab with data-derived prompts, grounded KPI/share-of-voice/trend/query cards, and one-click access to the exact underlying engine response.

Validation

  • .venv/bin/python -m pytest -q — 68 passed
  • ./node_modules/.bin/tsc --noEmit
  • ./node_modules/.bin/next build
  • browser E2E: onboarding → brand/query creation → first audit → dashboard → grounded KPI answer → per-query evidence drawer
  • desktop and mobile visual checks with no console errors or framework error overlay

Copilot AI review requested due to automatic review settings July 21, 2026 15:48
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aperture Error Error Jul 21, 2026 3:48pm

Copilot AI 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.

Pull request overview

Adds a new “Ask” experience to Aperture that onboards new installs conversationally and enables grounded Q&A over stored audit data via a bounded tool-calling backend service, plus UI/navigation updates to surface it in the product.

Changes:

  • Introduces /ask with a 6-step onboarding flow that creates initial Brand/Queries, stores the BYOK key, and launches the first audit.
  • Implements a backend Ask service with a read-only SQLAlchemy tool catalog, grounding/refusal behavior, and tool-call de-duplication.
  • Updates the dashboard/sidebar/layout/styles to route new users into onboarding and support responsive navigation + active-run polling.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/views/Dashboard.tsx Redirects empty installs to /ask, reads onboarding params, and polls while runs are active.
frontend/src/views/Ask.tsx New Ask UI: conversational onboarding + grounded answer canvas + evidence drawer.
frontend/src/types/index.ts Adds typed contracts for Ask responses, answer parts, and evidence payloads.
frontend/src/components/Sidebar.tsx Adds “Ask” nav item and makes sidebar responsive/compact.
frontend/src/app/layout.tsx Ensures main content can shrink (min-w-0) with responsive sidebar.
frontend/src/app/globals.css Adds Ask/onboarding visual system + responsive styles and sidebar hiding during onboarding.
frontend/src/app/ask/page.tsx Registers the /ask page entrypoint.
frontend/src/api/index.ts Adds askAperture() and getEvidence() API calls (toast-on-error interceptor already present).
backend/tests/test_ask.py Adds grounding, refusal, contract-shape, and tool de-duplication tests for Ask.
backend/app/services/ask/tools.py Adds read-only grounding tools (overview/SOV/trend/query results/raw response) + execution guardrails.
backend/app/services/ask/ask_service.py Adds bounded OpenAI tool-calling loop, grounding checks, and response shaping.
backend/app/services/ask/init.py Declares the Ask service package.
backend/app/schemas.py Adds Ask request/response schemas and typed answer-part envelope.
backend/app/routers/ask.py Adds Ask and evidence endpoints (key-gated Ask, evidence retrieval).
backend/app/main.py Wires the Ask router into the FastAPI app.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 30 to +44
useEffect(() => {
getBrands().then(setBrands)
}, [])
getBrands().then(items => {
setBrands(items)
if (items.length === 0) {
router.replace('/ask')
return
}
const params = new URLSearchParams(window.location.search)
const requestedBrand = Number(params.get('brand'))
if (requestedBrand && items.some(brand => brand.id === requestedBrand)) {
setSelectedBrand(requestedBrand)
}
setOnboarded(params.get('onboarded') === '1')
})
}, [router])
Comment on lines +373 to +380
const openEvidence = async (resultId: number) => {
setEvidenceLoading(true)
try {
setEvidence(await getEvidence(brandId, resultId))
} finally {
setEvidenceLoading(false)
}
}
Comment on lines +488 to +491
<div className="answer-card kpi-card">
<div><p className="card-label">Mention rate · {data.provider}</p><p className="mt-2 text-4xl font-medium tabular-nums text-slate-50">{data.mention_rate ?? '—'}<span className="text-xl text-slate-500">%</span></p></div>
<div className="text-right"><p className={`text-sm font-medium ${(data.delta ?? 0) >= 0 ? 'text-emerald-300' : 'text-rose-300'}`}>{data.delta == null ? 'First baseline' : `${data.delta > 0 ? '+' : ''}${data.delta} pts`}</p><p className="mt-2 text-xs text-slate-500">{data.completed_queries} queries measured</p></div>
</div>
Comment on lines +42 to +43
except Exception as exc:
raise HTTPException(status_code=502, detail=f"Ask Aperture could not reach the reasoning model: {exc}") from exc
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.

2 participants