From d2e1e57c81b00be9cd73f260d1989acab57568bc Mon Sep 17 00:00:00 2001 From: leelaa Date: Fri, 3 May 2024 23:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/ai.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/api/ai.js b/api/ai.js index ba0d3d5..99bc182 100644 --- a/api/ai.js +++ b/api/ai.js @@ -1,7 +1,13 @@ export default function handler(request, response) { - let { text } = request.query + let { text } = request.query; text = text.replace(/\?/g, '!'); text = text.replace('吗', ''); - text = text.replace('你','我') - response.status(200).json(text); + if (text.includes('你')) { + text = text.replace('你', '我'); + return response.status(200).json(text); + } + if (text.includes('我')) { + text = text.replace('我', '你'); + response.status(200).json(text); + } }