Merge pull request #4306 from H0llyW00dzZ/simplify-cherry-pick

[Cherry Pick] Improve [Utils] Check Vision Model
This commit is contained in:
fred-bf 2024-03-19 17:45:57 +08:00 committed by GitHub
commit 3ba984d09e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

View File

@ -292,9 +292,11 @@ export function getMessageImages(message: RequestMessage): string[] {
} }
export function isVisionModel(model: string) { export function isVisionModel(model: string) {
return ( // Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using)
// model.startsWith("gpt-4-vision") || const visionKeywords = [
// model.startsWith("gemini-pro-vision") || "vision",
model.includes("vision") "claude-3",
); ];
return visionKeywords.some(keyword => model.includes(keyword));
} }