From a4c54cae60820a8a026481b91a11a9e7a842699c Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Fri, 15 Mar 2024 09:33:21 +0700 Subject: [PATCH 1/2] Improve [Utils] Check Vision Model - [+] refactor(utils.ts): improve isVisionModel function to use array.some instead of model.includes --- app/utils.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 8b755afeac1f..b4fc1980ce35 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -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)); } From 028957fcdcb0ec8860622237fc0923a67445c38a Mon Sep 17 00:00:00 2001 From: Raax Date: Sat, 16 Mar 2024 21:55:16 +0800 Subject: [PATCH 2/2] Fix "Enter" bug Fix Chinese input method "Enter" on Safari --- app/components/chat.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index bcd0e605df2a..b9750f2851db 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -219,6 +219,8 @@ function useSubmitHandler() { }, []); const shouldSubmit = (e: React.KeyboardEvent) => { + // 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;