fix(agent): fallback to qwen3-vl when primary returns non-json
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-02-21 04:44:41 +08:00
parent 9e69e9e1fe
commit c43f6a95fc

View File

@ -1353,6 +1353,22 @@ ${historyText}
try {
const { text: responseText } = await generateText(requestPayload as any);
const hasStructuredJson = /\{[\s\S]*\}/.test(String(responseText || ""));
if (hasImage && !hasStructuredJson) {
console.warn(
"[Smart Analyzer] Primary analyzer returned non-JSON for image input, fallback to hardcoded qwen3-vl",
);
const qwenFallback = await analyzeWithHardcodedQwen3VlFallback({
text,
hasImage,
imageUrls,
historyMessages,
context,
reason: "primary_non_json_response",
});
if (qwenFallback) return qwenFallback;
}
const parsed = parseAnalysisResultFromModelText(responseText, text, hasImage);
if (parsed) return parsed;
} catch (error) {