[fix] deepl
This commit is contained in:
@@ -105,17 +105,18 @@ async function translateMain(text:string, arg:{from:string, to:string, host:stri
|
|||||||
return translateLLM(text, {to: tr})
|
return translateLLM(text, {to: tr})
|
||||||
}
|
}
|
||||||
if(db.translatorType === 'deepl'){
|
if(db.translatorType === 'deepl'){
|
||||||
|
const body = {
|
||||||
|
text: [text],
|
||||||
|
source_lang: arg.from.toLocaleUpperCase(),
|
||||||
|
target_lang: arg.to.toLocaleUpperCase(),
|
||||||
|
}
|
||||||
let url = db.deeplOptions.freeApi ? "https://api-free.deepl.com/v2/translate" : "https://api.deepl.com/v2/translate"
|
let url = db.deeplOptions.freeApi ? "https://api-free.deepl.com/v2/translate" : "https://api.deepl.com/v2/translate"
|
||||||
const f = await globalFetch(url, {
|
const f = await globalFetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "DeepL-Auth-Key " + db.deeplOptions.key,
|
"Authorization": "DeepL-Auth-Key " + db.deeplOptions.key,
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: {
|
body: body
|
||||||
text: text,
|
|
||||||
source_lang: arg.from.toLocaleUpperCase(),
|
|
||||||
target_lang: arg.to.toLocaleUpperCase(),
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if(!f.ok){
|
if(!f.ok){
|
||||||
|
|||||||
Reference in New Issue
Block a user