feat: expand model tools and document handling

This commit is contained in:
lofyer
2026-08-11 19:52:58 +08:00
parent 71a8662690
commit 184180e618
50 changed files with 2537 additions and 747 deletions
+24 -1
View File
@@ -9,6 +9,7 @@ import {
type AppInfo,
type BrowserLiveState,
type ContextAttachment,
type ContextFileSelectionProgress,
type DesktopApi,
type KnowledgeLibrary,
type KnowledgeSearchReference,
@@ -27,7 +28,8 @@ import type {
CapabilityDiagnosticReport,
CapabilitySnapshot,
ComputerCapabilityId,
McpServerTestResult
McpServerTestResult,
WebSearchTestResult
} from '../shared/capability-contracts'
import type {
AssistantProject,
@@ -766,6 +768,15 @@ const desktopApi: DesktopApi = {
ipcChannels.capabilitiesTestMcp,
serverId
) as Promise<McpServerTestResult>,
setWebSearchEnabled: (enabled: boolean) =>
ipcRenderer.invoke(
ipcChannels.capabilitiesToggleWebSearch,
enabled
) as Promise<CapabilitySnapshot>,
testWebSearch: () =>
ipcRenderer.invoke(
ipcChannels.capabilitiesTestWebSearch
) as Promise<WebSearchTestResult>,
setComputerCapabilityEnabled: (
capabilityId: ComputerCapabilityId,
enabled: boolean
@@ -811,6 +822,18 @@ const desktopApi: DesktopApi = {
ipcRenderer.invoke(
ipcChannels.contextSelectFiles
) as Promise<ContextAttachment[]>,
onFileSelectionProgress: (listener) => {
const handler = (
_event: Electron.IpcRendererEvent,
progress: ContextFileSelectionProgress
): void => listener(progress)
ipcRenderer.on(ipcChannels.contextFileSelectionProgress, handler)
return () =>
ipcRenderer.removeListener(
ipcChannels.contextFileSelectionProgress,
handler
)
},
addPastedImage: (input: PastedImageInput) =>
ipcRenderer.invoke(
ipcChannels.contextAddPastedImage,
+10
View File
@@ -49,4 +49,14 @@ describe('sandboxed preload', () => {
expect(source).not.toContain('importLocalDirectory:')
expect(source).not.toContain('importOcrModel:')
})
it('exposes a removable attachment parsing progress listener', () => {
const source = readFileSync(
join(process.cwd(), 'src', 'preload', 'index.ts'),
'utf8'
)
expect(source).toContain('onFileSelectionProgress:')
expect(source).toContain('contextFileSelectionProgress')
expect(source).toContain('ipcRenderer.removeListener(')
})
})