Skip to content

Commit a387774

Browse files
authored
chore: update deps (#415)
1 parent c6fd49a commit a387774

File tree

7 files changed

+4028
-4579
lines changed

7 files changed

+4028
-4579
lines changed

docs/content/0.index.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ database:
173173
title: Database
174174
icon: i-lucide-database
175175
title: A Scalable SQL Database
176-
description: 'NuxtHub Database unlocks the power of <a class="font-semibold text-gray-800 dark:text-gray-300 hover:underline underline-offset-4" href="https://developers.cloudflare.com/d1/" target="_blank">Cloudflare D1</a> to give you access to a serverless SQL database, with zero configuration.
177-
Scale and manage effortlessly, and pay only for what you use.'
176+
description: >
177+
NuxtHub Database unlocks the power of <a class="font-semibold text-gray-800 dark:text-gray-300 hover:underline underline-offset-4" href="https://developers.cloudflare.com/d1/" target="_blank">Cloudflare D1</a> to give you access to a serverless SQL database, with zero configuration. Scale and manage effortlessly, and pay only for what you use.
178178
features:
179179
- name: 'hubDatabase() server helper'
180180
icon: i-lucide-square-function
@@ -210,8 +210,8 @@ kv:
210210
title: Key-Value
211211
icon: i-lucide-list
212212
title: A Global Key-Value Database
213-
description: 'NuxtHub KV leverages <a href="https://developers.cloudflare.com/kv/" target="_blank" class="font-semibold text-gray-800 dark:text-gray-200 hover:underline underline-offset-4">Cloudflare Workers KV</a> to access a global, low-latency, key-value data storage across 300+ global locations.
214-
Access it in your Nuxt codebase, with zero-configuration.'
213+
description: >
214+
NuxtHub KV leverages <a href="https://developers.cloudflare.com/kv/" target="_blank" class="font-semibold text-gray-800 dark:text-gray-200 hover:underline underline-offset-4">Cloudflare Workers KV</a> to access a global, low-latency, key-value data storage across 300+ global locations. Access it in your Nuxt codebase, with zero-configuration.
215215
features:
216216
- name: 'hubKV() server helper'
217217
icon: i-lucide-square-function

docs/content/1.docs/2.features/ai.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ NuxtHub AI is compatible with some functions of the [Vercel AI SDK](https://sdk
169169
Make sure to install the Vercel AI SDK in your project.
170170

171171
```[Terminal]
172-
npx nypm i ai @ai-sdk/vue
172+
npx nypm i ai @ai-sdk/vue workers-ai-provider
173173
```
174174

175175
::note
@@ -181,21 +181,18 @@ npx nypm i ai @ai-sdk/vue
181181
To leverage the `useChat()` Vue composable, you need to create a `POST /api/chat` endpoint that uses the `hubAI()` server composable and returns a compatible stream for the Vercel AI SDK.
182182

183183
```ts [server/api/chat.post.ts]
184-
import { AIStream, formatStreamPart } from 'ai'
184+
import { streamText } from 'ai'
185+
import { createWorkersAI } from 'workers-ai-provider'
185186

186187
export default defineEventHandler(async (event) => {
187188
const { messages } = await readBody(event)
188189

189-
const stream = await hubAI().run('@cf/meta/llama-3.1-8b-instruct', {
190-
messages,
191-
stream: true
192-
}) as ReadableStream
190+
const workersAI = createWorkersAI({ binding: hubAI() })
193191

194-
// Return a compatible stream for the Vercel AI SDK
195-
return AIStream(
196-
new Response(stream),
197-
data => formatStreamPart('text', JSON.parse(data).response)
198-
)
192+
return streamText({
193+
model: workersAI('@cf/meta/llama-3.1-8b-instruct'),
194+
messages
195+
}).toDataStreamResponse()
199196
})
200197
```
201198

@@ -227,5 +224,5 @@ const { messages, input, handleSubmit, isLoading, stop, error, reload } = useCha
227224
Learn more about the [`useChat()` Vue composable](https://sdk.vercel.ai/docs/reference/ai-sdk-ui/use-chat).
228225

229226
::callout
230-
Check out our [`pages/ai.vue` full example](https://github.com/nuxt-hub/core/blob/main/playground/app/pages/ai.vue) with Nuxt UI & Nuxt MDC.
227+
Check out our [`pages/ai.vue` full example](https://github.com/nuxt-hub/core/blob/main/playground/app/pages/ai.vue) with Nuxt UI & [Nuxt MDC](https://github.com/nuxt-modules/mdc).
231228
::

docs/package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
"preview": "nuxi preview"
1111
},
1212
"dependencies": {
13-
"@iconify-json/heroicons": "^1.2.1",
14-
"@iconify-json/logos": "^1.2.3",
15-
"@iconify-json/lucide": "^1.2.14",
16-
"@iconify-json/ph": "^1.2.1",
17-
"@iconify-json/simple-icons": "^1.2.11",
18-
"@iconify-json/vscode-icons": "^1.2.2",
13+
"@iconify-json/heroicons": "^1.2.2",
14+
"@iconify-json/logos": "^1.2.4",
15+
"@iconify-json/lucide": "^1.2.22",
16+
"@iconify-json/ph": "^1.2.2",
17+
"@iconify-json/simple-icons": "^1.2.19",
18+
"@iconify-json/vscode-icons": "^1.2.9",
1919
"@nuxt/content": "^2.13.4",
20-
"@nuxt/fonts": "^0.10.2",
21-
"@nuxt/image": "^1.8.1",
20+
"@nuxt/fonts": "^0.10.3",
21+
"@nuxt/image": "^1.9.0",
2222
"@nuxt/scripts": "^0.9.5",
23-
"@nuxt/ui-pro": "^1.5.0",
23+
"@nuxt/ui-pro": "^1.6.0",
2424
"@nuxthq/studio": "^2.2.1",
25-
"@nuxtjs/plausible": "^1.0.3",
25+
"@nuxtjs/plausible": "^1.2.0",
2626
"@nuxtjs/tailwindcss": "^6.12.2",
27-
"@tsparticles/engine": "^3.5.0",
28-
"@tsparticles/slim": "^3.5.0",
29-
"@vueuse/core": "^11.2.0",
30-
"@vueuse/nuxt": "^11.2.0",
27+
"@tsparticles/engine": "^3.7.1",
28+
"@tsparticles/slim": "^3.7.1",
29+
"@vueuse/core": "^12.3.0",
30+
"@vueuse/nuxt": "^12.3.0",
3131
"feed": "^4.2.2",
3232
"medium-zoom": "^1.1.0",
33-
"nuxt": "^3.14.159",
33+
"nuxt": "^3.15.1",
3434
"nuxt-cloudflare-analytics": "^1.0.8",
35-
"nuxt-og-image": "^3.0.8"
35+
"nuxt-og-image": "^4.0.2"
3636
}
3737
}

package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,40 @@
3838
"test:watch": "vitest watch"
3939
},
4040
"dependencies": {
41-
"@cloudflare/workers-types": "^4.20241216.0",
42-
"@nuxt/devtools-kit": "^1.6.4",
43-
"@nuxt/kit": "^3.14.1592",
44-
"@uploadthing/mime-types": "^0.3.2",
41+
"@cloudflare/workers-types": "^4.20241230.0",
42+
"@nuxt/devtools-kit": "^1.7.0",
43+
"@nuxt/kit": "^3.15.1",
44+
"@uploadthing/mime-types": "^0.3.4",
4545
"citty": "^0.1.6",
4646
"confbox": "^0.1.8",
4747
"defu": "^6.1.4",
4848
"destr": "^2.0.3",
4949
"h3": "^1.13.0",
50-
"mime": "^4.0.4",
50+
"mime": "^4.0.6",
5151
"nitro-cloudflare-dev": "^0.2.1",
5252
"ofetch": "^1.4.1",
53-
"pathe": "^1.1.2",
54-
"pkg-types": "^1.2.1",
53+
"pathe": "^2.0.0",
54+
"pkg-types": "^1.3.0",
5555
"std-env": "^3.8.0",
5656
"ufo": "^1.5.4",
5757
"uncrypto": "^0.1.3",
58-
"unstorage": "^1.13.1",
58+
"unstorage": "^1.14.4",
5959
"zod": "^3.24.1"
6060
},
6161
"devDependencies": {
62-
"@nuxt/devtools": "^1.6.4",
63-
"@nuxt/eslint-config": "^0.7.3",
62+
"@nuxt/devtools": "^1.7.0",
63+
"@nuxt/eslint-config": "^0.7.4",
6464
"@nuxt/module-builder": "^0.8.4",
65-
"@nuxt/schema": "^3.14.1592",
65+
"@nuxt/schema": "^3.15.1",
6666
"@nuxt/test-utils": "^3.15.1",
6767
"@nuxthub/core": "link:",
68-
"@types/node": "^22.10.2",
68+
"@types/node": "^22.10.5",
6969
"changelogen": "^0.5.7",
7070
"eslint": "^9.17.0",
71-
"nuxt": "^3.14.1592",
71+
"nuxt": "^3.15.1",
7272
"typescript": "5.6.3",
7373
"vitest": "^2.1.8",
74-
"wrangler": "^3.96.0"
74+
"wrangler": "^3.100.0"
7575
},
76-
"packageManager": "[email protected].0"
76+
"packageManager": "[email protected].3"
7777
}

playground/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88
"preview": "nuxi preview"
99
},
1010
"dependencies": {
11-
"@ai-sdk/vue": "^0.0.59",
11+
"@ai-sdk/vue": "^1.0.8",
1212
"@cloudflare/puppeteer": "^0.0.14",
13-
"@iconify-json/simple-icons": "^1.2.11",
13+
"@iconify-json/simple-icons": "^1.2.19",
1414
"@kgierke/nuxt-basic-auth": "^1.7.0",
15-
"@nuxt/ui": "^2.19.2",
15+
"@nuxt/ui": "^2.20.0",
1616
"@nuxthub/core": "latest",
17-
"@nuxtjs/mdc": "^0.9.2",
18-
"ai": "^3.4.33",
17+
"@nuxtjs/mdc": "^0.12.1",
18+
"ai": "^4.0.30",
1919
"aws4fetch": "^1.0.20",
20-
"drizzle-orm": "^0.36.1",
21-
"nuxt": "^3.14.159",
20+
"drizzle-orm": "^0.38.3",
21+
"nuxt": "^3.15.1",
2222
"postgres": "^3.4.5",
23-
"puppeteer": "^23.7.1",
24-
"zod": "^3.23.8"
23+
"puppeteer": "^23.11.1",
24+
"workers-ai-provider": "^0.0.10",
25+
"zod": "^3.24.1"
2526
},
2627
"devDependencies": {
2728
"@nuxt/devtools": "latest"

playground/server/api/chat.post.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { AIStream, formatStreamPart } from 'ai'
1+
import { streamText } from 'ai'
2+
import { createWorkersAI } from 'workers-ai-provider'
23

34
defineRouteMeta({
45
openAPI: {
@@ -10,10 +11,20 @@ defineRouteMeta({
1011
export default defineEventHandler(async (event) => {
1112
const { messages } = await readBody(event)
1213

13-
const stream = await hubAI().run('@cf/meta/llama-3.1-8b-instruct', {
14-
messages,
15-
stream: true
16-
}) as ReadableStream
14+
const workersAI = createWorkersAI({ binding: hubAI() })
15+
16+
return streamText({
17+
model: workersAI('@cf/meta/llama-3.1-8b-instruct'),
18+
messages
19+
}).toDataStreamResponse({
20+
// headers: {
21+
// // add these headers to ensure that the
22+
// // response is chunked and streamed
23+
// 'content-type': 'text/x-unknown',
24+
// 'content-encoding': 'identity',
25+
// 'transfer-encoding': 'chunked'
26+
// }
27+
})
1728

1829
// For testing purposes, we'll randomly throw an error
1930
// if (Math.round(Math.random()) === 1) {
@@ -22,6 +33,4 @@ export default defineEventHandler(async (event) => {
2233
// statusMessage: 'Nope'
2334
// })
2435
// }
25-
26-
return AIStream(new Response(stream), data => formatStreamPart('text', JSON.parse(data).response))
2736
})

0 commit comments

Comments
 (0)