From ef5f910f196fb534a8e7ff75a8c510cafb8c5713 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Mon, 13 May 2024 17:28:13 -0400 Subject: [PATCH 1/6] support gpt-4o --- app/constant.ts | 6 +++++- app/utils.ts | 11 ++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/constant.ts b/app/constant.ts index a3d9c206f..0d37a420b 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -127,6 +127,8 @@ export const KnowledgeCutOffDate: Record = { "gpt-4-turbo": "2023-12", "gpt-4-turbo-2024-04-09": "2023-12", "gpt-4-turbo-preview": "2023-12", + "gpt-4o": "2023-10", + "gpt-4o-2024-05-13": "2023-10", "gpt-4-vision-preview": "2023-04", // After improvements, // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously. @@ -144,8 +146,10 @@ const openaiModels = [ "gpt-4-32k-0613", "gpt-4-turbo", "gpt-4-turbo-preview", + "gpt-4o", + "gpt-4o-2024-05-13", "gpt-4-vision-preview", - "gpt-4-turbo-2024-04-09", + "gpt-4-turbo-2024-04-09" ]; const googleModels = [ diff --git a/app/utils.ts b/app/utils.ts index 07d0dcb13..efcc8c197 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -290,16 +290,13 @@ export function getMessageImages(message: RequestMessage): string[] { } export function isVisionModel(model: string) { - - // 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", "gemini-1.5-pro", + "gpt-4-turbo", + "gpt-4o", ]; - const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview"); - - return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo; -} + return visionKeywords.some((keyword) => model.includes(keyword)); +} \ No newline at end of file From 5df8b1d183ffc657b44f51d280d994da672f1103 Mon Sep 17 00:00:00 2001 From: fred-bf <157469842+fred-bf@users.noreply.github.com> Date: Tue, 14 May 2024 14:32:34 +0800 Subject: [PATCH 2/6] fix: revert gpt-4-turbo-preview detection --- app/utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index efcc8c197..d67346a23 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -297,6 +297,10 @@ export function isVisionModel(model: string) { "gpt-4-turbo", "gpt-4o", ]; + const isGpt4TurboPreview = model === "gpt-4-turbo-preview"; - return visionKeywords.some((keyword) => model.includes(keyword)); -} \ No newline at end of file + return ( + visionKeywords.some((keyword) => model.includes(keyword)) && + !isGpt4TurboPreview + ); +} From 3a007e4f3d8d0ac7be8a8bf08f962101589b1e3c Mon Sep 17 00:00:00 2001 From: fred-bf <157469842+fred-bf@users.noreply.github.com> Date: Tue, 14 May 2024 17:35:58 +0800 Subject: [PATCH 3/6] feat: bump version --- src-tauri/tauri.conf.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7b00ac17c..ee87d8d15 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "NextChat", - "version": "2.12.2" + "version": "2.12.3" }, "tauri": { "allowlist": { @@ -112,4 +112,4 @@ } ] } -} \ No newline at end of file +} From 6612550c064a68dbc8772c182228d7428b562fd7 Mon Sep 17 00:00:00 2001 From: Fred Date: Wed, 15 May 2024 15:29:38 +0800 Subject: [PATCH 4/6] feat: support gemini flash --- app/constant.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/constant.ts b/app/constant.ts index a3d9c206f..5047ad1d1 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -151,6 +151,7 @@ const openaiModels = [ const googleModels = [ "gemini-1.0-pro", "gemini-1.5-pro-latest", + "gemini-1.5-flash-latest", "gemini-pro-vision", ]; From 4789a7f6a93cb7c271755a201d04523de246bbec Mon Sep 17 00:00:00 2001 From: Fred Date: Wed, 15 May 2024 15:42:06 +0800 Subject: [PATCH 5/6] feat: add gemini flash into vision model list --- app/utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 07d0dcb13..0007e2b61 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -290,16 +290,19 @@ export function getMessageImages(message: RequestMessage): string[] { } export function isVisionModel(model: string) { - // 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", "gemini-1.5-pro", + "gemini-1.5-flash", ]; - const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview"); + const isGpt4Turbo = + model.includes("gpt-4-turbo") && !model.includes("preview"); - return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo; + return ( + visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo + ); } From 8688842984370479b588bc87b7e3956ae56cd759 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 15 May 2024 17:53:27 -0400 Subject: [PATCH 6/6] gpt-4o as vision model https://platform.openai.com/docs/guides/vision --- app/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/utils.ts b/app/utils.ts index 0b01b91f1..64e3c5406 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -297,6 +297,7 @@ export function isVisionModel(model: string) { "claude-3", "gemini-1.5-pro", "gemini-1.5-flash", + "gpt-4o", ]; const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview");