@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
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
4
|
+
import { useEffect, useState, useTransition, } from "react";
|
|
5
|
+
import { IconAcronymMarkdown, IconArrowCircleUp, IconThumbUp, } from "#geistdocs-assets/icons";
|
|
6
|
+
import { Button } from "#geistdocs-ui/components/button";
|
|
7
|
+
import { Textarea } from "#geistdocs-ui/components/textarea";
|
|
8
|
+
import { sendFeedback } from "./feedback-action";
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
10
|
+
import { useIsMobile } from "./use-mobile";
|
|
11
|
+
const actionClassName = "group flex min-h-8 w-full min-w-0 touch-manipulation items-center gap-2 rounded-md text-left text-gray-900 text-label-14 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none [&_svg]:size-4 [&_svg]:shrink-0 [&_span]:min-w-0 [&_span]:truncate";
|
|
12
|
+
const feedbackEmotions = [
|
|
13
|
+
{ name: "cry", emoji: "π" },
|
|
14
|
+
{ name: "sad", emoji: "π" },
|
|
15
|
+
{ name: "happy", emoji: "π" },
|
|
16
|
+
{ name: "amazed", emoji: "π€©" },
|
|
17
|
+
];
|
|
18
|
+
const ScrollTopAction = () => (_jsxs("button", { className: actionClassName, onClick: () => {
|
|
19
|
+
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
20
|
+
window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
|
|
21
|
+
}, type: "button", children: [_jsx(IconArrowCircleUp, { className: "size-3.5" }), _jsx("span", { children: "Scroll to top" })] }));
|
|
22
|
+
const FeedbackAction = ({ siteId }) => {
|
|
23
|
+
const isMobile = useIsMobile();
|
|
24
|
+
const url = usePathname();
|
|
25
|
+
const [submitted, setSubmitted] = useState(false);
|
|
26
|
+
const [emotion, setEmotion] = useState(null);
|
|
27
|
+
const [message, setMessage] = useState("");
|
|
28
|
+
const [failed, setFailed] = useState(false);
|
|
29
|
+
const [isPending, startTransition] = useTransition();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const item = localStorage.getItem(`docs-feedback-${url}`);
|
|
32
|
+
if (!item) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setSubmitted(true);
|
|
36
|
+
}, [url]);
|
|
37
|
+
const submit = (event) => {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
if (!emotion) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
startTransition(async () => {
|
|
43
|
+
const feedback = {
|
|
44
|
+
emotion,
|
|
45
|
+
message,
|
|
46
|
+
};
|
|
47
|
+
const result = await sendFeedback({ url, feedback, siteId });
|
|
48
|
+
// Keep the form (and the visitor's text) so a failed submission can
|
|
49
|
+
// be retried.
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
setFailed(true);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setFailed(false);
|
|
55
|
+
setSubmitted(true);
|
|
56
|
+
localStorage.setItem(`docs-feedback-${url}`, "1");
|
|
57
|
+
setMessage("");
|
|
58
|
+
setEmotion(null);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { className: actionClassName, type: "button", children: [_jsx(IconThumbUp, { className: "size-3.5" }), _jsx("span", { children: "Give feedback" })] }) }), _jsx(PopoverContent, { className: "overflow-hidden p-0", children: _jsx("div", { className: "overflow-visible", children: submitted ? (_jsx("div", { className: "flex flex-col items-center gap-3 rounded-xl bg-background-200 px-3 py-6 text-center text-copy-14", role: "status", children: _jsx("p", { children: "Thank you for your feedback!" }) })) : (_jsxs("form", { className: "flex flex-col", onSubmit: submit, children: [_jsx("div", { className: "p-2", children: _jsx(Textarea, { "aria-label": "Feedback", autoComplete: "off", autoFocus: !isMobile, className: "max-h-48 min-h-24 shadow-none", name: "feedback", onChange: (event) => setMessage(event.target.value), onKeyDown: (event) => {
|
|
62
|
+
if (!event.shiftKey && event.key === "Enter") {
|
|
63
|
+
event.currentTarget.form?.requestSubmit();
|
|
64
|
+
}
|
|
65
|
+
}, placeholder: "Leave your feedback\u2026", required: true, value: message }) }), _jsxs("div", { className: "flex items-center justify-end gap-1 px-2 text-gray-900", children: [_jsx(IconAcronymMarkdown, { "aria-hidden": "true", className: "inline size-3" }), _jsx("p", { className: "text-label-12", children: " supported" })] }), failed ? (_jsx("p", { className: "px-2 pb-1 text-label-12 text-red-900", role: "alert", children: "Sending feedback failed. Please try again." })) : null, _jsxs("div", { className: "mt-2 flex items-center justify-between border-t bg-background-200 p-2", children: [_jsx("div", { className: "flex items-center gap-px", children: feedbackEmotions.map((entry) => (_jsxs(Button, { className: emotion === entry.name
|
|
66
|
+
? "bg-gray-100 text-gray-1000"
|
|
67
|
+
: "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
|
|
68
|
+
};
|
|
69
|
+
export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
|
|
70
|
+
const actions = [];
|
|
71
|
+
if (config.pageActions?.scrollTop !== false) {
|
|
72
|
+
actions.push(_jsx(ScrollTopAction, {}, "scroll-top"));
|
|
73
|
+
}
|
|
74
|
+
if (config.feedback?.enabled !== false) {
|
|
75
|
+
actions.push(_jsx(FeedbackAction, { siteId: config.siteId }, "feedback"));
|
|
76
|
+
}
|
|
77
|
+
return (_jsxs(_Fragment, { children: [actions, extraActions] }));
|
|
78
|
+
};
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAiC/C,OAAO,KAAK,EAAE,4BAA4B,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAK3F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBAsED,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Image as FrameworkImage } from "fumadocs-core/framework";
|
|
3
|
+
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
3
4
|
import Link from "next/link";
|
|
4
5
|
import { cn } from "#geistdocs-ui/utils";
|
|
5
6
|
import { Blockquote } from "./components/blockquote";
|
|
@@ -21,7 +22,9 @@ import { geistShikiTheme as shikiTheme } from "./shiki-theme";
|
|
|
21
22
|
// language grammar, into every server function that renders MDX.
|
|
22
23
|
export const geistShikiTheme = shikiTheme;
|
|
23
24
|
export const getGeistdocsMDXComponents = (components) => ({
|
|
24
|
-
|
|
25
|
+
Card,
|
|
26
|
+
Cards,
|
|
27
|
+
img: (props) => (_jsx(FrameworkImage, { sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px", ...props, className: cn("rounded-lg", props.className), src: props.src })),
|
|
25
28
|
h1: (props) => _jsx(Heading, { as: "h1", ...props }),
|
|
26
29
|
h2: (props) => _jsx(Heading, { as: "h2", ...props }),
|
|
27
30
|
h3: (props) => _jsx(Heading, { as: "h3", ...props }),
|
package/dist/navbar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AskAIButton, SearchButton } from "./controls";
|
|
2
|
+
import { AskAIButton, SearchButton } from "./internal/controls-client";
|
|
3
3
|
import { GitHubButton, getGithubRepoUrl } from "./internal/github-button";
|
|
4
4
|
import { DesktopMenu } from "./internal/navbar/desktop-menu";
|
|
5
5
|
import { MobileMenu } from "./internal/navbar/mobile-menu";
|
package/dist/pages/changelog.js
CHANGED
|
@@ -3,7 +3,7 @@ import { notFound, redirect } from "next/navigation";
|
|
|
3
3
|
import { getChangelogPage, getChangelogPageParams, getChangelogPagePath, getChangelogPath, parseChangelogPage, } from "../internal/changelog";
|
|
4
4
|
import { ChangelogFeed } from "../internal/changelog-feed";
|
|
5
5
|
import { getGeistdocsLanguageConfig, getLanguageStaticParams, omitLanguageParam, resolveRouteLanguage, } from "../internal/languages";
|
|
6
|
-
import { GeistdocsPageActions } from "../internal/page-actions-
|
|
6
|
+
import { GeistdocsPageActions } from "../internal/page-actions-gate";
|
|
7
7
|
const TRAILING_SLASH_PATTERN = /\/$/;
|
|
8
8
|
export const createChangelogPage = (options) => {
|
|
9
9
|
const { config, source, path = "/changelog", title = "Changelog", description = "The latest releases, improvements, and fixes.", getLang, markdownPath, dataPath, pageSize = 10, } = options;
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC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C,MAAM,CAAC;uBAgPJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BAvKlB,MAAM;;;;oCAwLtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
|
package/dist/pages/docs.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "fumadocs-core/link";
|
|
3
3
|
import { DocsBody as FumadocsDocsBody, DocsPage as FumadocsDocsPage, DocsTitle as FumadocsDocsTitle, } from "fumadocs-ui/layouts/docs/page";
|
|
4
|
-
import { createRelativeLink } from "fumadocs-ui/mdx";
|
|
5
4
|
import { notFound } from "next/navigation";
|
|
6
5
|
import { cache, } from "react";
|
|
7
6
|
import { cn } from "#geistdocs-ui/utils";
|
|
@@ -14,11 +13,13 @@ import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
|
|
|
14
13
|
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
15
14
|
import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
|
|
16
15
|
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
17
|
-
import { GeistdocsPageActions
|
|
16
|
+
import { GeistdocsPageActions } from "../internal/page-actions-gate";
|
|
18
17
|
import { PageBreadcrumb } from "../internal/page-breadcrumb";
|
|
19
18
|
import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
20
19
|
import { filterPageTree } from "../internal/page-tree-visibility";
|
|
20
|
+
import { createRelativeDocsLink } from "../internal/relative-docs-link";
|
|
21
21
|
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
22
|
+
import { GeistdocsTableOfContentsActions } from "../internal/toc-actions-client";
|
|
22
23
|
import { createMdxComponents } from "../mdx";
|
|
23
24
|
import { getPageRobots, } from "../page-visibility";
|
|
24
25
|
const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
|
|
@@ -106,7 +107,7 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
|
|
|
106
107
|
const pageTree = await getPageTree(resolvedParams);
|
|
107
108
|
const data = page.data;
|
|
108
109
|
const MDX = data.body;
|
|
109
|
-
const defaultLink =
|
|
110
|
+
const defaultLink = createRelativeDocsLink(source.source, page, DocsLink);
|
|
110
111
|
const link = resolveLink
|
|
111
112
|
? resolveLink({
|
|
112
113
|
link: defaultLink,
|
package/dist/routes/chat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LanguageModel } from "ai";
|
|
2
2
|
import { type GeistdocsConfig } from "../config";
|
|
3
|
+
import { type ChatRateLimitOptions } from "../internal/chat-rate-limit";
|
|
3
4
|
import { type ChatMixedbreadOptions } from "../internal/chat-retrieval";
|
|
4
5
|
import { type EveAgentClientContext } from "../internal/eve-agent";
|
|
5
6
|
import { type GeistdocsPageFilter } from "../page-visibility";
|
|
@@ -125,8 +126,8 @@ interface CreateChatRouteOptions {
|
|
|
125
126
|
/** Narrows the stable public corpus available to Ask AI. */
|
|
126
127
|
filterPage?: GeistdocsPageFilter;
|
|
127
128
|
/**
|
|
128
|
-
* Request size caps applied before any model, proxy, or agent call.
|
|
129
|
-
*
|
|
129
|
+
* Request size caps applied before any model, proxy, or agent call.
|
|
130
|
+
* Use `rateLimit` to also limit request frequency with Vercel Firewall.
|
|
130
131
|
*/
|
|
131
132
|
limits?: ChatRequestLimits;
|
|
132
133
|
/**
|
|
@@ -139,14 +140,22 @@ interface CreateChatRouteOptions {
|
|
|
139
140
|
* Accepts any AI SDK `LanguageModel`, including AI Gateway model strings
|
|
140
141
|
* such as `"xai/grok-4.5"`. Ignored in proxy and eve agent modes, where
|
|
141
142
|
* the external service selects the model. Defaults to
|
|
142
|
-
* `"openai/gpt-
|
|
143
|
+
* `"openai/gpt-6-luna"`.
|
|
143
144
|
*/
|
|
144
145
|
model?: LanguageModel;
|
|
145
146
|
proxy?: ChatProxyConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Opt-in Vercel Firewall SDK checks, using the platform-provided client IP.
|
|
149
|
+
* Publish each ID in the site's Vercel project before enabling. Checks run
|
|
150
|
+
* before every POST, including eve prewarming, with a one-second timeout.
|
|
151
|
+
* Limited requests receive 429; missing rules and failed checks receive 503.
|
|
152
|
+
* Omit to disable. The SDK skips checks outside production mode.
|
|
153
|
+
*/
|
|
154
|
+
rateLimit?: ChatRateLimitOptions;
|
|
146
155
|
source?: SourceBundle;
|
|
147
156
|
sources?: SourceBundle[];
|
|
148
157
|
}
|
|
149
|
-
export declare const createChatRoute: ({ config, contextInjection, eveAgent, filterPage, limits, mixedbread, model, proxy, source, sources, }: CreateChatRouteOptions) => {
|
|
158
|
+
export declare const createChatRoute: ({ config, contextInjection, eveAgent, filterPage, limits, mixedbread, model, proxy, rateLimit, source, sources, }: CreateChatRouteOptions) => {
|
|
150
159
|
POST: (req: Request) => Promise<Response>;
|
|
151
160
|
maxDuration: 800;
|
|
152
161
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAQnB,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,WAAW,CAAC;AAMhE,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,KAAK,qBAAqB,EAU3B,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG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xC;;;OAGG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AA2uDD,eAAO,MAAM,eAAe,GAAI,mHAY7B,sBAAsB;gBAsNL,OAAO;;CAI1B,CAAC"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -5,11 +5,12 @@ import { z } from "zod";
|
|
|
5
5
|
import { getPublicPath } from "../config";
|
|
6
6
|
import { MAX_USER_MESSAGE_CHARS } from "../internal/chat/message-text";
|
|
7
7
|
import { createSourceChunk, createSourceChunks, } from "../internal/chat/source-chunks";
|
|
8
|
+
import { createChatRateLimiter, } from "../internal/chat-rate-limit";
|
|
8
9
|
import { createChatDocumentSearch, } from "../internal/chat-retrieval";
|
|
9
10
|
import { buildEveAgentTranscript, capLastUserMessageText, createEmptyEveAgentSession, getEveAgentMessageMetadata, hasPriorEveAgentTurn, normalizeAgentUrl, prewarmExistingEveAgentSession, resolveEveAgentUrl, startOrContinueEveAgentSession, streamEveAgentTurn, } from "../internal/eve-agent";
|
|
10
11
|
import { CHAT_SECRET_ENV, createEveAgentSessionCookieCodec, EVE_AGENT_SESSION_COOKIE, isSameSessionTag, readCookieValues, serializeEveAgentSessionCookie, } from "../internal/eve-agent-session-cookie";
|
|
11
12
|
import { isPageVisibleForSurface, } from "../page-visibility";
|
|
12
|
-
const DEFAULT_CHAT_MODEL = "openai/gpt-
|
|
13
|
+
const DEFAULT_CHAT_MODEL = "openai/gpt-6-luna";
|
|
13
14
|
const DEFAULT_MAX_REQUEST_BYTES = 1_000_000;
|
|
14
15
|
const DEFAULT_MAX_MESSAGES = 200;
|
|
15
16
|
const DEFAULT_MAX_MESSAGE_PARTS = 2000;
|
|
@@ -1110,8 +1111,9 @@ const validateRouteOptions = ({ contextInjection, eveAgent, }) => {
|
|
|
1110
1111
|
throw new Error("createChatRoute eveAgent.visibleTools must be an array of tool names.");
|
|
1111
1112
|
}
|
|
1112
1113
|
};
|
|
1113
|
-
export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, filterPage, limits, mixedbread, model = DEFAULT_CHAT_MODEL, proxy, source, sources, }) => {
|
|
1114
|
+
export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, filterPage, limits, mixedbread, model = DEFAULT_CHAT_MODEL, proxy, rateLimit, source, sources, }) => {
|
|
1114
1115
|
validateRouteOptions({ contextInjection, eveAgent });
|
|
1116
|
+
const rateLimiter = createChatRateLimiter(rateLimit);
|
|
1115
1117
|
const { defaultLanguage, languages } = getLanguages(config);
|
|
1116
1118
|
const routeSources = resolveSources(source, sources);
|
|
1117
1119
|
const searchDocuments = createDocumentSearch({
|
|
@@ -1284,7 +1286,9 @@ export const createChatRoute = ({ config, contextInjection = "auto", eveAgent, f
|
|
|
1284
1286
|
}
|
|
1285
1287
|
};
|
|
1286
1288
|
return {
|
|
1287
|
-
POST
|
|
1289
|
+
POST: rateLimiter
|
|
1290
|
+
? async (req) => (await rateLimiter(req)) ?? POST(req)
|
|
1291
|
+
: POST,
|
|
1288
1292
|
maxDuration: 800,
|
|
1289
1293
|
};
|
|
1290
1294
|
};
|
package/dist/source-config.js
CHANGED
|
@@ -188,7 +188,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
|
188
188
|
rehypePlugins: resolveGeistdocsRehypePlugins(config.mdxOptions?.rehypePlugins),
|
|
189
189
|
rehypeCodeOptions: {
|
|
190
190
|
...config.mdxOptions?.rehypeCodeOptions,
|
|
191
|
-
themes: { light: geistShikiTheme
|
|
191
|
+
themes: { light: geistShikiTheme },
|
|
192
192
|
defaultColor: "light",
|
|
193
193
|
},
|
|
194
194
|
},
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.15.0 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.15.0.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -2509,6 +2509,9 @@ The provider handles these behaviors:
|
|
|
2509
2509
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
2510
2510
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
2511
2511
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
2512
|
+
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.
|
|
2513
|
+
|
|
2514
|
+
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.
|
|
2512
2515
|
|
|
2513
2516
|
## Usage
|
|
2514
2517
|
|
|
@@ -3935,7 +3938,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
|
|
|
3935
3938
|
|
|
3936
3939
|
The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
|
|
3937
3940
|
|
|
3938
|
-
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account
|
|
3941
|
+
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
|
|
3939
3942
|
|
|
3940
3943
|
## Select the article in rendered HTML
|
|
3941
3944
|
|
|
@@ -4260,7 +4263,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
|
|
|
4260
4263
|
|
|
4261
4264
|
#### Choose a model
|
|
4262
4265
|
|
|
4263
|
-
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-
|
|
4266
|
+
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.
|
|
4264
4267
|
|
|
4265
4268
|
```ts title="app/api/chat/route.ts"
|
|
4266
4269
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
@@ -4643,28 +4646,33 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
4643
4646
|
|
|
4644
4647
|
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.
|
|
4645
4648
|
|
|
4646
|
-
|
|
4649
|
+
## Rate limiting
|
|
4650
|
+
|
|
4651
|
+
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.
|
|
4652
|
+
|
|
4653
|
+
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.
|
|
4654
|
+
|
|
4655
|
+
Then enable the rule in the chat route:
|
|
4647
4656
|
|
|
4648
4657
|
```ts title="app/api/chat/route.ts"
|
|
4649
|
-
import { checkRateLimit } from "@vercel/firewall";
|
|
4650
4658
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
4651
4659
|
import { config } from "@/lib/geistdocs/config";
|
|
4652
4660
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
4653
4661
|
|
|
4654
|
-
const
|
|
4662
|
+
export const { POST, maxDuration } = createChatRoute({
|
|
4663
|
+
config,
|
|
4664
|
+
sources: [geistdocsSource],
|
|
4665
|
+
rateLimit: { ids: ["ask-ai"] },
|
|
4666
|
+
});
|
|
4667
|
+
```
|
|
4655
4668
|
|
|
4656
|
-
|
|
4669
|
+
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.
|
|
4657
4670
|
|
|
4658
|
-
|
|
4659
|
-
const { rateLimited } = await checkRateLimit("ask-ai", { request });
|
|
4671
|
+
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.
|
|
4660
4672
|
|
|
4661
|
-
|
|
4662
|
-
return Response.json({ error: "Too many requests." }, { status: 429 });
|
|
4663
|
-
}
|
|
4673
|
+
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.
|
|
4664
4674
|
|
|
4665
|
-
|
|
4666
|
-
};
|
|
4667
|
-
```
|
|
4675
|
+
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.
|
|
4668
4676
|
|
|
4669
4677
|
## Features
|
|
4670
4678
|
|
|
@@ -4731,7 +4739,7 @@ The chat interface adapts to different screen sizes:
|
|
|
4731
4739
|
|
|
4732
4740
|
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.
|
|
4733
4741
|
|
|
4734
|
-
In default AI Gateway mode, Geistdocs uses `openai/gpt-
|
|
4742
|
+
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.
|
|
4735
4743
|
|
|
4736
4744
|
## Suggested Prompts
|
|
4737
4745
|
|
package/docs/manifest.json
CHANGED
|
@@ -162,7 +162,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
|
|
|
162
162
|
|
|
163
163
|
The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
|
|
164
164
|
|
|
165
|
-
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account
|
|
165
|
+
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
|
|
166
166
|
|
|
167
167
|
## Select the article in rendered HTML
|
|
168
168
|
|
package/docs/pages/ask-ai.md
CHANGED
|
@@ -301,7 +301,7 @@ In this mode, Geistdocs uses the local `search_docs` tool during the AI SDK `str
|
|
|
301
301
|
|
|
302
302
|
#### Choose a model
|
|
303
303
|
|
|
304
|
-
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-
|
|
304
|
+
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.
|
|
305
305
|
|
|
306
306
|
```ts title="app/api/chat/route.ts"
|
|
307
307
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
@@ -684,28 +684,33 @@ export const { POST, maxDuration } = createChatRoute({
|
|
|
684
684
|
|
|
685
685
|
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.
|
|
686
686
|
|
|
687
|
-
|
|
687
|
+
## Rate limiting
|
|
688
|
+
|
|
689
|
+
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.
|
|
690
|
+
|
|
691
|
+
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.
|
|
692
|
+
|
|
693
|
+
Then enable the rule in the chat route:
|
|
688
694
|
|
|
689
695
|
```ts title="app/api/chat/route.ts"
|
|
690
|
-
import { checkRateLimit } from "@vercel/firewall";
|
|
691
696
|
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
692
697
|
import { config } from "@/lib/geistdocs/config";
|
|
693
698
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
694
699
|
|
|
695
|
-
const
|
|
700
|
+
export const { POST, maxDuration } = createChatRoute({
|
|
701
|
+
config,
|
|
702
|
+
sources: [geistdocsSource],
|
|
703
|
+
rateLimit: { ids: ["ask-ai"] },
|
|
704
|
+
});
|
|
705
|
+
```
|
|
696
706
|
|
|
697
|
-
|
|
707
|
+
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.
|
|
698
708
|
|
|
699
|
-
|
|
700
|
-
const { rateLimited } = await checkRateLimit("ask-ai", { request });
|
|
709
|
+
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.
|
|
701
710
|
|
|
702
|
-
|
|
703
|
-
return Response.json({ error: "Too many requests." }, { status: 429 });
|
|
704
|
-
}
|
|
711
|
+
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.
|
|
705
712
|
|
|
706
|
-
|
|
707
|
-
};
|
|
708
|
-
```
|
|
713
|
+
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.
|
|
709
714
|
|
|
710
715
|
## Features
|
|
711
716
|
|
|
@@ -772,7 +777,7 @@ The chat interface adapts to different screen sizes:
|
|
|
772
777
|
|
|
773
778
|
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.
|
|
774
779
|
|
|
775
|
-
In default AI Gateway mode, Geistdocs uses `openai/gpt-
|
|
780
|
+
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.
|
|
776
781
|
|
|
777
782
|
## Suggested Prompts
|
|
778
783
|
|
package/docs/pages/provider.md
CHANGED
|
@@ -25,6 +25,9 @@ The provider handles these behaviors:
|
|
|
25
25
|
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
26
26
|
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
27
27
|
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
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.
|
|
28
31
|
|
|
29
32
|
## Usage
|
|
30
33
|
|
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.15.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -311,6 +311,7 @@
|
|
|
311
311
|
"@types/mdx": "^2.0.13",
|
|
312
312
|
"@types/react": "^19.2.7",
|
|
313
313
|
"@vercel/agent-readability": "^0.7.0",
|
|
314
|
+
"@vercel/firewall": "^1.2.6",
|
|
314
315
|
"@vercel/oidc": "^3.4.1",
|
|
315
316
|
"ai": "^6.0.132",
|
|
316
317
|
"class-variance-authority": "^0.7.1",
|
|
@@ -324,7 +325,6 @@
|
|
|
324
325
|
"glob": "^11.0.0",
|
|
325
326
|
"mcp-handler": "2.2.0",
|
|
326
327
|
"mermaid": "^11.12.2",
|
|
327
|
-
"motion": "^12.23.25",
|
|
328
328
|
"next-themes": "^0.4.6",
|
|
329
329
|
"phase": "^0.5.4",
|
|
330
330
|
"radix-ui": "1.6.4",
|
package/source-config.js
CHANGED
|
@@ -300,7 +300,7 @@ export const defineGeistdocsSourceConfig = (config = {}) => {
|
|
|
300
300
|
),
|
|
301
301
|
rehypeCodeOptions: {
|
|
302
302
|
...config.mdxOptions?.rehypeCodeOptions,
|
|
303
|
-
themes: { light: geistShikiTheme
|
|
303
|
+
themes: { light: geistShikiTheme },
|
|
304
304
|
defaultColor: "light",
|
|
305
305
|
},
|
|
306
306
|
},
|
package/template/AGENTS.md
CHANGED
|
@@ -77,7 +77,7 @@ Use these instructions when an AI coding agent edits this project.
|
|
|
77
77
|
- Mixedbread failures fall back to local Orama retrieval. Keep the local source definitions and `excludeFrom: [chat]` visibility behavior intact.
|
|
78
78
|
- Set `ai.eveAgent: { url }` in `geistdocs.tsx` to answer Ask AI with a hosted eve framework agent instead. The URL flows through the config object; the route file needs no changes. Set `prewarm: true` for eve 0.59+ responders when the site should prepare an empty durable session as the chat client loads. Requests authenticate with a per-request Vercel OIDC bearer token by default; pass server-only headers through the `eveAgent` option on `createChatRoute` for custom auth. Never put auth material in `geistdocs.tsx`. Configuring both `proxy` and an eve agent throws at route creation.
|
|
79
79
|
- Set the server-only `GEISTDOCS_CHAT_SECRET` (at least 32 bytes, generate with `openssl rand -base64 32`) for eve agent mode. It signs the httpOnly `geistdocs_eve_session` cookie that binds a browser to its eve session (the cookie is `SameSite=Strict`, so keep the chat route on the same site as the docs pages); without it every turn starts a new eve session and prewarm requests are refused. Never prefix it with `NEXT_PUBLIC_` or put it in `geistdocs.tsx`.
|
|
80
|
-
- `createChatRoute` caps request size (1,000,000-byte body, 200 messages, 200,000-character `pageContext.content` by default; override with the `limits` option).
|
|
80
|
+
- `createChatRoute` caps request size (1,000,000-byte body, 200 messages, 200,000-character `pageContext.content` by default; override with the `limits` option). Opt in to Vercel Firewall with `rateLimit: { ids: ["ask-ai"] }` after publishing matching SDK rules in the site's Vercel project. Geistdocs owns the SDK checks and returns 429 when limited or 503 when checks fail. Omit `rateLimit` to leave it disabled; remove equivalent app-level checks when adopting it to avoid double counting.
|
|
81
81
|
- Geistdocs Ask AI targets AI SDK v6: `ai` v6 and `@ai-sdk/react` v3. Keep those dependencies on the generated package versions unless a `@vercel/geistdocs` release changes them.
|
|
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`.
|
|
@@ -160,7 +160,7 @@ The document always lists the Markdown discovery routes (`/agents.md`, `/sitemap
|
|
|
160
160
|
|
|
161
161
|
The server URL comes from `siteUrl` when it is set, and from the request origin otherwise. Set `siteUrl` so the document names your production host.
|
|
162
162
|
|
|
163
|
-
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account
|
|
163
|
+
Publishing the document makes `/api/chat` discoverable for programmatic use. That endpoint runs a language model on your account. Enable [Vercel Firewall rate limiting](/docs/ask-ai#rate-limiting) with the chat route's `rateLimit` option; it is disabled by default. Set `endpoints: { chat: false }` to omit chat from the document (this does not disable the route itself).
|
|
164
164
|
|
|
165
165
|
## Select the article in rendered HTML
|
|
166
166
|
|
|
@@ -290,7 +290,7 @@ export const SignedInAskAIUser = () => {
|
|
|
290
290
|
|
|
291
291
|
The environment variables `AI_GATEWAY_API_KEY` and `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set, which you can read more about in the [η―ε’ει](/docs/env) section.
|
|
292
292
|
|
|
293
|
-
The model
|
|
293
|
+
The default model is `openai/gpt-6-luna` via the Vercel AI Gateway.
|
|
294
294
|
|
|
295
295
|
### δ½Ώη¨ `GEISTDOCS_CHAT_SECRET` δΏζ eve δΌθ―
|
|
296
296
|
|