@vercel/geistdocs 2.14.6 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/components/command-prompt.d.ts.map +1 -1
- package/dist/components/command-prompt.js +59 -61
- package/dist/controls.d.ts +3 -40
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +5 -96
- package/dist/internal/chat-rate-limit.d.ts +10 -0
- package/dist/internal/chat-rate-limit.d.ts.map +1 -0
- package/dist/internal/chat-rate-limit.js +35 -0
- package/dist/internal/command-prompt-transition.d.ts +2 -0
- package/dist/internal/command-prompt-transition.d.ts.map +1 -0
- package/dist/internal/command-prompt-transition.js +17 -0
- package/dist/internal/controls-client.d.ts +40 -0
- package/dist/internal/controls-client.d.ts.map +1 -0
- package/dist/internal/controls-client.js +87 -0
- package/dist/internal/language-selector.d.ts +2 -0
- package/dist/internal/language-selector.d.ts.map +1 -0
- package/dist/internal/language-selector.js +12 -0
- package/dist/internal/navbar/mobile-menu.js +1 -1
- package/dist/internal/page-action-options.d.ts +37 -0
- package/dist/internal/page-action-options.d.ts.map +1 -0
- package/dist/internal/page-action-options.js +39 -0
- package/dist/internal/page-actions-client.d.ts +1 -31
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +5 -103
- package/dist/internal/page-actions-gate.d.ts +3 -0
- package/dist/internal/page-actions-gate.d.ts.map +1 -0
- package/dist/internal/page-actions-gate.js +15 -0
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +26 -1
- package/dist/internal/relative-docs-link.d.ts +7 -0
- package/dist/internal/relative-docs-link.d.ts.map +1 -0
- package/dist/internal/relative-docs-link.js +22 -0
- package/dist/internal/sidebar.d.ts.map +1 -1
- package/dist/internal/sidebar.js +1 -1
- package/dist/internal/toc-actions-client.d.ts +9 -0
- package/dist/internal/toc-actions-client.d.ts.map +1 -0
- package/dist/internal/toc-actions-client.js +78 -0
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +5 -2
- package/dist/navbar.js +1 -1
- package/dist/pages/changelog.js +1 -1
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +4 -3
- package/dist/routes/chat.d.ts +13 -4
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +7 -3
- package/dist/source-config.js +1 -1
- package/docs/agents.md +1 -1
- package/docs/llms.txt +24 -16
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +1 -1
- package/docs/pages/ask-ai.md +19 -14
- package/docs/pages/provider.md +3 -0
- package/package.json +2 -2
- package/source-config.js +1 -1
- package/template/AGENTS.md +1 -1
- package/template/content/docs/agent-readiness.mdx +1 -1
- package/template/content/docs/ask-ai.cn.mdx +1 -1
- package/template/content/docs/ask-ai.mdx +19 -14
- package/template/content/docs/provider.mdx +3 -0
- package/template/package.json +1 -2
|
@@ -299,7 +299,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
|
|
|
299
299
|
|
|
300
300
|
#### Choose a model
|
|
301
301
|
|
|
302
|
-
Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-
|
|
302
|
+
Pass the `model` option to `createChatRoute` to control which model answers Ask AI requests. It accepts any AI SDK `LanguageModel`, including AI Gateway model strings, and defaults to `openai/gpt-6-luna` in standard mode.
|
|
303
303
|
|
|
304
304
|
```ts title="app/api/chat/route.ts"
|
|
305
305
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
@@ -682,28 +682,33 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
682
682
|
|
|
683
683
|
In Vertex-backed proxy mode, the platform `/vertex` route also limits requests to 1,000,000 bytes and 200 messages. Increasing `maxRequestBytes` or `maxMessages` above those values does not raise the platform limits.
|
|
684
684
|
|
|
685
|
-
|
|
685
|
+
## Rate limiting
|
|
686
|
+
|
|
687
|
+
Request size limits don't control how often a client can call the route. Opt in to Vercel Firewall with `createChatRoute({ rateLimit: { ids: ["ask-ai"] } })`. Geistdocs includes the SDK and handles checks, timeouts, and error responses; no app-level SDK dependency or `POST` wrapper is required. Upgrading alone does not enable rate limiting.
|
|
688
|
+
|
|
689
|
+
First, publish a [Firewall SDK rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the ID `ask-ai` in the consumer site's Vercel project. Use the `@vercel/firewall` condition (`rate_limit_api_id`), count by `header:x-vercel-rate-limit-key` for the SDK's default per-client-IP buckets, and choose the request limit and window for your site. Start in log mode, verify enforcement in preview, then switch the exceeded-limit action to `rate_limit` in production. Installing Geistdocs does not create these project rules.
|
|
690
|
+
|
|
691
|
+
Then enable the rule in the chat route:
|
|
686
692
|
|
|
687
693
|
```ts title="app/api/chat/route.ts"
|
|
688
|
-
import { checkRateLimit } from "@vercel/firewall";
|
|
689
694
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
690
695
|
import { config } from "@/lib/geistdocs/config";
|
|
691
696
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
692
697
|
|
|
693
|
-
const
|
|
698
|
+
export const { POST, maxDuration } = createChatRoute({
|
|
699
|
+
config,
|
|
700
|
+
sources: [geistdocsSource],
|
|
701
|
+
rateLimit: { ids: ["ask-ai"] },
|
|
702
|
+
});
|
|
703
|
+
```
|
|
694
704
|
|
|
695
|
-
|
|
705
|
+
For separate burst and hourly limits, publish two rules and pass both IDs, for example `rateLimit: { ids: ["ask-ai-minute", "ask-ai-hour"] }`. Every check must pass; duplicate IDs are checked once. Empty lists and blank IDs throw at route creation.
|
|
696
706
|
|
|
697
|
-
|
|
698
|
-
const { rateLimited } = await checkRateLimit("ask-ai", { request });
|
|
707
|
+
When enabled, checks run before every chat POST in AI Gateway, proxy, and eve agent modes, including prewarm requests. Prewarming and sending each count as a request, so allow for both when choosing limits. Checks run concurrently with a one-second timeout each. Limited requests receive `429`; missing rules, network failures, and timeouts receive `503` before any model, retrieval, proxy, or agent call. Both errors are uncached plain text, displayed by the chat's error toast.
|
|
699
708
|
|
|
700
|
-
|
|
701
|
-
return Response.json({ error: "Too many requests." }, { status: 429 });
|
|
702
|
-
}
|
|
709
|
+
Omit `rateLimit` to keep the existing behavior without firewall calls. The SDK skips checks when `NODE_ENV` is not `production`; `next dev` needs no rules. Local `next start` needs Vercel request headers and firewall access. Protected Vercel previews require Protection Bypass for Automation and exposed system environment variables. Counters are per region, not a global spending cap.
|
|
703
710
|
|
|
704
|
-
|
|
705
|
-
};
|
|
706
|
-
```
|
|
711
|
+
If your site already wraps `POST` with these SDK checks, replace the wrapper with `rateLimit` after upgrading and keep the same published rule IDs. Remove the app's direct `@vercel/firewall` dependency only if no other route uses it. Do not keep both checks, or each request will be counted twice.
|
|
707
712
|
|
|
708
713
|
## Features
|
|
709
714
|
|
|
@@ -770,7 +775,7 @@ The chat interface adapts to different screen sizes:
|
|
|
770
775
|
|
|
771
776
|
The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set for the default AI Gateway mode. Set `GEISTDOCS_CHAT_PROXY_URL` to route Ask AI through a Vertex-backed proxy instead. Eve agent mode needs `GEISTDOCS_CHAT_SECRET` for multi-turn sessions and prewarming. You can read more in the [Environment Variables](/docs/env) section.
|
|
772
777
|
|
|
773
|
-
In default AI Gateway mode, Geistdocs uses `openai/gpt-
|
|
778
|
+
In default AI Gateway mode, Geistdocs uses `openai/gpt-6-luna` via the Vercel AI Gateway. In proxy and eve agent modes, the external responder controls the upstream model.
|
|
774
779
|
|
|
775
780
|
## Suggested Prompts
|
|
776
781
|
|
|
@@ -23,6 +23,9 @@ The provider handles these behaviors:
|
|
|
23
23
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
24
24
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
25
25
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
26
|
+
5. **Theme shortcut**: Press `T` with no modifiers while the page has focus to switch between light and dark themes. The shortcut is disabled when a theme is forced.
|
|
27
|
+
|
|
28
|
+
The shortcut is part of the package provider, so generated consumer projects get it by default. It does not run while an input, button, link, or other element has focus.
|
|
26
29
|
|
|
27
30
|
## Usage
|
|
28
31
|
|
package/template/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@streamdown/code": "^1.0.1",
|
|
18
18
|
"@vercel/agent-readability": "^0.7.0",
|
|
19
19
|
"@vercel/analytics": "^1.6.1",
|
|
20
|
-
"@vercel/geistdocs": "2.
|
|
20
|
+
"@vercel/geistdocs": "2.15.0",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"geist": "1.7.1",
|
|
31
31
|
"jotai": "^2.15.2",
|
|
32
32
|
"mermaid": "^11.12.2",
|
|
33
|
-
"motion": "^12.23.25",
|
|
34
33
|
"nanoid": "^5.1.6",
|
|
35
34
|
"next": "16.3.3",
|
|
36
35
|
"next-themes": "^0.4.6",
|