fix(agent): fallback to qwen3-vl when primary returns non-json
This commit is contained in:
parent
9e69e9e1fe
commit
c43f6a95fc
@ -1353,6 +1353,22 @@ ${historyText}
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { text: responseText } = await generateText(requestPayload as any);
|
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);
|
const parsed = parseAnalysisResultFromModelText(responseText, text, hasImage);
|
||||||
if (parsed) return parsed;
|
if (parsed) return parsed;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user