fix assistant exports and tool calls
This commit is contained in:
1 parent
f7eed7ce8a
commit
305c9af2da
15 files changed
+756
-29
No files matched your search
@@ -721,6 +721,7 @@ export const assistantRouter = createTRPCRouter({
|
||||
id: message.id,
|
||||
parentId: message.parentId,
|
||||
format: message.format,
|
||||
createdAt: message.createdAt,
|
||||
content: parse(message.content),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -357,4 +357,42 @@ describe("assistant conversation features", () => {
|
||||
metadata: { submittedFeedback: { type: "positive" } },
|
||||
});
|
||||
});
|
||||
|
||||
test("returns complete stored tool messages for conversation debugging exports", async () => {
|
||||
const db = await createConfiguredAssistantAsync();
|
||||
await db.insert(users).values({ id: adminSession.user.id });
|
||||
const caller = assistantRouter.createCaller({ db, deviceType: undefined, session: adminSession });
|
||||
const thread = await caller.createThread();
|
||||
const content = {
|
||||
role: "assistant",
|
||||
parts: [
|
||||
{
|
||||
type: "tool-icon_findIcons",
|
||||
toolCallId: "call-icons",
|
||||
state: "output-available",
|
||||
input: { searchText: "homarr" },
|
||||
output: { icons: [{ name: "homarr.svg" }] },
|
||||
},
|
||||
],
|
||||
metadata: { custom: { telemetry: { requestId: "request-1" } } },
|
||||
};
|
||||
await caller.appendMessage({
|
||||
threadId: thread.id,
|
||||
id: "message-with-tool",
|
||||
parentId: null,
|
||||
format: "ai-sdk/v6",
|
||||
content,
|
||||
});
|
||||
|
||||
const result = await caller.getThread({ threadId: thread.id });
|
||||
|
||||
expect(result.messages).toHaveLength(1);
|
||||
expect(result.messages[0]).toMatchObject({
|
||||
id: "message-with-tool",
|
||||
parentId: null,
|
||||
format: "ai-sdk/v6",
|
||||
content,
|
||||
});
|
||||
expect(result.messages[0]?.createdAt).toBeInstanceOf(Date);
|
||||
});
|
||||
});
|
||||
@@ -51,4 +51,27 @@ describe("findIcons", () => {
|
||||
|
||||
expect(result.icons).toMatchObject([{ slug: "example/empty", icons: [] }]);
|
||||
});
|
||||
|
||||
test("finds the Homarr icon and returns its exact local repository URL", async () => {
|
||||
const db = createDb();
|
||||
await db.insert(iconRepositories).values({ id: "dashboard-icons", slug: "homarr-labs/dashboard-icons" });
|
||||
await db.insert(icons).values({
|
||||
id: "homarr-svg",
|
||||
name: "homarr.svg",
|
||||
url: "https://cdn.example.com/homarr.svg",
|
||||
checksum: "homarr",
|
||||
iconRepositoryId: "dashboard-icons",
|
||||
});
|
||||
const caller = iconsRouter.createCaller({ db, deviceType: undefined, session: null });
|
||||
|
||||
await expect(caller.findIcons({ searchText: "homarr" })).resolves.toMatchObject({
|
||||
countIcons: 1,
|
||||
icons: [
|
||||
{
|
||||
slug: "homarr-labs/dashboard-icons",
|
||||
icons: [{ name: "homarr.svg", url: "https://cdn.example.com/homarr.svg" }],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user