From c9680359c84fd52a605164458ff7befcd5e3e8fb Mon Sep 17 00:00:00 2001 From: Maseshi Date: Sun, 21 May 2023 11:59:53 +0700 Subject: [PATCH] Fixed way to check prompts. --- routes.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routes.js b/routes.js index 0ed8e73..f8ff82a 100644 --- a/routes.js +++ b/routes.js @@ -137,10 +137,10 @@ async function chatCompletions(req, res) { if (MODERATION) { try { - let prompt = ""; + let prompt = []; try { req.body.messages.forEach(element => { - prompt += element.content; + prompt.push(element.content); }); } catch (e) { @@ -168,7 +168,11 @@ async function chatCompletions(req, res) { } } catch (e) { - + if (DEBUG) console.log(e); + return res.status(500).send({ + status: false, + error: "something went wrong!" + }); } } else {