From 27ed57a6481e4209ee0e536805f86553763a6c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E4=BA=91=E7=99=BD=E5=9C=9F?= Date: Thu, 28 Mar 2024 15:49:49 +0800 Subject: [PATCH 1/4] Update utils.ts --- app/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/utils.ts b/app/utils.ts index b4fc1980ce3..6fce5bccee8 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -296,6 +296,7 @@ export function isVisionModel(model: string) { const visionKeywords = [ "vision", "claude-3", + "gemini-1.5-pro", ]; return visionKeywords.some(keyword => model.includes(keyword)); From cd30368da9f41b30b03b9077d65dae82e5c5e74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E4=BA=91=E7=99=BD=E5=9C=9F?= Date: Thu, 28 Mar 2024 15:51:06 +0800 Subject: [PATCH 2/4] Update constant.ts --- app/constant.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/constant.ts b/app/constant.ts index 9041706874f..6ef475bf32d 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -25,6 +25,7 @@ export enum Path { export enum ApiPath { Cors = "", OpenAI = "/api/openai", + Google = "/api/google", } export enum SlotID { @@ -87,10 +88,8 @@ export const Azure = { export const Google = { ExampleEndpoint: "https://generativelanguage.googleapis.com/", - ChatPath: "v1beta/models/gemini-pro:generateContent", - VisionChatPath: "v1beta/models/gemini-pro-vision:generateContent", - - // /api/openai/v1/chat/completions + ChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`, + VisionChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`, }; export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang @@ -115,6 +114,7 @@ export const KnowledgeCutOffDate: Record = { // After improvements, // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously. "gemini-pro": "2023-12", + "gemini-pro-vision": "2023-12", }; export const DEFAULT_MODELS = [ @@ -272,7 +272,16 @@ export const DEFAULT_MODELS = [ }, }, { - name: "gemini-pro", + name: "gemini-1.0-pro", + available: true, + provider: { + id: "google", + providerName: "Google", + providerType: "google", + }, + }, + { + name: "gemini-1.5-pro-latest", available: true, provider: { id: "google", From f8b180ac4418286c5149a72f32b9f6eb96ae33fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E4=BA=91=E7=99=BD=E5=9C=9F?= Date: Thu, 28 Mar 2024 15:52:38 +0800 Subject: [PATCH 3/4] Update google.ts --- app/client/platforms/google.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/platforms/google.ts b/app/client/platforms/google.ts index 848e5cd3f0d..3a814b90328 100644 --- a/app/client/platforms/google.ts +++ b/app/client/platforms/google.ts @@ -112,8 +112,8 @@ export class GeminiProApi implements LLMApi { options.onController?.(controller); try { let googleChatPath = visionModel - ? Google.VisionChatPath - : Google.ChatPath; + ? Google.VisionChatPath(modelConfig.model) + : Google.ChatPath(modelConfig.model); let chatPath = this.path(googleChatPath); // let baseUrl = accessStore.googleUrl; From 4d0c77b9736c23ddbd61fa7f7f6b6ed2cb27b6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E4=BA=91=E7=99=BD=E5=9C=9F?= Date: Thu, 28 Mar 2024 21:42:45 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20constant.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/constant.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app/constant.ts b/app/constant.ts index 6ef475bf32d..99534f26b0f 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -25,7 +25,6 @@ export enum Path { export enum ApiPath { Cors = "", OpenAI = "/api/openai", - Google = "/api/google", } export enum SlotID {