chore upgrade assistant to AI SDK v7
This commit is contained in:
1 parent
e662a175c0
commit
876f312a2e
6 files changed
+37
-8
No files matched your search
@@ -42,6 +42,11 @@ conversation instead of copying text into another widget or the floating panel.
|
||||
When the assistant is unavailable, its command-menu result remains visible but disabled and explains that
|
||||
an administrator must configure and enable it.
|
||||
|
||||
The assistant uses the assistant-ui runtime for **AI SDK v7**. Homarr tracks the newest mutually compatible
|
||||
package set permitted by its supply-chain release-age policy. Persisted message rows can still report the upstream
|
||||
codec name `ai-sdk/v6`; assistant-ui's current v7 adapter deliberately retains that identifier for its compatible
|
||||
UI-message wire format. It does not mean the application is running AI SDK v6.
|
||||
|
||||
## Configure a model provider
|
||||
|
||||
Homarr includes presets for OpenRouter, OpenAI, Anthropic Claude, Google Gemini, xAI, Groq, Mistral AI,
|
||||
|
||||
@@ -259,6 +259,8 @@ const createHistoryAdapter = (threadId: string | undefined): ThreadHistoryAdapte
|
||||
withFormat<TMessage, TStorageFormat extends Record<string, unknown>>(
|
||||
formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>,
|
||||
) {
|
||||
// assistant-ui's current AI SDK v7 runtime intentionally keeps this identifier for its
|
||||
// persisted UIMessage wire format. It is a storage codec name, not the installed SDK version.
|
||||
if (formatAdapter.format !== "ai-sdk/v6") {
|
||||
throw new Error(`Unsupported assistant message format: ${formatAdapter.format}`);
|
||||
}
|
||||
@@ -375,6 +377,8 @@ const AssistantThreadRuntime = () => {
|
||||
sendAutomaticallyWhen: shouldAutomaticallyContinueAssistant,
|
||||
});
|
||||
|
||||
// The lower-level AI SDK v7 runtime is intentional: Homarr supplies its own tRPC-backed
|
||||
// thread list and history adapters and shares this chat instance with its custom transport.
|
||||
const runtime = useAISDKRuntime(chat, {
|
||||
...assistantAiSdkRuntimeOptions,
|
||||
adapters: {
|
||||
|
||||
@@ -305,6 +305,16 @@ describe("AssistantRuntimeProviderWithTools", () => {
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
test("forwards main-thread reloads through the surface runtime", async () => {
|
||||
const { root, a, sharedRuntime } = await renderSurfaceTestAssistant();
|
||||
const reloadMainThread = vi.spyOn(sharedRuntime.threads, "reloadMainThread").mockResolvedValue();
|
||||
|
||||
await act(async () => a.threads().reloadMainThread());
|
||||
|
||||
expect(reloadMainThread).toHaveBeenCalledOnce();
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
test("restores focus after the Lexical run-start behavior tries to focus every surface", async () => {
|
||||
const outsideInput = document.createElement("input");
|
||||
document.body.append(outsideInput);
|
||||
|
||||
@@ -348,6 +348,7 @@ export const createAssistantSurfaceRuntime = (runtime: AssistantRuntime): Assist
|
||||
switchToNewThread: () => sharedThreads.switchToNewThread(),
|
||||
getLoadThreadsPromise: () => sharedThreads.getLoadThreadsPromise(),
|
||||
reload: () => sharedThreads.reload(),
|
||||
reloadMainThread: () => sharedThreads.reloadMainThread(),
|
||||
loadMore: () => sharedThreads.loadMore(),
|
||||
};
|
||||
|
||||
|
||||
@@ -796,6 +796,7 @@ export const assistantRouter = createTRPCRouter({
|
||||
threadId: z.string().max(64),
|
||||
id: z.string().min(1).max(128),
|
||||
parentId: z.string().max(128).nullable(),
|
||||
// The current assistant-ui AI SDK v7 adapter uses this value as its persisted wire-format identifier.
|
||||
format: z.literal("ai-sdk/v6"),
|
||||
content: z.unknown(),
|
||||
}),
|
||||
|
||||
+16
-8
@@ -3,7 +3,7 @@ packages:
|
||||
- packages/*
|
||||
- tooling/*
|
||||
catalog:
|
||||
"@ai-sdk/react": ^4.0.55
|
||||
"@ai-sdk/react": ^4.0.59
|
||||
"@babel/parser": ^7.29.7
|
||||
"@codemirror/autocomplete": ^6.20.3
|
||||
"@codemirror/commands": ^6.10.3
|
||||
@@ -215,13 +215,13 @@ catalog:
|
||||
zod: ^4.4.3
|
||||
zod-form-data: ^3.0.2
|
||||
zod-validation-error: ^5.0.0
|
||||
"@assistant-ui/react": ^0.14.27
|
||||
"@assistant-ui/react-ai-sdk": ^1.3.41
|
||||
"@assistant-ui/react-lexical": 0.2.0
|
||||
"@assistant-ui/react-markdown": ^0.14.7
|
||||
ai: ^7.0.37
|
||||
assistant-stream: ^0.3.26
|
||||
"@ai-sdk/openai-compatible": 3.0.14
|
||||
"@assistant-ui/react": 0.15.8
|
||||
"@assistant-ui/react-ai-sdk": 1.4.4
|
||||
"@assistant-ui/react-lexical": 0.2.7
|
||||
"@assistant-ui/react-markdown": 0.14.9
|
||||
ai: ^7.0.56
|
||||
assistant-stream: 0.3.34
|
||||
"@ai-sdk/openai-compatible": 3.0.25
|
||||
remark-breaks: ^4.0.0
|
||||
remark-directive: ^3.0.1
|
||||
remark-gfm: ^4.0.1
|
||||
@@ -247,6 +247,14 @@ minimumReleaseAgeExclude:
|
||||
# Renovate security update: esbuild@0.28.1
|
||||
- esbuild@0.28.1
|
||||
overrides:
|
||||
"@assistant-ui/react-ai-sdk>@ai-sdk/mcp": 2.0.27
|
||||
"@assistant-ui/react-ai-sdk>@ai-sdk/react": 4.0.59
|
||||
"@assistant-ui/react-ai-sdk>ai": 7.0.56
|
||||
"@assistant-ui/react-ai-sdk>assistant-stream": 0.3.34
|
||||
"@assistant-ui/core": 0.3.7
|
||||
"@assistant-ui/store": 0.3.5
|
||||
"@assistant-ui/tap": 0.9.10
|
||||
"assistant-cloud": 0.1.38
|
||||
"@babel/helpers@<7.26.10": ">=7.29.7"
|
||||
"@babel/runtime@<7.26.10": ">=7.29.7"
|
||||
"axios@>=1.0.0 <1.8.2": ">=1.18.1"
|
||||
|
||||
Reference in new issue
Block a user