dev.....!

This commit is contained in:
Gabe Yuan
2023-08-31 13:38:06 +08:00
parent aa795e2731
commit 4486ad353c
15 changed files with 50 additions and 41 deletions

View File

@@ -10,7 +10,7 @@ import {
PROMPT_PLACE_TO,
KV_SALT_SYNC,
} from "../config";
import { detectLang } from "../libs";
import { tryDetectLang } from "../libs";
import { sha256 } from "../libs/utils";
/**
@@ -163,8 +163,8 @@ export const apiTranslate = async ({
} else if (translator === OPT_TRANS_OPENAI) {
const res = await apiOpenaiTranslate(translator, q, to, from, setting);
trText = res?.choices?.[0].message.content;
const sLang = await detectLang(q);
const tLang = await detectLang(trText);
const sLang = await tryDetectLang(q);
const tLang = await tryDetectLang(trText);
isSame = q === trText || (sLang && tLang && sLang === tLang);
}