Add grounded Ask onboarding - #14
Draft
astrowq wants to merge 1 commit into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
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
/askwith 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 |
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
/askAnswer Canvas with grounded, typed visibility cards and exact stored-response evidencegpt-5.6-terraas the default Ask reasoning modelWhy
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