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); + } }