fix(image): fall back to text when configured OpenRouter input list is empty
When a model has an explicitly configured but empty input array, the filter returns an empty array, leaving the model with no supported modalities. Apply the same empty-array guard used by the non-OpenRouter fallback path, defaulting to ["text"] when the filtered result is empty.
This commit is contained in:
parent
e39a8515f2
commit
2ce93382dd
@ -317,11 +317,15 @@ export function resolveModelWithRegistry(params: {
|
||||
const configuredOpenRouterModel = providerConfig?.models?.find(
|
||||
(candidate) => candidate.id === modelId,
|
||||
);
|
||||
const resolvedInput: Array<"text" | "image"> = configuredOpenRouterModel?.input
|
||||
const configuredInput = configuredOpenRouterModel?.input
|
||||
? configuredOpenRouterModel.input.filter((item) => item === "text" || item === "image")
|
||||
: isLikelyVisionModel(modelId)
|
||||
? ["text", "image"]
|
||||
: ["text"];
|
||||
: undefined;
|
||||
const resolvedInput: Array<"text" | "image"> =
|
||||
configuredInput && configuredInput.length > 0
|
||||
? configuredInput
|
||||
: isLikelyVisionModel(modelId)
|
||||
? ["text", "image"]
|
||||
: ["text"];
|
||||
|
||||
const providerHeaders = sanitizeModelHeaders(providerConfig?.headers, {
|
||||
stripSecretRefMarkers: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user