test assistant v7 request payload
This commit is contained in:
1 parent
8f0efd508e
commit
557b3f8d5f
1 file changed
+8
-4
@@ -65,12 +65,16 @@ describe("assistant-ui AI SDK v7 transport", () => {
|
|||||||
},
|
},
|
||||||
stopWhen: stepCountIs(2),
|
stopWhen: stepCountIs(2),
|
||||||
});
|
});
|
||||||
const fetchMock = vi.fn(async () =>
|
const fetchMock = vi.fn(async (_input: RequestInfo | URL, init?: RequestInit) => {
|
||||||
result.toUIMessageStreamResponse({
|
expect(JSON.parse(String(init?.body))).toMatchObject({
|
||||||
|
id: "thread-1",
|
||||||
|
messages: [{ id: "user-1", role: "user", parts: [{ type: "text", text: "Run migration test" }] }],
|
||||||
|
});
|
||||||
|
return result.toUIMessageStreamResponse({
|
||||||
sendReasoning: true,
|
sendReasoning: true,
|
||||||
messageMetadata: ({ part }) => (part.type === "finish" ? { runtime: "ai-sdk-v7" } : undefined),
|
messageMetadata: ({ part }) => (part.type === "finish" ? { runtime: "ai-sdk-v7" } : undefined),
|
||||||
}),
|
});
|
||||||
);
|
});
|
||||||
const transport = new AssistantChatTransport({
|
const transport = new AssistantChatTransport({
|
||||||
api: "https://homarr.test/api/assistant/chat",
|
api: "https://homarr.test/api/assistant/chat",
|
||||||
fetch: fetchMock,
|
fetch: fetchMock,
|
||||||
|
|||||||
Reference in new issue
Block a user