From 6e5ef2e1f5f42cc170c574b1a5f1329d70925944 Mon Sep 17 00:00:00 2001 From: zyc404 Date: Sun, 8 Oct 2023 18:56:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/modules/web_route.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/modules/web_route.js b/server/modules/web_route.js index 289de22..e5f1d24 100644 --- a/server/modules/web_route.js +++ b/server/modules/web_route.js @@ -51,8 +51,9 @@ async function routes(fastify, options) { return reply }) fastify.setNotFoundHandler((request, reply) => { - if (request.method === 'GET') { - reply.sendFile('plugins/chatgpt-plugin/server/static/index.html') + if (request.method == 'GET') { + const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html') + reply.type('text/html').send(stream) } else { reply.code(404).send(new Error('Not Found')) }