From b55cd47e02effb0d94259ca057fe2b9a1dc61970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=9C=E8=8F=AF?= Date: Fri, 3 Mar 2023 09:58:22 +0800 Subject: [PATCH] DEBUG --- server/api/drawing.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/api/drawing.ts b/server/api/drawing.ts index ca470e7..9ca3a90 100644 --- a/server/api/drawing.ts +++ b/server/api/drawing.ts @@ -23,11 +23,13 @@ export default defineEventHandler(async event => { // 翻译中文到英文 const translate = async (text: string, callback:Function) => { - if (!/^[a-zA-Z]+$/.test(text)) return text - text = encodeURIComponent(text) - const {data} = await axios.get(`http://139.224.128.24:7861//api/text_to_text?zh=${text}`) - if (callback) callback(data.en) - return data.en + if (/^[a-zA-Z]+$/.test(text)) { + text = encodeURIComponent(text) + const {data} = await axios.get(`http://139.224.128.24:7861//api/text_to_text?zh=${text}`) + text = data.en + } + if (callback) callback(text) + return text } // 添加任务到队列(生成一个32位随机字符串作为任务ID)