@vercel/geistdocs 2.8.0 → 2.9.1-canary.18e5450
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/assets/icons/icon-fullscreen-close.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen-close.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen-close.js +25 -0
- package/dist/assets/icons/icon-fullscreen.d.ts +26 -0
- package/dist/assets/icons/icon-fullscreen.d.ts.map +1 -0
- package/dist/assets/icons/icon-fullscreen.js +25 -0
- package/dist/assets/icons/index.d.ts +2 -0
- package/dist/assets/icons/index.d.ts.map +1 -1
- package/dist/assets/icons/index.js +2 -0
- package/dist/cli/index.js +1 -1
- package/dist/internal/chat/context.d.ts +3 -0
- package/dist/internal/chat/context.d.ts.map +1 -1
- package/dist/internal/chat/context.js +7 -0
- package/dist/internal/chat/message.js +1 -1
- package/dist/internal/chat/shell.d.ts.map +1 -1
- package/dist/internal/chat/shell.js +15 -10
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +226 -19
- package/dist/internal/page-actions-client.d.ts +1 -1
- package/dist/internal/page-actions-client.js +2 -2
- package/dist/internal/provider-client.d.ts.map +1 -1
- package/dist/internal/provider-client.js +9 -3
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +5 -6
- package/docs/agents.md +1 -1
- package/docs/llms.txt +36 -23
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +1 -2
- package/docs/pages/ask-ai.md +12 -7
- package/docs/pages/deployment.md +8 -6
- package/docs/pages/env.md +15 -8
- package/package.json +6 -6
- package/public-foundation.css +0 -2
- package/shared-theme.css +6 -0
- package/template/.env.example +2 -3
- package/template/AGENTS.md +1 -1
- package/template/content/docs/agent-readiness.mdx +1 -2
- package/template/content/docs/ask-ai.mdx +12 -7
- package/template/content/docs/deployment.mdx +8 -6
- package/template/content/docs/env.mdx +16 -9
- package/template/package.json +1 -1
package/docs/pages/ask-ai.md
CHANGED
|
@@ -26,7 +26,7 @@ The AI chat assistant is available in two ways:
|
|
|
26
26
|
|
|
27
27
|
### 1. Per-Page Quick Access
|
|
28
28
|
|
|
29
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
29
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
30
30
|
|
|
31
31
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
32
32
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -52,6 +52,7 @@ Once open, users can:
|
|
|
52
52
|
- Ask questions about any part of your documentation
|
|
53
53
|
- View the documentation pages used as sources for each answer
|
|
54
54
|
- Copy an answer as Markdown
|
|
55
|
+
- Expand the desktop panel to fill the viewport
|
|
55
56
|
- Get step-by-step guidance on complex topics
|
|
56
57
|
|
|
57
58
|
## Control Ask AI from your own components
|
|
@@ -305,20 +306,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
305
306
|
Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
|
|
306
307
|
|
|
307
308
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
308
|
-
2.
|
|
309
|
-
3. Set `
|
|
309
|
+
2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
310
|
+
3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
311
|
+
4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
|
|
312
|
+
5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
|
|
310
313
|
|
|
311
314
|
```txt
|
|
312
315
|
https://<geistdocs-platform-deployment>/vertex
|
|
313
316
|
```
|
|
314
317
|
|
|
315
|
-
|
|
318
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
316
319
|
|
|
317
320
|
When `GEISTDOCS_CHAT_PROXY_URL` is set, Geistdocs searches local docs on the first user message, injects the attached page (or the current page when no page is attached) and related docs into the final user message, forwards `{ messages, platform: "vercel" }` to the proxy, and streams the AI SDK UI stream response back to the browser. Set [`contextInjection: "page-only"`](#choose-what-context-the-proxy-or-agent-receives) to forward messages as sent and inline only a page the reader attaches.
|
|
318
321
|
|
|
319
322
|
The proxy request also carries the reader's `x-client-ja4` and `x-client-ip` values, read from the incoming `x-vercel-ja4-digest` and `x-forwarded-for` headers, unless `proxy.headers` sets them. `proxy.headers` accepts a static object or a function that receives the incoming chat `Request`; see [Forward per-request values in upstream headers](#forward-per-request-values-in-upstream-headers).
|
|
320
323
|
|
|
321
|
-
The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
324
|
+
The Geistdocs site authenticates to the platform proxy with the server-only bearer token. The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
322
325
|
|
|
323
326
|
### Hosted eve agent mode
|
|
324
327
|
|
|
@@ -641,6 +644,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
641
644
|
});
|
|
642
645
|
```
|
|
643
646
|
|
|
647
|
+
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.
|
|
648
|
+
|
|
644
649
|
Request size limits don't control how often a client can call the route. `/api/chat` is public, and every accepted request calls a model or agent on your account, so wrap the route with your own rate limiting. For example, install `@vercel/firewall`, create a [Firewall rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the rate limit ID `ask-ai`, and check it before calling `POST`:
|
|
645
650
|
|
|
646
651
|
```ts title="app/api/chat/route.ts"
|
|
@@ -722,8 +727,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
722
727
|
|
|
723
728
|
The chat interface adapts to different screen sizes:
|
|
724
729
|
|
|
725
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
726
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
730
|
+
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
731
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
727
732
|
|
|
728
733
|
## Configuration
|
|
729
734
|
|
package/docs/pages/deployment.md
CHANGED
|
@@ -73,9 +73,11 @@ To deploy from the Vercel dashboard:
|
|
|
73
73
|
|
|
74
74
|
If your site routes Ask AI through the central Vertex-backed proxy, configure both the Geistdocs site and the Vertex deployment before testing production chat.
|
|
75
75
|
|
|
76
|
-
1.
|
|
77
|
-
2.
|
|
78
|
-
3.
|
|
79
|
-
4.
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
77
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
78
|
+
3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
|
|
79
|
+
4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
80
|
+
5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
|
|
81
|
+
6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
|
|
82
|
+
|
|
83
|
+
The Geistdocs site does not need Vertex credentials. The site authenticates to the platform proxy with the shared bearer token, and the platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
|
package/docs/pages/env.md
CHANGED
|
@@ -16,7 +16,7 @@ related:
|
|
|
16
16
|
|
|
17
17
|
Geistdocs uses environment variables to configure Ask AI, optional Mixedbread retrieval, optional Vertex-backed proxy mode, eve agent session cookie signing, and production URL behavior.
|
|
18
18
|
|
|
19
|
-
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
19
|
+
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_PROXY_TOKEN`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
20
20
|
|
|
21
21
|
## `AI_GATEWAY_API_KEY`
|
|
22
22
|
|
|
@@ -50,20 +50,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
|
|
|
50
50
|
|
|
51
51
|
## `GEISTDOCS_CHAT_PROXY_TOKEN`
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Generate a random token containing at least 32 bytes:
|
|
56
|
+
|
|
57
|
+
```bash title="Terminal"
|
|
58
|
+
openssl rand -base64 32
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Set the generated value as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site and as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment. Never expose either value with a `NEXT_PUBLIC_` prefix.
|
|
56
62
|
|
|
57
63
|
## Vertex-backed proxy setup
|
|
58
64
|
|
|
59
65
|
To route Ask AI through Vertex:
|
|
60
66
|
|
|
61
|
-
1.
|
|
62
|
-
2.
|
|
63
|
-
3. In
|
|
64
|
-
4.
|
|
67
|
+
1. Generate a random token with `openssl rand -base64 32`.
|
|
68
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
69
|
+
3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
|
|
70
|
+
4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
|
|
71
|
+
5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
|
|
65
72
|
|
|
66
|
-
The
|
|
73
|
+
The bearer token authenticates each Geistdocs site to the platform proxy. The platform proxy then authenticates to Vertex with Vercel OIDC and Trusted Sources. The `/vertex` route accepts request bodies up to 1,000,000 bytes, up to 200 messages, and only `platform: "vercel"`.
|
|
67
74
|
|
|
68
75
|
## `GEISTDOCS_CHAT_SECRET`
|
|
69
76
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/geistdocs",
|
|
3
3
|
"description": "Runtime and CLI for Geistdocs projects.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.9.1-canary.18e5450",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -295,6 +295,10 @@
|
|
|
295
295
|
"./theme.css": "./theme.css",
|
|
296
296
|
"./package.json": "./package.json"
|
|
297
297
|
},
|
|
298
|
+
"scripts": {
|
|
299
|
+
"build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
300
|
+
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
301
|
+
},
|
|
298
302
|
"dependencies": {
|
|
299
303
|
"@ai-sdk/react": "^3.0.134",
|
|
300
304
|
"@clack/prompts": "^0.11.0",
|
|
@@ -358,9 +362,5 @@
|
|
|
358
362
|
"react-dom": "^19.2.3",
|
|
359
363
|
"tsup": "^8.5.1",
|
|
360
364
|
"typescript": "^5.9.3"
|
|
361
|
-
},
|
|
362
|
-
"scripts": {
|
|
363
|
-
"build": "rm -rf dist docs template && node ./scripts/bundle-template.mjs && node ./scripts/bundle-docs.mjs && tsc -p tsconfig.runtime.json && tsup --config tsup.config.cli.ts",
|
|
364
|
-
"dev": "tsc -p tsconfig.runtime.json --watch --preserveWatchOutput"
|
|
365
365
|
}
|
|
366
|
-
}
|
|
366
|
+
}
|
package/public-foundation.css
CHANGED
package/shared-theme.css
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
@custom-variant dark (&:where(.dark, .dark *, .dark-theme, .dark-theme *));
|
|
2
|
+
|
|
3
|
+
.dark-theme .shiki:not(.not-fumadocs-codeblock *) code span {
|
|
4
|
+
color: var(--shiki-dark);
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
@source "node_modules/streamdown/dist/*.js";
|
|
2
8
|
@source "../../streamdown/dist/*.js";
|
|
3
9
|
|
package/template/.env.example
CHANGED
|
@@ -10,9 +10,8 @@ MXBAI_STORE_ID=""
|
|
|
10
10
|
# Include the /vertex route, for example: https://<geistdocs-platform-deployment>/vertex
|
|
11
11
|
GEISTDOCS_CHAT_PROXY_URL=""
|
|
12
12
|
|
|
13
|
-
# Chat proxy bearer token.
|
|
14
|
-
#
|
|
15
|
-
# The default Geistdocs platform /vertex proxy uses Vercel OIDC and Trusted Sources.
|
|
13
|
+
# Chat proxy bearer token. Required for the Geistdocs platform /vertex proxy.
|
|
14
|
+
# Use the same random value as GEISTDOCS_VERTEX_PROXY_TOKEN on the platform.
|
|
16
15
|
GEISTDOCS_CHAT_PROXY_TOKEN=""
|
|
17
16
|
|
|
18
17
|
# Signs the eve agent session cookie (ai.eveAgent mode only).
|
package/template/AGENTS.md
CHANGED
|
@@ -82,7 +82,7 @@ Use these instructions when an AI coding agent edits this project.
|
|
|
82
82
|
- If the app uses `ai` or `@ai-sdk/react` for product code outside Geistdocs, migrate that app code separately or let the package manager install separate versions. Do not downgrade Geistdocs Ask AI to match unrelated app code.
|
|
83
83
|
- Set `GEISTDOCS_CHAT_PROXY_URL` only when Ask AI should route through the central Vertex-backed proxy. The value must include the `/vertex` route, such as `https://<geistdocs-platform-deployment>/vertex`.
|
|
84
84
|
- Do not add Vertex credentials to a Geistdocs site. The central platform proxy forwards the Vercel OIDC token in `x-vercel-trusted-oidc-idp-token`; the Vertex deployment should trust the platform Vercel project through Deployment Protection Trusted Sources.
|
|
85
|
-
-
|
|
85
|
+
- Set the server-only `GEISTDOCS_CHAT_PROXY_TOKEN` when using the Geistdocs platform `/vertex` proxy. Its value must match the platform deployment's `GEISTDOCS_VERTEX_PROXY_TOKEN`, which must contain at least 32 bytes. Never expose either token with a `NEXT_PUBLIC_` prefix.
|
|
86
86
|
- Keep `app/api/chat/route.ts` as a thin adapter around `createChatRoute`. Prefer configuring `GEISTDOCS_CHAT_PROXY_URL` and `GEISTDOCS_CHAT_PROXY_TOKEN` over forking the package chat route.
|
|
87
87
|
- If custom chat client code uses `DefaultChatTransport.prepareSendMessagesRequest`, preserve `messages` in the returned `body` when adding fields such as `currentRoute`. Returning a custom `body` replaces the AI SDK default request body.
|
|
88
88
|
|
|
@@ -164,12 +164,11 @@ Publishing the document makes `/api/chat` discoverable for programmatic use. Tha
|
|
|
164
164
|
|
|
165
165
|
## Select the article in rendered HTML
|
|
166
166
|
|
|
167
|
-
Docs pages mark the article
|
|
167
|
+
Docs pages mark the visible article parts in their HTML, so a tool that reads the rendered page (a crawler, or a check that compares the page with its Markdown route) can select the content without depending on Fumadocs element IDs or class names. The frontmatter description remains available through metadata and AI-readable routes, but is not repeated below the page title.
|
|
168
168
|
|
|
169
169
|
| Attribute | Element |
|
|
170
170
|
| --- | --- |
|
|
171
171
|
| `data-geistdocs-article="title"` | The page's `h1` |
|
|
172
|
-
| `data-geistdocs-article="description"` | The description paragraph, when the page has a description |
|
|
173
172
|
| `data-geistdocs-article="body"` | The rendered MDX body |
|
|
174
173
|
|
|
175
174
|
Page actions, breadcrumbs, the table of contents, and the previous/next links sit outside these elements, so their text never mixes with the article's.
|
|
@@ -24,7 +24,7 @@ The AI chat assistant is available in two ways:
|
|
|
24
24
|
|
|
25
25
|
### 1. Per-Page Quick Access
|
|
26
26
|
|
|
27
|
-
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the
|
|
27
|
+
Each documentation page has an "Ask AI about this page" action in the page actions menu beside the title, and in the action row below the title on mobile. When a reader selects it, Ask AI:
|
|
28
28
|
|
|
29
29
|
1. Clears the current conversation, including the history stored in the browser, and opens the chat
|
|
30
30
|
2. Shows a card above the prompt input that names the page. Readers can remove the card to ask without the page
|
|
@@ -50,6 +50,7 @@ Once open, users can:
|
|
|
50
50
|
- Ask questions about any part of your documentation
|
|
51
51
|
- View the documentation pages used as sources for each answer
|
|
52
52
|
- Copy an answer as Markdown
|
|
53
|
+
- Expand the desktop panel to fill the viewport
|
|
53
54
|
- Get step-by-step guidance on complex topics
|
|
54
55
|
|
|
55
56
|
## Control Ask AI from your own components
|
|
@@ -303,20 +304,22 @@ The `model` option only applies in AI Gateway mode. In proxy mode, the Vertex-ba
|
|
|
303
304
|
Use proxy mode when Ask AI should route model requests through a central Vertex-backed service instead of calling AI Gateway from each site.
|
|
304
305
|
|
|
305
306
|
1. Deploy or use the central Geistdocs platform proxy that exposes `POST /vertex`.
|
|
306
|
-
2.
|
|
307
|
-
3. Set `
|
|
307
|
+
2. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
308
|
+
3. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
309
|
+
4. Configure the Vertex deployment to trust the Geistdocs platform Vercel project with Deployment Protection Trusted Sources.
|
|
310
|
+
5. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`:
|
|
308
311
|
|
|
309
312
|
```txt
|
|
310
313
|
https://<geistdocs-platform-deployment>/vertex
|
|
311
314
|
```
|
|
312
315
|
|
|
313
|
-
|
|
316
|
+
6. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
314
317
|
|
|
315
318
|
When `GEISTDOCS_CHAT_PROXY_URL` is set, Geistdocs searches local docs on the first user message, injects the attached page (or the current page when no page is attached) and related docs into the final user message, forwards `{ messages, platform: "vercel" }` to the proxy, and streams the AI SDK UI stream response back to the browser. Set [`contextInjection: "page-only"`](#choose-what-context-the-proxy-or-agent-receives) to forward messages as sent and inline only a page the reader attaches.
|
|
316
319
|
|
|
317
320
|
The proxy request also carries the reader's `x-client-ja4` and `x-client-ip` values, read from the incoming `x-vercel-ja4-digest` and `x-forwarded-for` headers, unless `proxy.headers` sets them. `proxy.headers` accepts a static object or a function that receives the incoming chat `Request`; see [Forward per-request values in upstream headers](#forward-per-request-values-in-upstream-headers).
|
|
318
321
|
|
|
319
|
-
The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
322
|
+
The Geistdocs site authenticates to the platform proxy with the server-only bearer token. The platform proxy forwards a Vercel OIDC token to Vertex in the `x-vercel-trusted-oidc-idp-token` header. The Vertex deployment should validate the caller through Trusted Sources; the Geistdocs site does not need a Vertex API key.
|
|
320
323
|
|
|
321
324
|
### Hosted eve agent mode
|
|
322
325
|
|
|
@@ -639,6 +642,8 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
639
642
|
});
|
|
640
643
|
```
|
|
641
644
|
|
|
645
|
+
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.
|
|
646
|
+
|
|
642
647
|
Request size limits don't control how often a client can call the route. `/api/chat` is public, and every accepted request calls a model or agent on your account, so wrap the route with your own rate limiting. For example, install `@vercel/firewall`, create a [Firewall rate limit rule](https://vercel.com/docs/vercel-firewall/vercel-waf/rate-limiting-sdk) with the rate limit ID `ask-ai`, and check it before calling `POST`:
|
|
643
648
|
|
|
644
649
|
```ts title="app/api/chat/route.ts"
|
|
@@ -720,8 +725,8 @@ Ask AI accepts text questions only. It does not support file or image attachment
|
|
|
720
725
|
|
|
721
726
|
The chat interface adapts to different screen sizes:
|
|
722
727
|
|
|
723
|
-
- **Desktop**: Slides in from the right side as a sidebar panel
|
|
724
|
-
- **Mobile**: Opens as a bottom drawer.
|
|
728
|
+
- **Desktop**: Slides in from the right side as a sidebar panel. Select **Expand chat** in the panel header to fill the viewport, which gives long answers and code blocks more width without losing the conversation. Select **Collapse chat** or press `Escape` to return to the sidebar. Closing the chat also returns it to the sidebar, so the next open starts there.
|
|
729
|
+
- **Mobile**: Opens as a bottom drawer. The drawer has no expanded view.
|
|
725
730
|
|
|
726
731
|
## Configuration
|
|
727
732
|
|
|
@@ -72,9 +72,11 @@ To deploy from the Vercel dashboard:
|
|
|
72
72
|
|
|
73
73
|
If your site routes Ask AI through the central Vertex-backed proxy, configure both the Geistdocs site and the Vertex deployment before testing production chat.
|
|
74
74
|
|
|
75
|
-
1.
|
|
76
|
-
2.
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
1. Generate a random token containing at least 32 bytes with `openssl rand -base64 32`.
|
|
76
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
77
|
+
3. Set `GEISTDOCS_CHAT_PROXY_URL` on the Geistdocs site to the platform proxy URL, including `/vertex`.
|
|
78
|
+
4. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on the Geistdocs site.
|
|
79
|
+
5. Add the Geistdocs platform Vercel project as a Trusted Source in the Vertex deployment's Deployment Protection settings.
|
|
80
|
+
6. Confirm the platform proxy can forward the Vercel OIDC token to Vertex in `x-vercel-trusted-oidc-idp-token`.
|
|
81
|
+
|
|
82
|
+
The Geistdocs site does not need Vertex credentials. The site authenticates to the platform proxy with the shared bearer token, and the platform proxy authenticates to Vertex with Vercel OIDC and Trusted Sources.
|
|
@@ -12,8 +12,8 @@ related:
|
|
|
12
12
|
|
|
13
13
|
Geistdocs uses environment variables to configure Ask AI, optional Mixedbread retrieval, optional Vertex-backed proxy mode, eve agent session cookie signing, and production URL behavior.
|
|
14
14
|
|
|
15
|
-
<CopyPrompt text="Review this Geistdocs project and help me configure the required environment variables. Check whether AI_GATEWAY_API_KEY, MXBAI_API_KEY, MXBAI_STORE_ID, GEISTDOCS_CHAT_PROXY_URL, GEISTDOCS_CHAT_SECRET, and NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL are needed for the features I enabled, then tell me where to set them locally and on Vercel.">
|
|
16
|
-
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
15
|
+
<CopyPrompt text="Review this Geistdocs project and help me configure the required environment variables. Check whether AI_GATEWAY_API_KEY, MXBAI_API_KEY, MXBAI_STORE_ID, GEISTDOCS_CHAT_PROXY_URL, GEISTDOCS_CHAT_PROXY_TOKEN, GEISTDOCS_CHAT_SECRET, and NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL are needed for the features I enabled, then tell me where to set them locally and on Vercel.">
|
|
16
|
+
Review this Geistdocs project and help me configure the required environment variables. Check whether `AI_GATEWAY_API_KEY`, `MXBAI_API_KEY`, `MXBAI_STORE_ID`, `GEISTDOCS_CHAT_PROXY_URL`, `GEISTDOCS_CHAT_PROXY_TOKEN`, `GEISTDOCS_CHAT_SECRET`, and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` are needed for the features I enabled, then tell me where to set them locally and on Vercel.
|
|
17
17
|
</CopyPrompt>
|
|
18
18
|
|
|
19
19
|
## `AI_GATEWAY_API_KEY`
|
|
@@ -48,20 +48,27 @@ When this variable is set, the site does not need `AI_GATEWAY_API_KEY` for Ask A
|
|
|
48
48
|
|
|
49
49
|
## `GEISTDOCS_CHAT_PROXY_TOKEN`
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The server-only bearer token that authenticates a Geistdocs site to its chat proxy. The central Geistdocs platform proxy requires this value.
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Generate a random token containing at least 32 bytes:
|
|
54
|
+
|
|
55
|
+
```bash title="Terminal"
|
|
56
|
+
openssl rand -base64 32
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Set the generated value as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site and as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment. Never expose either value with a `NEXT_PUBLIC_` prefix.
|
|
54
60
|
|
|
55
61
|
## Vertex-backed proxy setup
|
|
56
62
|
|
|
57
63
|
To route Ask AI through Vertex:
|
|
58
64
|
|
|
59
|
-
1.
|
|
60
|
-
2.
|
|
61
|
-
3. In
|
|
62
|
-
4.
|
|
65
|
+
1. Generate a random token with `openssl rand -base64 32`.
|
|
66
|
+
2. Set the token as `GEISTDOCS_VERTEX_PROXY_TOKEN` on the platform proxy deployment.
|
|
67
|
+
3. In the Vertex deployment's Deployment Protection settings, add the Geistdocs platform Vercel project as a Trusted Source.
|
|
68
|
+
4. In each approved Geistdocs site, set `GEISTDOCS_CHAT_PROXY_URL` to the platform proxy URL, including `/vertex`.
|
|
69
|
+
5. Set the same token as `GEISTDOCS_CHAT_PROXY_TOKEN` on each approved Geistdocs site.
|
|
63
70
|
|
|
64
|
-
The
|
|
71
|
+
The bearer token authenticates each Geistdocs site to the platform proxy. The platform proxy then authenticates to Vertex with Vercel OIDC and Trusted Sources. The `/vertex` route accepts request bodies up to 1,000,000 bytes, up to 200 messages, and only `platform: "vercel"`.
|
|
65
72
|
|
|
66
73
|
## `GEISTDOCS_CHAT_SECRET`
|
|
67
74
|
|
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.9.1-canary.18e5450",
|
|
21
21
|
"@vercel/speed-insights": "^1.3.1",
|
|
22
22
|
"ai": "^6.0.132",
|
|
23
23
|
"clsx": "^2.1.1",
|