fix: 子任务拆解排除文件内容,避免把设定集误拆成89个并行子任务

- 检测 📄 文件 标记时跳过子任务拆解
- 限制拆解只在内容 <5000 字符时触发
This commit is contained in:
thzxx
2026-06-18 14:22:21 +08:00
parent e81d355c68
commit d28f39d3aa
+3 -1
View File
@@ -567,10 +567,12 @@ Shell: ${osInfo.shell}
messages.push(userMsg); messages.push(userMsg);
// P2-1: 自动子任务拆解 — 检测用户消息中的并行任务关键词 // P2-1: 自动子任务拆解 — 检测用户消息中的并行任务关键词
// 排除文件内容(避免把小说/设定集误拆成子任务)
const PARALLEL_PATTERNS = /同时|分别|以及|另外|此外|并且|也|also|and\s+also|separately|in\s+addition|meanwhile/i; const PARALLEL_PATTERNS = /同时|分别|以及|另外|此外|并且|也|also|and\s+also|separately|in\s+addition|meanwhile/i;
const SUBTASK_SEPARATORS = /(?:^|\n)\s*(?:[1-9][.、)]|[-*•]\s+)/; const SUBTASK_SEPARATORS = /(?:^|\n)\s*(?:[1-9][.、)]|[-*•]\s+)/;
const userText = userContent || ''; 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) { if (hasParallel && useTools) {
// 尝试按数字列表拆分子任务 // 尝试按数字列表拆分子任务