diff --git a/src/web/static/js/config.js b/src/web/static/js/config.js index 5341623..4c7f45f 100644 --- a/src/web/static/js/config.js +++ b/src/web/static/js/config.js @@ -17,34 +17,33 @@ export const CONFIG_FIELDS = { /** * 静默检查:仅当配置完整且有文件时自动开始处理。 + * 注意:上传文件后不再自动触发,需要用户发送"可以开始"等指令。 */ export function checkAutoStart() { if (App.isProcessing) return; if (App.processState === 'processing') return; - if (App.processState === 'done') { + // done 状态下有新文件时,走 supplement 流程(手动触发) + if (App.processState === 'done' && App.forceStart) { const hasNewFiles = App.allFiles.length > App.lastProcessedFileCount; - if (!hasNewFiles && !App.forceStart) return; + if (!hasNewFiles) return; App.forceStart = false; - // done 状态下有新文件时,走 supplement 流程 - if (hasNewFiles) { - App.isProcessing = true; - App.processState = 'processing'; - if (App.newFilenames.length > 0) { - const filenames = App.newFilenames; - App.newFilenames = []; - handleSupplementUpload(filenames); - } - return; + App.isProcessing = true; + App.processState = 'processing'; + if (App.newFilenames.length > 0) { + const filenames = App.newFilenames; + App.newFilenames = []; + handleSupplementUpload(filenames); } + return; } - + // awaiting_supplement 状态下不自动处理,等待用户补充文件后手动触发 if (App.processState === 'awaiting_supplement') { return; } - // idle 状态下有补充文件时,走 supplement 流程 + // idle 状态下有补充文件时,走 supplement 流程(手动触发) if (App.processState === 'idle' && App.newFilenames.length > 0) { App.isProcessing = true; App.processState = 'processing'; @@ -54,16 +53,7 @@ export function checkAutoStart() { return; } - const allKeys = Object.keys(CONFIG_FIELDS); - const missing = allKeys.filter(k => !App.sessionConfig[k]); - - if (missing.length) return; - - App.pendingConfigKey = null; - - if (!App.allFiles.length) return; - - startProcess(); + // 不再自动开始处理,需要用户发送"可以开始"等指令 } /** @@ -89,8 +79,7 @@ export function promptMissingConfig() { App.pendingConfigKey = null; if (App.allFiles.length) { - showStatus('配置信息已完整,开始处理发票……'); - startProcess(); + showStatus('配置信息已完整,请发送"可以开始"或"处理发票"来启动处理流程'); } } @@ -116,6 +105,12 @@ export async function sendUserMessage() { addChatMessage(text, 'user', true); input.value = ''; + // 检查是否是开始处理指令(如"可以开始"、"处理发票"等) + if (text.includes('可以开始') || text.includes('开始处理') || text.includes('处理发票') || text.includes('开始')) { + startProcess(); + return; + } + // 检查是否是强制提交指令 if (text.includes('直接提交') || text.includes('强制提交') || text.includes('继续提交')) { await handleForceSubmit(); @@ -134,7 +129,7 @@ export async function sendUserMessage() { return; } - showStatus('请通过上传区补充文件,或输入"直接提交"跳过校验'); + showStatus('请发送"可以开始"或"处理发票"来启动处理流程'); } export function handleChatKey(event) { diff --git a/src/web/static/js/sync.js b/src/web/static/js/sync.js index 3ff8b48..6f2bbc1 100644 --- a/src/web/static/js/sync.js +++ b/src/web/static/js/sync.js @@ -72,7 +72,5 @@ async function syncFiles() { } else { document.getElementById('file-zone').classList.remove('active'); } - - checkAutoStart(); } catch (e) { /* ignore */ } } \ No newline at end of file diff --git a/src/web/static/js/upload.js b/src/web/static/js/upload.js index a7ca73d..8a8135f 100644 --- a/src/web/static/js/upload.js +++ b/src/web/static/js/upload.js @@ -20,7 +20,6 @@ export async function handleFiles(input) { await _uploadNewFiles(result.newFilenames); App.newFilenames = result.newFilenames; App.processState = 'idle'; - checkAutoStart(); return; } @@ -106,13 +105,12 @@ export function initDragDrop() { App.processState = 'idle'; } - // 在 awaiting_supplement 状态下,只上传新文件并走 supplement 流程 + // 在 awaiting_supplement 状态下,只上传新文件并走 supplement 流程(手动触发) if (result.hasNewFiles && App.processState === 'awaiting_supplement') { hideAgentRequest(); await _uploadNewFiles(result.newFilenames); App.newFilenames = result.newFilenames; App.processState = 'idle'; - checkAutoStart(); return; } diff --git a/src/web/templates/index.html b/src/web/templates/index.html index 47dcfe4..859a93d 100644 --- a/src/web/templates/index.html +++ b/src/web/templates/index.html @@ -16,7 +16,7 @@