feat: support claude api

This commit is contained in:
hoilc
2024-09-23 18:22:19 +08:00
parent d6fe1ce9d7
commit 278ff9c6bc
4 changed files with 86 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import {
OPT_TRANS_OPENAI_2,
OPT_TRANS_OPENAI_3,
OPT_TRANS_GEMINI,
OPT_TRANS_CLAUDE,
OPT_TRANS_CLOUDFLAREAI,
OPT_TRANS_OLLAMA,
OPT_TRANS_OLLAMA_2,
@@ -311,6 +312,10 @@ export const apiTranslate = async ({
.join(" ");
isSame = text === trText;
break;
case OPT_TRANS_CLAUDE:
trText = res?.content?.map((item) => item.text).join(" ");
isSame = text === trText;
break;
case OPT_TRANS_CLOUDFLAREAI:
trText = res?.result?.translated_text;
isSame = text === trText;