DEBUG
This commit is contained in:
@@ -23,11 +23,13 @@ export default defineEventHandler(async event => {
|
|||||||
|
|
||||||
// 翻译中文到英文
|
// 翻译中文到英文
|
||||||
const translate = async (text: string, callback:Function) => {
|
const translate = async (text: string, callback:Function) => {
|
||||||
if (!/^[a-zA-Z]+$/.test(text)) return text
|
if (/^[a-zA-Z]+$/.test(text)) {
|
||||||
text = encodeURIComponent(text)
|
text = encodeURIComponent(text)
|
||||||
const {data} = await axios.get(`http://139.224.128.24:7861//api/text_to_text?zh=${text}`)
|
const {data} = await axios.get(`http://139.224.128.24:7861//api/text_to_text?zh=${text}`)
|
||||||
if (callback) callback(data.en)
|
text = data.en
|
||||||
return data.en
|
}
|
||||||
|
if (callback) callback(text)
|
||||||
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加任务到队列(生成一个32位随机字符串作为任务ID)
|
// 添加任务到队列(生成一个32位随机字符串作为任务ID)
|
||||||
|
Reference in New Issue
Block a user