fix: streamline document parsing settings

This commit is contained in:
lofyer
2026-08-13 00:08:15 +08:00
parent d33df979da
commit 86b63406c2
21 changed files with 1160 additions and 509 deletions
+5 -3
View File
@@ -85,7 +85,8 @@ import type {
DocumentOcrResult,
DocumentParsingDiagnostic,
DocumentParsingSettings,
DocumentParsingSnapshot
DocumentParsingSnapshot,
DocumentParsingTestPurpose
} from '../shared/document-parsing-contracts'
import type { AgentRuntimeSelection } from '../shared/runtime-selection-contracts'
import type { WeixinBindingSnapshot } from '../shared/weixin-channel-contracts'
@@ -435,9 +436,10 @@ const desktopApi: DesktopApi = {
ipcChannels.documentParsingUpdate,
input
) as Promise<DocumentParsingSnapshot>,
test: () =>
test: (purpose: DocumentParsingTestPurpose) =>
ipcRenderer.invoke(
ipcChannels.documentParsingTest
ipcChannels.documentParsingTest,
{ purpose }
) as Promise<DocumentParsingDiagnostic | undefined>,
installOcrModel: (modelId: string) =>
ipcRenderer.invoke(
+13
View File
@@ -50,6 +50,19 @@ describe('sandboxed preload', () => {
expect(source).not.toContain('importOcrModel:')
})
it('passes an explicit parsing scenario to document diagnostics', () => {
const source = readFileSync(
join(process.cwd(), 'src', 'preload', 'index.ts'),
'utf8'
)
expect(source).toContain(
'test: (purpose: DocumentParsingTestPurpose)'
)
expect(source).toContain(
'ipcChannels.documentParsingTest,\n { purpose }'
)
})
it('exposes a removable attachment parsing progress listener', () => {
const source = readFileSync(
join(process.cwd(), 'src', 'preload', 'index.ts'),