fix: fast-path prompt-only image analysis
This commit is contained in:
parent
5d3c7c1cdc
commit
ea561418c4
@ -123,6 +123,7 @@ import type {
|
||||
} from "@/lib/ai/context-memory/types";
|
||||
import { ChatSDKError } from "@/lib/errors";
|
||||
import { extractImageUrlsFromText } from "@/lib/image-url";
|
||||
import { isExplicitPromptOptimizationRequest } from "@/lib/ai/smart-analyzer";
|
||||
import {
|
||||
resolveClarificationBypass,
|
||||
resolveClarificationMessage,
|
||||
@ -3286,8 +3287,37 @@ export async function POST(request: Request) {
|
||||
}
|
||||
}
|
||||
|
||||
const shouldFastTrackPromptOnly =
|
||||
shouldRunAgentConversation && isExplicitPromptOptimizationRequest(requestTextContent);
|
||||
if (shouldFastTrackPromptOnly) {
|
||||
if (!requestResolvedMediaInput) {
|
||||
requestResolvedMediaInput = resolveChatMediaInput({
|
||||
messageParts: message.parts as any[],
|
||||
historyMessages: [],
|
||||
contextPayload: contextPayload || undefined,
|
||||
requestOrigin,
|
||||
maxImages: 4,
|
||||
});
|
||||
}
|
||||
|
||||
if (!requestTargetResolution) {
|
||||
requestTargetResolution = resolveTargetAssets({
|
||||
text: requestTextContent,
|
||||
mediaInput: requestResolvedMediaInput,
|
||||
contextPayload: contextPayload || undefined,
|
||||
workingState: requestWorkingState || undefined,
|
||||
});
|
||||
}
|
||||
|
||||
smartAutoDetectedIntent = "vision";
|
||||
smartAutoNeedsClarification = false;
|
||||
smartAutoFriendlyMessage =
|
||||
"收到,我先分析这张图并整理可直接使用的提示词,不会直接生图。";
|
||||
console.log("[Smart Auto Mode] ✍️ Fast-path prompt-only request, skip heavy auto-agent workflow");
|
||||
}
|
||||
|
||||
// ========== Smart Auto Mode Logic ==========
|
||||
if (shouldRunAgentConversation) {
|
||||
if (shouldRunAgentConversation && !shouldFastTrackPromptOnly) {
|
||||
console.log("[Smart Auto Mode] 🚀 Starting intelligent analysis...");
|
||||
let autoTextForFallback = "";
|
||||
let autoFromHistoryForFallback = false;
|
||||
@ -4658,9 +4688,7 @@ export async function POST(request: Request) {
|
||||
shouldRunAgentConversation &&
|
||||
!smartAutoNeedsClarification &&
|
||||
promptOnlySourceImageUrls.length > 0 &&
|
||||
(
|
||||
await import("@/lib/ai/smart-analyzer")
|
||||
).isExplicitPromptOptimizationRequest(requestTextContent);
|
||||
isExplicitPromptOptimizationRequest(requestTextContent);
|
||||
|
||||
if (wantsPromptOnlyFromImageContext) {
|
||||
let promptOnlyImageSummary = "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user