feat: add gemini translator

This commit is contained in:
Gabe Yuan
2023-12-21 14:15:14 +08:00
parent 4bf7972ad5
commit c7df103950
7 changed files with 57 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import {
OPT_TRANS_BAIDU,
OPT_TRANS_TENCENT,
OPT_TRANS_OPENAI,
OPT_TRANS_GEMINI,
OPT_TRANS_CLOUDFLAREAI,
OPT_TRANS_CUSTOMIZE,
URL_CACHE_TRAN,
@@ -181,6 +182,10 @@ export const apiTranslate = async ({
trText = res?.choices?.[0].message.content;
isSame = text === trText;
break;
case OPT_TRANS_GEMINI:
trText = res?.candidates?.[0].content.parts[0].text;
isSame = text === trText;
break;
case OPT_TRANS_CLOUDFLAREAI:
trText = res?.result?.translated_text;
isSame = text === trText;