docs: Ask AI chat grounded in the docs vector store#5172
Conversation
|
@ouiliame is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview A new The route includes abuse controls for this public, paid-LLM proxy: per-request size/token/step limits, lenient Origin allowlisting ( Reviewed by Cursor Bugbot for commit d5610a4. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@ouiliame run the review loop and fix the comments and re-run |
|
@greptile review |
|
@greptile review |
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
@cursor review |
1 similar comment
|
@cursor review |
|
@cursor review |
|
@cursor review |
|
@cursor review |
|
@cursor review |
1 similar comment
|
@cursor review |
|
@cursor review |
25a0972 to
20577ea
Compare
|
@cursor review |
20577ea to
4a71642
Compare
4a71642 to
8c1e2d9
Compare
Adds an Ask AI chat to the docs site. A floating launcher opens a chat panel backed by the Vercel AI SDK (OpenAI provider, OPENAI_API_KEY from the environment). A searchDocs tool runs locale-scoped vector/keyword search over the existing docs embeddings so answers cite real pages. The public endpoint is hardened: per-request size/token/step caps, message sanitization (no client-injected tool results or system prompts), origin checks, and a per-IP rate limit. Non-English retrieval uses keyword search; English vector search applies a similarity threshold. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8c1e2d9 to
3066d06
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3066d06. Configure here.
- searchDocs: wrap the keyword query in try/catch too, so each retrieval path (keyword, vector) is independent best-effort - ask-ai: gate the loading ellipsis to the in-progress (last) message so older empty bubbles don't re-show it while a later request streams Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
Adds an Ask AI chat to the docs site so readers can ask questions about Sim in natural language and get answers grounded in the documentation.
components/ai/ask-ai.tsx) built on the Vercel AI SDK'suseChat. Assistant replies render as markdown viastreamdown(the same AI-streaming markdown renderer the main app's chat uses), with source chips linking back to cited pages.app/api/chat/route.ts) usingstreamTextwith the OpenAI provider. AsearchDocstool runs a vector search over the existingdocs_embeddingsstore and returns source links, so the model answers from real docs rather than memory.OPENAI_API_KEYalready in the environment (same key the docs search uses for embeddings). Model defaults togpt-5.4-mini, overridable viaOPENAI_CHAT_MODEL.Abuse hardening
This endpoint proxies a paid LLM, so an unauthenticated public route is a target for scripted "free inference". Shipped in this PR (cost caps per request):
DOCS_ALLOWED_ORIGINSto extend)Infra-side follow-ups (dashboard/provisioning, not code) — do before public launch:
Notes
llms.txt,llms-full.txt,.md/.mdxroutes,Acceptnegotiation) already existed — this PR adds only the Ask AI chat.text-embedding-3-small); only the chat completion uses the chat model. Branch is offstaging;bun run buildandtype-checkpass for the docs app.🤖 Generated with Claude Code