fix: avoid image models in analyzer vision path
This commit is contained in:
parent
c1fea459cd
commit
8357e69820
@ -1325,6 +1325,7 @@ function isLikelyVisionCapableModel(modelWithProvider: {
|
||||
isEnabled: boolean;
|
||||
isSubModel: boolean;
|
||||
supportsVision?: boolean;
|
||||
supportsImageGen?: boolean;
|
||||
displayName?: string | null;
|
||||
modelId?: string | null;
|
||||
capabilities?: unknown;
|
||||
@ -1337,11 +1338,21 @@ function isLikelyVisionCapableModel(modelWithProvider: {
|
||||
const model = modelWithProvider.model;
|
||||
const providerType = String(modelWithProvider.provider?.type || "");
|
||||
if (!model?.isEnabled || model.isSubModel) return false;
|
||||
const modelText = `${model.displayName || ""} ${model.modelId || ""}`.toLowerCase();
|
||||
const likelyImageGenerationOnly =
|
||||
!model.supportsVision &&
|
||||
Boolean(model.supportsImageGen) &&
|
||||
((["custom", "openai", "local"].includes(providerType) &&
|
||||
/(doubao[-_.]?seed[-_.]?2[-_.]?0|seed[-_.]?2[-_.]?0|seedream|gpt[-_.]?image|nano[-_.]?banana|flux|imagen|image[-_.]?edit)/i.test(
|
||||
modelText,
|
||||
)) ||
|
||||
["gemini", "huanke-gemini", "alibaba-image", "ruxa-image", "fal-image"].includes(
|
||||
providerType,
|
||||
));
|
||||
if (likelyImageGenerationOnly) return false;
|
||||
if (model.supportsVision) return true;
|
||||
if (isAiModelMultimodal(model)) return true;
|
||||
|
||||
const modelText = `${model.displayName || ""} ${model.modelId || ""}`.toLowerCase();
|
||||
|
||||
if (providerType === "volcano-vision" || providerType === "volcano-multimodal") return true;
|
||||
|
||||
if (
|
||||
@ -1575,9 +1586,7 @@ async function analyzWithLLM(
|
||||
const selectedAnalyzerModel = hasImage
|
||||
? multimodalAgentVisionModel ||
|
||||
preferredVisionModel ||
|
||||
analyzerVisionCandidates[0] ||
|
||||
usableAgentModel ||
|
||||
analyzerTextCandidates[0]
|
||||
analyzerVisionCandidates[0]
|
||||
: usableAgentModel ||
|
||||
analyzerTextCandidates.find((m) => m.provider.type === "zhipu" && !m.model.isSubModel) ||
|
||||
analyzerTextCandidates[0];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user