fix: 子任务拆解条件更合理——有附件或内容过长时跳过

- 有图片/视频时跳过(图文消息不适合拆解)
- 内容 <50 或 >2000 字符时跳过(太短没意义,太长是文件内容)
This commit is contained in:
thzxx
2026-06-18 14:25:40 +08:00
parent d28f39d3aa
commit 400c641f3d
+4 -4
View File
@@ -566,13 +566,13 @@ Shell: ${osInfo.shell}
};
messages.push(userMsg);
// P2-1: 自动子任务拆解 — 检测用户消息中的并行任务关键词
// 排除文件内容(避免把小说/设定集误拆成子任务)
// 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 hasFileContent = userText.includes('📄 文件');
const hasParallel = !hasFileContent && PARALLEL_PATTERNS.test(userText) && userText.length > 100 && userText.length < 5000;
const hasAttachments = (images?.length || 0) > 0;
const hasParallel = !hasAttachments && userText.length > 50 && userText.length < 2000
&& PARALLEL_PATTERNS.test(userText);
if (hasParallel && useTools) {
// 尝试按数字列表拆分子任务