Merge branch 'ChatGPTNextWeb:main' into main

This commit is contained in:
sijinhui 2024-03-20 22:52:09 +08:00 committed by GitHub
commit f3faa17f9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -225,6 +225,8 @@ function useSubmitHandler() {
}, []);
const shouldSubmit = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
// Fix Chinese input method "Enter" on Safari
if (e.keyCode == 229) return false;
if (e.key !== "Enter") return false;
if (e.key === "Enter" && (e.nativeEvent.isComposing || isComposing.current))
return false;

View File

@ -291,9 +291,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));
}