Skip to content

Commit 56e523f

Browse files
committed
Fix image support for claude
1 parent 4d92170 commit 56e523f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

web/src/lib/llm/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export function getLLMProviderOverrideForPersona(
6363
}
6464

6565
const MODEL_NAMES_SUPPORTING_IMAGE_INPUT = [
66+
"gpt-4.1",
6667
"gpt-4o",
6768
"gpt-4o-mini",
6869
"gpt-4-vision-preview",
@@ -125,12 +126,22 @@ export function checkLLMSupportsImageInput(model: string) {
125126
const modelParts = model.split(/[/.]/);
126127
const lastPart = modelParts[modelParts.length - 1]?.toLowerCase();
127128

128-
return MODEL_NAMES_SUPPORTING_IMAGE_INPUT.some((modelName) => {
129+
const partialMatch = MODEL_NAMES_SUPPORTING_IMAGE_INPUT.some((modelName) => {
129130
const modelNameParts = modelName.split(/[/.]/);
130131
const modelNameLastPart = modelNameParts[modelNameParts.length - 1];
131132
// lastPart is already lowercased above for tiny performance gain
132133
return modelNameLastPart?.toLowerCase() === lastPart;
133134
});
135+
if (partialMatch) {
136+
return true;
137+
}
138+
139+
// all claude models support image input
140+
if (model.toLowerCase().includes("claude")) {
141+
return true;
142+
}
143+
144+
return false;
134145
}
135146

136147
export const structureValue = (

0 commit comments

Comments
 (0)