From 1e9ec66c706b01296da049bfaf68287c3cdeaa98 Mon Sep 17 00:00:00 2001 From: Archeb Date: Wed, 8 May 2024 22:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=BE=93=E5=87=BA=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 66a9bed..2457137 100644 --- a/index.js +++ b/index.js @@ -219,13 +219,12 @@ app.post("/v1/messages", apiKeyAuth, (req, res) => { } try { - console.log(chunk); if (chunk.indexOf("event: youChatToken\n") != -1) { chunk.split("\n").forEach((line) => { if (line.startsWith(`data: {"youChatToken"`)) { let data = line.substring(6); let json = JSON.parse(data); - //console.log(json); + process.stdout.write(json.youChatToken); chunkJSON = JSON.stringify({ type: "content_block_delta", index: 0, @@ -234,6 +233,8 @@ app.post("/v1/messages", apiKeyAuth, (req, res) => { res.write(createEvent("content_block_delta", chunkJSON)); } }); + }else{ + console.log(chunk); } } catch (e) { console.log(e);