feat: polish assistant conversations
This commit is contained in:
1 parent
1ad1439828
commit
f991dc6334
14 files changed
+509
-120
No files matched your search
@@ -23,6 +23,7 @@ import {
|
||||
assistantProviderIds,
|
||||
assistantProviderPresets,
|
||||
assistantProviderRequiresApiKey,
|
||||
getIconUrl,
|
||||
resolveAssistantModelId,
|
||||
} from "@homarr/definitions";
|
||||
|
||||
@@ -71,6 +72,7 @@ export type AssistantContextEntity = {
|
||||
type: "app" | "integration" | "board" | "widget";
|
||||
label: string;
|
||||
description: string;
|
||||
iconUrl?: string;
|
||||
boardId?: string;
|
||||
};
|
||||
|
||||
@@ -340,7 +342,7 @@ export const getAssistantContextEntitiesAsync = async (ctx: AssistantContext): P
|
||||
limit: 250,
|
||||
}),
|
||||
ctx.db.query.apps.findMany({
|
||||
columns: { id: true, name: true, description: true },
|
||||
columns: { id: true, name: true, description: true, iconUrl: true },
|
||||
orderBy: asc(apps.name),
|
||||
limit: 250,
|
||||
}),
|
||||
@@ -366,6 +368,7 @@ export const getAssistantContextEntitiesAsync = async (ctx: AssistantContext): P
|
||||
type: "app",
|
||||
label: app.name,
|
||||
description: app.description ?? "Homarr app",
|
||||
iconUrl: app.iconUrl,
|
||||
}),
|
||||
),
|
||||
...availableIntegrations
|
||||
@@ -376,6 +379,7 @@ export const getAssistantContextEntitiesAsync = async (ctx: AssistantContext): P
|
||||
type: "integration",
|
||||
label: integration.name,
|
||||
description: `${integration.kind} integration`,
|
||||
iconUrl: getIconUrl(integration.kind),
|
||||
}),
|
||||
),
|
||||
...availableBoards.map(
|
||||
|
||||
@@ -271,10 +271,20 @@ describe("assistant conversation features", () => {
|
||||
|
||||
expect(entities).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ id: "app-1", type: "app", label: "Plex" }),
|
||||
expect.objectContaining({
|
||||
id: "app-1",
|
||||
type: "app",
|
||||
label: "Plex",
|
||||
iconUrl: "https://example.com/plex.svg",
|
||||
}),
|
||||
expect.objectContaining({ id: "board-1", type: "board", label: "Home" }),
|
||||
expect.objectContaining({ id: "widget-1", type: "widget", boardId: "board-1" }),
|
||||
expect.objectContaining({ id: "integration-1", type: "integration", label: "Media server" }),
|
||||
expect.objectContaining({
|
||||
id: "integration-1",
|
||||
type: "integration",
|
||||
label: "Media server",
|
||||
iconUrl: expect.stringContaining("plex"),
|
||||
}),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user