You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`model`|`(modelId: string) => LanguageModel`| Yes | Resolves a model id to a Vercel AI SDK `LanguageModel`. Called once per request with the selected model |
40
-
|`defaultModel`|`string`| Yes | Model id used when no per-request override is provided |
41
-
|`availableModels`|`ModelOption[]`| No | Models the user can choose from in the chat UI (selector shown when 2+ entries) |
42
-
|`systemPrompt`|`({ req, defaultPrompt }) => string \| Promise<string>`| No | Customize the agent's system prompt. Wrap or replace `defaultPrompt` and return the final string. Called per request, so the prompt can be loaded from a Payload global / varied per tenant (see below) |
43
-
|`access`|`(req) => boolean`| No | Override the default auth check (default: requires authenticated user) |
44
-
|`maxSteps`|`number`| No | Maximum tool-use loop steps per request (default: 20) |
45
-
|`modes`|`ModesConfig`| No | Agent modes configuration (see below) |
46
-
|`adminView`|`{ path, Component }`| No | Customize the admin chat view route or component |
47
-
|`navLink`|`boolean`| No | Show a "Chat" link at the top of the admin nav sidebar (default: `true`) |
48
-
|`budget`|`BudgetConfig`| No | Optional token budget (see below) |
49
-
|`emptyState`|`EmptyStateConfig`| No| Customize the empty chat screen — title, markdown description, and suggested-prompt chips (see below)|
50
-
|`tools`|`({ req, defaultTools, modelId }) => ToolMap`| No | Compose the final toolset — add user or provider-native tools, drop defaults, etc. (see below) |
51
-
|`toolDiscovery`|`{ searchTool, eager? }`| No | Anthropic's Tool Search Tool — defer cold-path tool definitions and load them on demand (see below) |
|`model`|`(modelId: string) => LanguageModel`| Yes | Resolves a model id to a Vercel AI SDK `LanguageModel`. Called once per request with the selected model |
40
+
|`defaultModel`|`string`| Yes | Model id used when no per-request override is provided |
41
+
|`availableModels`|`ModelOption[]`| No | Models the user can choose from in the chat UI (selector shown when 2+ entries) |
42
+
|`systemPrompt`|`({ req, defaultPrompt }) => string \| Promise<string>`| No | Customize the agent's system prompt. Wrap or replace `defaultPrompt` and return the final string. Called per request, so the prompt can be loaded from a Payload global / varied per tenant (see below) |
43
+
|`access`|`(req) => boolean`| No | Override the default auth check (default: requires authenticated user) |
44
+
|`maxSteps`|`number`| No | Maximum tool-use loop steps per request (default: 20) |
45
+
|`modes`|`ModesConfig`| No | Agent modes configuration (see below) |
46
+
|`adminView`|`{ path, Component }`| No | Customize the admin chat view route or component |
47
+
|`navLink`|`boolean`| No | Show a "Chat" link at the top of the admin nav sidebar (default: `true`) |
48
+
|`budget`|`BudgetConfig`| No | Optional token budget (see below) |
49
+
|`emptyState`|`EmptyStateConfig \| (({ req }) => MaybePromise<EmptyStateConfig>)`| No| Customize the empty chat screen — static object or per-request callback (see below)|
50
+
|`tools`|`({ req, defaultTools, modelId }) => ToolMap`| No | Compose the final toolset — add user or provider-native tools, drop defaults, etc. (see below) |
51
+
|`toolDiscovery`|`{ searchTool, eager? }`| No | Anthropic's Tool Search Tool — defer cold-path tool definitions and load them on demand (see below) |
52
52
53
53
### Mixing providers
54
54
@@ -100,9 +100,10 @@ chatAgentPlugin({
100
100
101
101
Customize what editors see before they've sent the first message. Without this option, the chat opens to a generic "What can I help you with?" headline and a few example prompt chips.
102
102
103
-
Example:
103
+
Accepts a static object or a per-request callback (e.g. to read from a Payload global):
104
104
105
105
```ts
106
+
// Static
106
107
chatAgentPlugin({
107
108
emptyState: {
108
109
title: 'Content Assistant',
@@ -112,6 +113,17 @@ chatAgentPlugin({
112
113
starterPrompts: ['Audit my recent draft posts', 'Translate the homepage tagline to German'],
113
114
},
114
115
})
116
+
117
+
// Per-request callback
118
+
chatAgentPlugin({
119
+
emptyState: async ({ req }) => {
120
+
const site =awaitreq.payload.findGlobal({ slug: 'site' })
0 commit comments