diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index fa276d9e6..cf4498ba4 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -296,18 +296,15 @@ function injectOptimizedPromptSection(params: { return message.replace(optimizedSectionRegex, optimizedPromptSection); } - const outputSectionRegex = /(?:###\s*输出设置|【\s*输出设置\s*】)/; - if (outputSectionRegex.test(message)) { - return message.replace(outputSectionRegex, `${optimizedPromptSection}\n$&`); - } - const executionSectionRegex = /(?:###\s*执行计划|【\s*执行计划\s*】)[\s\S]*?(?=\n(?:###\s*|【\s*[^】]+\s*】)|$)/; if (executionSectionRegex.test(message)) { - return message.replace(executionSectionRegex, (matchedSection) => { - const trimmedSection = matchedSection.replace(/\s+$/, ""); - return `${trimmedSection}\n${optimizedPromptSection}`; - }); + return message.replace(executionSectionRegex, optimizedPromptSection); + } + + const outputSectionRegex = /(?:###\s*输出设置|【\s*输出设置\s*】)/; + if (outputSectionRegex.test(message)) { + return message.replace(outputSectionRegex, `${optimizedPromptSection}\n$&`); } return `${message.trim()}\n\n${optimizedPromptSection}`; diff --git a/lib/ai/auto-agent-graph.ts b/lib/ai/auto-agent-graph.ts index d8fb4ad44..0ebf6a0b1 100644 --- a/lib/ai/auto-agent-graph.ts +++ b/lib/ai/auto-agent-graph.ts @@ -1902,10 +1902,6 @@ const optimizeNode = async (state: AutoAgentStateType) => { videoPlan, }; } - if (state.execution.mode === "edit_image" && !state.analysis.subIntent) { - const recommendedImageParams = heuristicImageParams(state.text, state.analysis); - return { recommendedImageParams }; - } if (!state.execution.shouldApplyImagePipeline) { return {}; }