diff --git a/src/renderer/services/agent-engine.ts b/src/renderer/services/agent-engine.ts index 8a1a84a..36b2072 100644 --- a/src/renderer/services/agent-engine.ts +++ b/src/renderer/services/agent-engine.ts @@ -567,10 +567,12 @@ Shell: ${osInfo.shell} messages.push(userMsg); // P2-1: 自动子任务拆解 — 检测用户消息中的并行任务关键词 + // 排除文件内容(避免把小说/设定集误拆成子任务) const PARALLEL_PATTERNS = /同时|分别|以及|另外|此外|并且|也|also|and\s+also|separately|in\s+addition|meanwhile/i; const SUBTASK_SEPARATORS = /(?:^|\n)\s*(?:[1-9][.、)]|[-*•]\s+)/; const userText = userContent || ''; - const hasParallel = PARALLEL_PATTERNS.test(userText) && userText.length > 100; + const hasFileContent = userText.includes('📄 文件'); + const hasParallel = !hasFileContent && PARALLEL_PATTERNS.test(userText) && userText.length > 100 && userText.length < 5000; if (hasParallel && useTools) { // 尝试按数字列表拆分子任务