feat: upgrade ai sdk
This commit is contained in:
parent
cac65d46f8
commit
688cfceab9
|
|
@ -51,7 +51,7 @@
|
|||
"@welldone-software/why-did-you-render": "10.0.1",
|
||||
"@xyflow/react": "12.9.2",
|
||||
"@yornaath/batshit": "0.11.1",
|
||||
"ai": "5.0.87",
|
||||
"ai": "5.0.115",
|
||||
"camelcase-keys": "10.0.1",
|
||||
"chrono-node": "2.9.0",
|
||||
"class-variance-authority": "0.7.1",
|
||||
|
|
|
|||
|
|
@ -62,6 +62,28 @@ export function createChatTransport({ onValue, titleHandler }: CreateChatTranspo
|
|||
})
|
||||
}
|
||||
|
||||
const coerceFinishChunk = (chunk: ParseResult<UIMessageChunk>): UIMessageChunk | null => {
|
||||
const { rawValue } = chunk
|
||||
if (!rawValue || typeof rawValue !== "object" || Array.isArray(rawValue)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if ((rawValue as { type?: unknown }).type !== "finish") {
|
||||
return null
|
||||
}
|
||||
|
||||
const { finishReason, messageMetadata } = rawValue as {
|
||||
finishReason?: unknown
|
||||
messageMetadata?: unknown
|
||||
}
|
||||
|
||||
return {
|
||||
type: "finish",
|
||||
finishReason: typeof finishReason === "string" ? finishReason : undefined,
|
||||
messageMetadata,
|
||||
} as UIMessageChunk
|
||||
}
|
||||
|
||||
class ExtendChatTransport extends HttpChatTransport<BizUIMessage> {
|
||||
constructor(
|
||||
private options: HttpChatTransportInitOptions<BizUIMessage> & {
|
||||
|
|
@ -83,13 +105,14 @@ class ExtendChatTransport extends HttpChatTransport<BizUIMessage> {
|
|||
}).pipeThrough(
|
||||
new TransformStream<ParseResult<UIMessageChunk>, UIMessageChunk>({
|
||||
async transform(chunk, controller) {
|
||||
if (!chunk.success) {
|
||||
const parsedChunk = chunk.success ? chunk.value : coerceFinishChunk(chunk)
|
||||
if (!parsedChunk) {
|
||||
throw chunk.error
|
||||
}
|
||||
|
||||
await handleGeneratedTitle(chunk.value)
|
||||
onValue?.(chunk.value)
|
||||
controller.enqueue(chunk.value)
|
||||
await handleGeneratedTitle(parsedChunk)
|
||||
onValue?.(parsedChunk)
|
||||
controller.enqueue(parsedChunk)
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -87,5 +87,5 @@
|
|||
"vite-tsconfig-paths": "5.1.4"
|
||||
},
|
||||
"productName": "Folo",
|
||||
"mainHash": "1c627eb0ea5a109a4fc2d7ac5a78777df546d831f6cced620b8120d41dc4e444"
|
||||
"mainHash": "267411690ae1e8287e885d287302fe7c24fd15260fa0d47ae3b7d33c970330b6"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
"@follow/constants": "workspace:*",
|
||||
"@follow/models": "workspace:*",
|
||||
"@follow/shared": "workspace:*",
|
||||
"ai": "5.0.87",
|
||||
"ai": "5.0.115",
|
||||
"drizzle-orm": "0.44.7",
|
||||
"expo-sqlite": "15.2.12",
|
||||
"sqlocal": "npm:@hyoban/sqlocal@0.14.1-fork.4",
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
"@follow-app/client-sdk": "catalog:",
|
||||
"@folo-services/drizzle": "0.1.41",
|
||||
"@t3-oss/env-core": "0.13.8",
|
||||
"ai": "5.0.87",
|
||||
"ai": "5.0.115",
|
||||
"better-auth": "1.3.28",
|
||||
"drizzle-orm": "0.44.7",
|
||||
"sonner": "2.0.7",
|
||||
|
|
|
|||
459
pnpm-lock.yaml
459
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -15,11 +15,11 @@ catalog:
|
|||
|
||||
ignorePatchFailures: false
|
||||
|
||||
minimumReleaseAge: 1440
|
||||
# minimumReleaseAge: 1440
|
||||
|
||||
minimumReleaseAgeExclude:
|
||||
- "@follow-app/*"
|
||||
- "@folo-services/*"
|
||||
# minimumReleaseAgeExclude:
|
||||
# - "@follow-app/*"
|
||||
# - "@folo-services/*"
|
||||
|
||||
onlyBuiltDependencies:
|
||||
- "@firebase/util"
|
||||
|
|
|
|||
Loading…
Reference in New Issue