Improve [Utils] Check Vision Model

- [+] refactor(utils.ts): improve isVisionModel function to use array.some instead of model.includes
This commit is contained in:
H0llyW00dzZ 2024-03-15 09:33:21 +07:00
parent cc0eae7153
commit a4c54cae60
No known key found for this signature in database
GPG Key ID: 05C7FFFC0845C930
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) {
return (
// model.startsWith("gpt-4-vision") ||
// model.startsWith("gemini-pro-vision") ||
model.includes("vision")
);
// Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using)
const visionKeywords = [
"vision",
"claude-3",
];
return visionKeywords.some(keyword => model.includes(keyword));
}