feat(open-webui): full attachment menu with all source types
Replace the single attach popover with an Open WebUI-style multi-level
menu covering every attachment source:
- Upload Files: images stay inline (vision); other files are uploaded and
grounded via retrieval (`file-{id}` collection).
- Capture: take a photo from the webcam as an inline image.
- Attach Webpage: ingest a URL (existing).
- Attach Files: pick files already stored in Open WebUI.
- Attach Notes: inject the contents of a note as context.
- Attach Knowledge: nested picker with checkboxes, expandable to a base's
files (replaces the flat checkbox list).
- Reference Chats: bring a previous conversation in as context.
Knowledge bases, web pages and files are grounded by retrieval; notes and
referenced chats are injected verbatim as context blocks. Adds the
supporting integration methods (list files/notes, knowledge files, upload
file), request handlers and tRPC procedures.
This commit is contained in:
1 parent
800caf6e5e
commit
78bd66e803
8 files changed
+809
-124
No files matched your search
@@ -4,8 +4,10 @@ import { createIntegrationAsync } from "@homarr/integrations";
|
||||
import type {
|
||||
OpenWebUiChat,
|
||||
OpenWebUiChatListItem,
|
||||
OpenWebUiFileSummary,
|
||||
OpenWebUiKnowledge,
|
||||
OpenWebUiModel,
|
||||
OpenWebUiNote,
|
||||
} from "@homarr/integrations/types";
|
||||
|
||||
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
|
||||
@@ -36,6 +38,45 @@ export const openWebUiKnowledgeRequestHandler = createCachedIntegrationRequestHa
|
||||
queryKey: "openWebUiKnowledge",
|
||||
});
|
||||
|
||||
export const openWebUiKnowledgeFilesRequestHandler = createCachedIntegrationRequestHandler<
|
||||
OpenWebUiFileSummary[],
|
||||
"openWebUi",
|
||||
{ knowledgeId: string }
|
||||
>({
|
||||
async requestAsync(integration, input) {
|
||||
const integrationInstance = await createIntegrationAsync(integration);
|
||||
return await integrationInstance.getKnowledgeFilesAsync(input.knowledgeId);
|
||||
},
|
||||
cacheDuration: dayjs.duration(1, "minute"),
|
||||
queryKey: "openWebUiKnowledgeFiles",
|
||||
});
|
||||
|
||||
export const openWebUiFilesRequestHandler = createCachedIntegrationRequestHandler<
|
||||
OpenWebUiFileSummary[],
|
||||
"openWebUi",
|
||||
Record<string, never>
|
||||
>({
|
||||
async requestAsync(integration) {
|
||||
const integrationInstance = await createIntegrationAsync(integration);
|
||||
return await integrationInstance.listFilesAsync();
|
||||
},
|
||||
cacheDuration: dayjs.duration(30, "seconds"),
|
||||
queryKey: "openWebUiFiles",
|
||||
});
|
||||
|
||||
export const openWebUiNotesRequestHandler = createCachedIntegrationRequestHandler<
|
||||
OpenWebUiNote[],
|
||||
"openWebUi",
|
||||
Record<string, never>
|
||||
>({
|
||||
async requestAsync(integration) {
|
||||
const integrationInstance = await createIntegrationAsync(integration);
|
||||
return await integrationInstance.listNotesAsync();
|
||||
},
|
||||
cacheDuration: dayjs.duration(30, "seconds"),
|
||||
queryKey: "openWebUiNotes",
|
||||
});
|
||||
|
||||
export const openWebUiChatsRequestHandler = createCachedIntegrationRequestHandler<
|
||||
OpenWebUiChatListItem[],
|
||||
"openWebUi",
|
||||
|
||||
Reference in new issue
Block a user