From e762405cba7d2ccb3d795ca13e60fab0f2b368a6 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:11:56 +0900 Subject: [PATCH 01/10] Update: [index.html] Remove GAI models deleted from the API The 1.0 Pro Vision model has already been removed. ``` Google AI Studio API returned error: 404 Not Found { "error": { "code": 404, "message": "Gemini 1.0 Pro Vision has been deprecated on July 12, 2024. Consider switching to a different model, for example gemini-1.5-flash.", "status": "NOT_FOUND" } } ``` --- public/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/index.html b/public/index.html index 076c7553b..e1640fffa 100644 --- a/public/index.html +++ b/public/index.html @@ -3027,7 +3027,6 @@ - @@ -3052,7 +3051,6 @@ - From df5f69dc66a3e47ad69243a507be1fdc48d39c8b Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:18:05 +0900 Subject: [PATCH 02/10] Update: [index.html] Added notes for deprecated GAI models Based on https://ai.google.dev/gemini-api/docs/models/gemini, the 1.0 Pro model has been marked as deprecated. --- public/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index e1640fffa..5b2e42c2b 100644 --- a/public/index.html +++ b/public/index.html @@ -3025,8 +3025,8 @@ - - + + @@ -3049,8 +3049,8 @@ - - + + From 954ed6c2b2f560f685fad44c82fc2745ef0cbeb9 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:28:37 +0900 Subject: [PATCH 03/10] Update: [index.html] Remove PaLM from GAI models The PaLM family (PaLM 2, PaLM 2 Chat) is no longer available on AI Studio. ``` Google AI Studio API returned error: 404 Not Found { "error": { "code": 404, "message": "Requested entity was not found.", "status": "NOT_FOUND" } ``` --- public/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/index.html b/public/index.html index 5b2e42c2b..3013a50cc 100644 --- a/public/index.html +++ b/public/index.html @@ -3029,8 +3029,6 @@ - - From 58213d0ab012f1038d0b7a35640c6c0193c40d54 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:29:44 +0900 Subject: [PATCH 04/10] Update: [index.html] Fixed inconsistent notation of GAI models Corrected the text from "Experiment" to "Experimental" to align with the terminology used on https://aistudio.google.com/. --- public/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index 3013a50cc..cc68a5c39 100644 --- a/public/index.html +++ b/public/index.html @@ -3031,19 +3031,19 @@ - + - - + + - - - + + + From 9cab0618b67341da05a4a681d53c5347da5bff87 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 12:43:16 +0900 Subject: [PATCH 05/10] Update: [caption/settings.html] Remove GAI version of gemini-pro-vision Retained the OpenRouter version, as it is still available via Vertex. --- public/scripts/extensions/caption/settings.html | 1 - 1 file changed, 1 deletion(-) diff --git a/public/scripts/extensions/caption/settings.html b/public/scripts/extensions/caption/settings.html index 6fdbcb5d6..5a92ba7d8 100644 --- a/public/scripts/extensions/caption/settings.html +++ b/public/scripts/extensions/caption/settings.html @@ -70,7 +70,6 @@ - From 9ea8fc92e464d771bdb058c1bdd35c7d41e6c028 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 13:06:30 +0900 Subject: [PATCH 06/10] Update: [openai.js] Remove deleted GAI models from context length checks Removed gemini-pro-vision and text-bison-001 (PaLM) from context length checks. --- public/scripts/openai.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 6f695ae3b..1f2fe73d5 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -4087,13 +4087,8 @@ async function onModelChange() { $('#openai_max_context').attr('max', max_2mil); } else if (value.includes('gemini-1.5-flash') || value.includes('gemini-2.0-flash-exp')) { $('#openai_max_context').attr('max', max_1mil); - } else if (value.includes('gemini-1.0-pro-vision') || value === 'gemini-pro-vision') { - $('#openai_max_context').attr('max', max_16k); } else if (value.includes('gemini-1.0-pro') || value === 'gemini-pro') { $('#openai_max_context').attr('max', max_32k); - } else if (value === 'text-bison-001') { - $('#openai_max_context').attr('max', max_8k); - // The ultra endpoints are possibly dead: } else if (value.includes('gemini-1.0-ultra') || value === 'gemini-ultra') { $('#openai_max_context').attr('max', max_32k); } else { @@ -4776,7 +4771,6 @@ export function isImageInliningSupported() { 'gemini-1.5-pro-002', 'gemini-1.5-pro-exp-0801', 'gemini-1.5-pro-exp-0827', - 'gemini-pro-vision', 'claude-3', 'claude-3-5', 'gpt-4-turbo', From 43feffdfae4ecbf54e12d569cd88a35a9dea9170 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 13:06:48 +0900 Subject: [PATCH 07/10] Update: [chat-completions.js] Update sendMakerSuiteRequest function Removed branching logic for differences in JSON request body between PaLM and Gemini, following the removal of PaLM from Google AI Studio. --- src/endpoints/backends/chat-completions.js | 44 ++-------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/src/endpoints/backends/chat-completions.js b/src/endpoints/backends/chat-completions.js index f30a5163d..53f86a4f9 100644 --- a/src/endpoints/backends/chat-completions.js +++ b/src/endpoints/backends/chat-completions.js @@ -262,9 +262,7 @@ async function sendMakerSuiteRequest(request, response) { } const model = String(request.body.model); - const isGemini = model.includes('gemini'); - const isText = model.includes('text'); - const stream = Boolean(request.body.stream) && isGemini; + const stream = Boolean(request.body.stream); const generationConfig = { stopSequences: request.body.stop, @@ -301,39 +299,7 @@ async function sendMakerSuiteRequest(request, response) { return body; } - function getBisonBody() { - const prompt = isText - ? ({ text: convertTextCompletionPrompt(request.body.messages) }) - : ({ messages: convertGooglePrompt(request.body.messages, model).contents }); - - /** @type {any} Shut the lint up */ - const bisonBody = { - ...generationConfig, - safetySettings: BISON_SAFETY, - candidate_count: 1, // lewgacy spelling - prompt: prompt, - }; - - if (!isText) { - delete bisonBody.stopSequences; - delete bisonBody.maxOutputTokens; - delete bisonBody.safetySettings; - - if (Array.isArray(prompt.messages)) { - for (const msg of prompt.messages) { - msg.author = msg.role; - msg.content = msg.parts[0].text; - delete msg.parts; - delete msg.role; - } - } - } - - delete bisonBody.candidateCount; - return bisonBody; - } - - const body = isGemini ? getGeminiBody() : getBisonBody(); + const body = getGeminiBody(); console.log('Google AI Studio request:', body); try { @@ -343,10 +309,8 @@ async function sendMakerSuiteRequest(request, response) { controller.abort(); }); - const apiVersion = isGemini ? 'v1beta' : 'v1beta2'; - const responseType = isGemini - ? (stream ? 'streamGenerateContent' : 'generateContent') - : (isText ? 'generateText' : 'generateMessage'); + const apiVersion = 'v1beta'; + const responseType = (stream ? 'streamGenerateContent' : 'generateContent'); const generateResponse = await fetch(`${apiUrl.toString().replace(/\/$/, '')}/${apiVersion}/models/${model}:${responseType}?key=${apiKey}${stream ? '&alt=sse' : ''}`, { body: JSON.stringify(body), From d16f5a24f4110ebb0b2c29c9f73ebf32ffdd689c Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Sun, 15 Dec 2024 13:07:02 +0900 Subject: [PATCH 08/10] Update: [prompt-converters.js] Remove gemini-pro-vision from constants Removed gemini-pro-vision from visionSupportedModels. Also removed dummyRequiredModels as Gemini Pro, its cause, has been deleted. --- src/prompt-converters.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/prompt-converters.js b/src/prompt-converters.js index c23dd6a69..0d4c5df7b 100644 --- a/src/prompt-converters.js +++ b/src/prompt-converters.js @@ -355,13 +355,6 @@ export function convertGooglePrompt(messages, model, useSysPrompt = false, charN 'gemini-1.5-pro-002', 'gemini-1.5-pro-exp-0801', 'gemini-1.5-pro-exp-0827', - 'gemini-1.0-pro-vision-latest', - 'gemini-pro-vision', - ]; - - const dummyRequiredModels = [ - 'gemini-1.0-pro-vision-latest', - 'gemini-pro-vision', ]; const isMultimodal = visionSupportedModels.includes(model); @@ -452,8 +445,7 @@ export function convertGooglePrompt(messages, model, useSysPrompt = false, charN } }); - // pro 1.5 doesn't require a dummy image to be attached, other vision models do - if (isMultimodal && dummyRequiredModels.includes(model) && !hasImage) { + if (isMultimodal && !hasImage) { contents[0].parts.push({ inlineData: { mimeType: 'image/png', From 0e3b4335ebdb9e5b613a4c319d7bbfd5dd91de35 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:44:02 +0900 Subject: [PATCH 09/10] Update: [prompt-converters.js] Remove entire dummy img codes --- src/prompt-converters.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/prompt-converters.js b/src/prompt-converters.js index 0d4c5df7b..47f5989cc 100644 --- a/src/prompt-converters.js +++ b/src/prompt-converters.js @@ -333,8 +333,6 @@ export function convertCohereMessages(messages, charName = '', userName = '') { * @returns {{contents: *[], system_instruction: {parts: {text: string}}}} Prompt for Google MakerSuite models */ export function convertGooglePrompt(messages, model, useSysPrompt = false, charName = '', userName = '') { - // This is a 1x1 transparent PNG - const PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; const visionSupportedModels = [ 'gemini-2.0-flash-exp', @@ -445,15 +443,6 @@ export function convertGooglePrompt(messages, model, useSysPrompt = false, charN } }); - if (isMultimodal && !hasImage) { - contents[0].parts.push({ - inlineData: { - mimeType: 'image/png', - data: PNG_PIXEL, - }, - }); - } - return { contents: contents, system_instruction: system_instruction }; } From 3f253f42f2c6dde92ae484ad59ddc12719fc9c45 Mon Sep 17 00:00:00 2001 From: M0cho <77959408+M0ch0@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:45:30 +0900 Subject: [PATCH 10/10] Update: [constants.js] Remove BISON_SAFETY --- src/constants.js | 27 ---------------------- src/endpoints/backends/chat-completions.js | 1 - 2 files changed, 28 deletions(-) diff --git a/src/constants.js b/src/constants.js index d2c40daeb..7fb98eef9 100644 --- a/src/constants.js +++ b/src/constants.js @@ -159,33 +159,6 @@ export const GEMINI_SAFETY = [ }, ]; -export const BISON_SAFETY = [ - { - category: 'HARM_CATEGORY_DEROGATORY', - threshold: 'BLOCK_NONE', - }, - { - category: 'HARM_CATEGORY_TOXICITY', - threshold: 'BLOCK_NONE', - }, - { - category: 'HARM_CATEGORY_VIOLENCE', - threshold: 'BLOCK_NONE', - }, - { - category: 'HARM_CATEGORY_SEXUAL', - threshold: 'BLOCK_NONE', - }, - { - category: 'HARM_CATEGORY_MEDICAL', - threshold: 'BLOCK_NONE', - }, - { - category: 'HARM_CATEGORY_DANGEROUS', - threshold: 'BLOCK_NONE', - }, -]; - export const CHAT_COMPLETION_SOURCES = { OPENAI: 'openai', WINDOWAI: 'windowai', diff --git a/src/endpoints/backends/chat-completions.js b/src/endpoints/backends/chat-completions.js index 53f86a4f9..78e3f1f63 100644 --- a/src/endpoints/backends/chat-completions.js +++ b/src/endpoints/backends/chat-completions.js @@ -6,7 +6,6 @@ import { jsonParser } from '../../express-common.js'; import { CHAT_COMPLETION_SOURCES, GEMINI_SAFETY, - BISON_SAFETY, OPENROUTER_HEADERS, } from '../../constants.js'; import {