smlflg's picture
Initial public upload from Projekte/learn-harness-engineering (part 3)
bde76b9 verified
Raw History Blame Contribute Delete
961 Bytes
import { contextBridge, ipcRenderer } from 'electron';
import { IPC_CHANNELS } from '../shared/types';
const api = {
documents: {
list: () => ipcRenderer.invoke(IPC_CHANNELS.LIST_DOCUMENTS),
import: (filePath: string) => ipcRenderer.invoke(IPC_CHANNELS.IMPORT_DOCUMENT, filePath),
get: (id: string) => ipcRenderer.invoke(IPC_CHANNELS.GET_DOCUMENT, id),
delete: (id: string) => ipcRenderer.invoke(IPC_CHANNELS.DELETE_DOCUMENT, id),
},
indexing: {
start: (documentId?: string) => ipcRenderer.invoke(IPC_CHANNELS.START_INDEXING, documentId),
status: () => ipcRenderer.invoke(IPC_CHANNELS.GET_INDEXING_STATUS),
chunks: (documentId: string) => ipcRenderer.invoke(IPC_CHANNELS.GET_CHUNKS, documentId),
},
qa: {
ask: (question: string) => ipcRenderer.invoke(IPC_CHANNELS.ASK_QUESTION, question),
history: () => ipcRenderer.invoke(IPC_CHANNELS.GET_HISTORY),
},
};
contextBridge.exposeInMainWorld('knowledgeBase', api);