feat: qq transmart

This commit is contained in:
Gabe
2025-06-27 20:03:58 +08:00
parent 51f58d095a
commit 5f0ce57ead
2 changed files with 8 additions and 3 deletions

View File

@@ -302,7 +302,7 @@ export const apiTranslate = async ({
}
break;
case OPT_TRANS_TENCENT:
trText = res.auto_translation;
trText = res?.auto_translation?.[0];
isSame = text === trText;
break;
case OPT_TRANS_OPENAI:

View File

@@ -179,10 +179,13 @@ const genNiuTrans = ({ text, from, to, url, key, dictNo, memoryNo }) => {
const genTencent = ({ text, from, to }) => {
const data = {
header: {
fn: "auto_translation_block",
fn: "auto_translation",
client_key: "browser-chrome-110.0.0-Mac OS-df4bd4c5-a65d-44b2-a40f-42f34f3535f2-1677486696487"
},
type: "plain",
model_category: "normal",
source: {
text_block: text,
text_list: [text],
lang: from,
},
target: {
@@ -193,6 +196,8 @@ const genTencent = ({ text, from, to }) => {
const init = {
headers: {
"Content-Type": "application/json",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
"referer": "https://transmart.qq.com/zh-CN/index"
},
method: "POST",
body: JSON.stringify(data),