diff --git a/src/apis/trans.js b/src/apis/trans.js index 33fa614..5887313 100644 --- a/src/apis/trans.js +++ b/src/apis/trans.js @@ -303,12 +303,19 @@ const genGemini = ({ const userMsg = { role: "user", parts: [{ text: userPrompt }] }; const body = { - system_instruction: { - parts: { - text: systemPrompt, + // system_instruction: { + // parts: { + // text: systemPrompt, + // }, + // }, + contents: [ + { + role: "model", + parts: [{ text: systemPrompt }], }, - }, - contents: [...hisMsgs, userMsg], + ...hisMsgs, + userMsg, + ], generationConfig: { maxOutputTokens: maxTokens, temperature, diff --git a/src/libs/inputTranslate.js b/src/libs/inputTranslate.js index 4ab7282..a20501a 100644 --- a/src/libs/inputTranslate.js +++ b/src/libs/inputTranslate.js @@ -197,7 +197,6 @@ export class InputTranslator { text, fromLang, toLang, - apiSlug, apiSetting, }); diff --git a/src/views/Options/Apis.js b/src/views/Options/Apis.js index 4bdcc3e..6648c17 100644 --- a/src/views/Options/Apis.js +++ b/src/views/Options/Apis.js @@ -45,7 +45,7 @@ import { BUILTIN_PLACETAGS, } from "../../config"; -function TestButton({ apiSlug, api }) { +function TestButton({ api }) { const i18n = useI18n(); const alert = useAlert(); const [loading, setLoading] = useState(false); @@ -53,11 +53,10 @@ function TestButton({ apiSlug, api }) { try { setLoading(true); const [text] = await apiTranslate({ - apiSlug, text: "hello world", fromLang: "en", toLang: "zh-CN", - apiSetting: api, + apiSetting: { ...api }, useCache: false, }); if (!text) { @@ -691,7 +690,7 @@ function ApiFields({ apiSlug, isUserApi, deleteApi }) { > {i18n("save")} - +