ai 7.0.15 → 7.0.17
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/CHANGELOG.md +13 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/04-ai-sdk-ui/02-chatbot.mdx +2 -2
- package/docs/04-ai-sdk-ui/05-completion.mdx +2 -2
- package/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +1 -1
- package/docs/07-reference/02-ai-sdk-ui/02-use-completion.mdx +1 -1
- package/docs/09-troubleshooting/50-react-maximum-update-depth-exceeded.mdx +3 -3
- package/package.json +2 -2
- package/src/ui/chat.ts +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -326,12 +326,12 @@ When the user clicks the "Regenerate" button, the AI provider will regenerate th
|
|
|
326
326
|
<Note>This feature is currently only available for React.</Note>
|
|
327
327
|
|
|
328
328
|
By default, the `useChat` hook will trigger a render every time a new chunk is received.
|
|
329
|
-
You can throttle the UI updates with the `
|
|
329
|
+
You can throttle the UI updates with the `throttle` option.
|
|
330
330
|
|
|
331
331
|
```tsx filename="page.tsx" highlight="2-3"
|
|
332
332
|
const { messages, ... } = useChat({
|
|
333
333
|
// Throttle the messages and data updates to 50ms:
|
|
334
|
-
|
|
334
|
+
throttle: 50
|
|
335
335
|
})
|
|
336
336
|
```
|
|
337
337
|
|
|
@@ -143,12 +143,12 @@ When the user clicks the "Stop" button, the fetch request will be aborted. This
|
|
|
143
143
|
<Note>This feature is currently only available for React.</Note>
|
|
144
144
|
|
|
145
145
|
By default, the `useCompletion` hook will trigger a render every time a new chunk is received.
|
|
146
|
-
You can throttle the UI updates with the `
|
|
146
|
+
You can throttle the UI updates with the `throttle` option.
|
|
147
147
|
|
|
148
148
|
```tsx filename="page.tsx" highlight="2-3"
|
|
149
149
|
const { completion, ... } = useCompletion({
|
|
150
150
|
// Throttle the completion and data updates to 50ms:
|
|
151
|
-
|
|
151
|
+
throttle: 50
|
|
152
152
|
})
|
|
153
153
|
```
|
|
154
154
|
|
|
@@ -334,7 +334,7 @@ Allows you to easily create a conversational user interface for your chatbot app
|
|
|
334
334
|
'Optional callback function that is called when a data part is received.',
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
|
-
name: '
|
|
337
|
+
name: 'throttle',
|
|
338
338
|
type: 'number',
|
|
339
339
|
isOptional: true,
|
|
340
340
|
description:
|
|
@@ -113,7 +113,7 @@ Allows you to create text completion based capabilities for your application. It
|
|
|
113
113
|
'Optional. A custom fetch function to be used for the API call. Defaults to the global fetch function.',
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
|
-
name: '
|
|
116
|
+
name: 'throttle',
|
|
117
117
|
type: 'number',
|
|
118
118
|
isOptional: true,
|
|
119
119
|
description:
|
|
@@ -18,14 +18,14 @@ need updating (e.g. Markdown). Throttling can mitigate this.
|
|
|
18
18
|
|
|
19
19
|
## Solution
|
|
20
20
|
|
|
21
|
-
Use the `
|
|
21
|
+
Use the `throttle` option to throttle the UI updates:
|
|
22
22
|
|
|
23
23
|
### `useChat`
|
|
24
24
|
|
|
25
25
|
```tsx filename="page.tsx" highlight="2-3"
|
|
26
26
|
const { messages, ... } = useChat({
|
|
27
27
|
// Throttle the messages and data updates to 50ms:
|
|
28
|
-
|
|
28
|
+
throttle: 50
|
|
29
29
|
})
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -34,6 +34,6 @@ const { messages, ... } = useChat({
|
|
|
34
34
|
```tsx filename="page.tsx" highlight="2-3"
|
|
35
35
|
const { completion, ... } = useCompletion({
|
|
36
36
|
// Throttle the completion and data updates to 50ms:
|
|
37
|
-
|
|
37
|
+
throttle: 50
|
|
38
38
|
})
|
|
39
39
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ai-sdk/gateway": "4.0.
|
|
45
|
+
"@ai-sdk/gateway": "4.0.13",
|
|
46
46
|
"@ai-sdk/provider": "4.0.2",
|
|
47
47
|
"@ai-sdk/provider-utils": "5.0.5"
|
|
48
48
|
},
|
package/src/ui/chat.ts
CHANGED