fix: rename h5 execution override to deep reasoning

This commit is contained in:
john
2026-07-04 14:57:13 +08:00
parent 12268110f7
commit e4657c7e55
13 changed files with 79 additions and 73 deletions
+7 -7
View File
@@ -3,7 +3,7 @@ import type { MindSpaceChatContext } from '../types';
export type AgentRunCreateOptions = {
toolMode?: 'chat' | 'code';
taskType?: string | null;
forceGoose?: boolean;
forceDeepReasoning?: boolean;
validation?: AgentRunValidation | null;
validationInstruction?: string | null;
};
@@ -53,7 +53,7 @@ const CODE_TASK_PATTERNS = [
/(代码|仓库|项目|文件|组件|接口).{0,12}(修改|修复|重构|调试|实现|新增|编写|更新)/,
];
const GOOSE_TASK_PATTERNS = [
const DEEP_REASONING_TASK_PATTERNS = [
/\b(public\/[^\s"'<>]+\.html)\b/i,
/\b(html|h5|web\s?page|landing\s?page|microsite|docx|word)\b/i,
/\b(write|create|generate|publish|download|export|save|edit)\b.{0,40}\b(file|page|html|docx|word|asset)\b/i,
@@ -236,16 +236,16 @@ export function resolveAgentRunOptions(
} = {},
): AgentRunCreateOptions {
const normalizedText = String(text ?? '').trim();
const shouldForceGoose =
forceCode || GOOSE_TASK_PATTERNS.some((pattern) => pattern.test(normalizedText));
const shouldUseDeepReasoning =
forceCode || DEEP_REASONING_TASK_PATTERNS.some((pattern) => pattern.test(normalizedText));
if (!agentCodeRunsEnabledForUser(userId)) {
return shouldForceGoose ? { forceGoose: true, taskType } : {};
return shouldUseDeepReasoning ? { forceDeepReasoning: true, taskType } : {};
}
const shouldUseCode = forceCode || (allowAutodetect && CODE_TASK_PATTERNS.some((pattern) => pattern.test(normalizedText)));
if (!shouldUseCode) {
return shouldForceGoose ? { forceGoose: true, taskType } : {};
return shouldUseDeepReasoning ? { forceDeepReasoning: true, taskType } : {};
}
const normalizedRequestId = requestId ?? crypto.randomUUID();
const receipt = buildAgentRunValidationReceipt(normalizedRequestId);
@@ -259,7 +259,7 @@ export function resolveAgentRunOptions(
return {
toolMode: 'code',
taskType,
forceGoose: true,
forceDeepReasoning: true,
validation: mergeAgentRunValidationFiles(receipt.validation, taskValidation.validation),
validationInstruction: `${receipt.instruction}${taskValidation.instruction}`,
};