From 1daf134b3105ca23717b624fb5fbbd97fed9a352 Mon Sep 17 00:00:00 2001 From: Gabe Date: Wed, 23 Jul 2025 20:03:54 +0800 Subject: [PATCH] fix: gemini api --- src/apis/trans.js | 4 ++-- src/config/index.js | 2 +- src/views/Options/Apis.js | 30 ++---------------------------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/apis/trans.js b/src/apis/trans.js index f71d281..f2656c5 100644 --- a/src/apis/trans.js +++ b/src/apis/trans.js @@ -348,7 +348,7 @@ const genGemini2 = ({ userPrompt, model, temperature, - reasoningEffort, + maxTokens, }) => { systemPrompt = systemPrompt .replaceAll(INPUT_PLACE_FROM, from) @@ -361,7 +361,6 @@ const genGemini2 = ({ const data = { model, - reasoning_effort: reasoningEffort, messages: [ { role: "system", @@ -373,6 +372,7 @@ const genGemini2 = ({ }, ], temperature, + max_tokens: maxTokens, }; const init = { diff --git a/src/config/index.js b/src/config/index.js index e81dfcb..7e1a856 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -692,7 +692,7 @@ export const DEFAULT_TRANS_APIS = { systemPrompt: `You are a professional, authentic machine translation engine.`, userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`, temperature: 0, - reasoningEffort: "low", + maxTokens: 2048, fetchLimit: 1, fetchInterval: 500, apiName: OPT_TRANS_GEMINI_2, diff --git a/src/views/Options/Apis.js b/src/views/Options/Apis.js index ea6628d..9580cca 100644 --- a/src/views/Options/Apis.js +++ b/src/views/Options/Apis.js @@ -140,7 +140,6 @@ function ApiFields({ translator }) { maxTokens = 256, apiName = "", isDisabled = false, - reasoningEffort = "low", } = api; const handleChange = (e) => { @@ -305,7 +304,8 @@ function ApiFields({ translator }) { {(translator.startsWith(OPT_TRANS_OPENAI) || translator === OPT_TRANS_CLAUDE || - translator === OPT_TRANS_GEMINI) && ( + translator === OPT_TRANS_GEMINI || + translator === OPT_TRANS_GEMINI_2) && ( <> )} - {translator === OPT_TRANS_GEMINI_2 && ( - <> - - - none - low - medium - high - - - )} - {translator === OPT_TRANS_NIUTRANS && ( <>