feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)
This commit is contained in:
parent
f49acf0105
commit
10af20a0ad
157 changed files with 29455 additions and 913 deletions
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { ipcMain, dialog } from 'electron'
|
||||
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
|
||||
import { ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
|
||||
import { D3ROError, ErrorCode, ipcSuccess, ipcError } from '@d3ro/core/errors'
|
||||
import { getRAGService } from '../services/RAGService'
|
||||
import { getLogger } from '../services/LoggerService'
|
||||
import type { RAGQueryParams, RAGRemoveDocumentParams } from '@d3ro/core/types'
|
||||
|
|
@ -18,7 +18,10 @@ export function registerRAGHandlers(): void {
|
|||
let filePath = params?.filePath
|
||||
if (!filePath) {
|
||||
if (isShowingRagDialog) {
|
||||
return ipcError(ErrorCode.RAGDocumentNotFound, 'File selection dialog already active')
|
||||
return ipcError(ErrorCode.RAGDocumentNotFound, 'File selection dialog already active', {
|
||||
cancelled: true,
|
||||
reason: 'dialog_active',
|
||||
})
|
||||
}
|
||||
isShowingRagDialog = true
|
||||
try {
|
||||
|
|
@ -32,7 +35,10 @@ export function registerRAGHandlers(): void {
|
|||
? await dialog.showOpenDialog(mainWindow, dialogOptions)
|
||||
: await dialog.showOpenDialog(dialogOptions)
|
||||
if (result.canceled || result.filePaths.length === 0) {
|
||||
return ipcError(ErrorCode.RAGDocumentNotFound, 'File selection cancelled')
|
||||
return ipcError(ErrorCode.RAGDocumentNotFound, 'File selection cancelled', {
|
||||
cancelled: true,
|
||||
reason: 'dialog_cancelled',
|
||||
})
|
||||
}
|
||||
filePath = result.filePaths[0]
|
||||
} finally {
|
||||
|
|
@ -43,8 +49,10 @@ export function registerRAGHandlers(): void {
|
|||
return ipcSuccess(doc)
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
const code = err instanceof D3ROError ? err.code : ErrorCode.RAGIndexingFailed
|
||||
const details = err instanceof D3ROError ? err.details : undefined
|
||||
logger.error('RAG add document failed:', msg)
|
||||
return ipcError(ErrorCode.RAGIndexingFailed, msg)
|
||||
return ipcError(code, msg, details)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -54,7 +62,8 @@ export function registerRAGHandlers(): void {
|
|||
return ipcSuccess(undefined)
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
return ipcError(ErrorCode.RAGDocumentNotFound, msg)
|
||||
const code = err instanceof D3ROError ? err.code : ErrorCode.RAGDocumentNotFound
|
||||
return ipcError(code, msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -73,8 +82,9 @@ export function registerRAGHandlers(): void {
|
|||
return ipcSuccess(result)
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
const code = err instanceof D3ROError ? err.code : ErrorCode.RAGQueryFailed
|
||||
logger.error('RAG query failed:', msg)
|
||||
return ipcError(ErrorCode.RAGQueryFailed, msg)
|
||||
return ipcError(code, msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -93,7 +103,9 @@ export function registerRAGHandlers(): void {
|
|||
return ipcSuccess(undefined)
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
return ipcError(ErrorCode.RAGIndexingFailed, msg)
|
||||
const code = err instanceof D3ROError ? err.code : ErrorCode.RAGIndexingFailed
|
||||
const details = err instanceof D3ROError ? err.details : undefined
|
||||
return ipcError(code, msg, details)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue