From d6fb62c42417cd7e0ce401b88f948c049d4ea54e Mon Sep 17 00:00:00 2001 From: zyc404 Date: Sun, 8 Oct 2023 18:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/modules/web_route.js b/server/modules/web_route.js index 90bc9dc..289de22 100644 --- a/server/modules/web_route.js +++ b/server/modules/web_route.js @@ -50,6 +50,13 @@ async function routes(fastify, options) { reply.type('text/html').send(stream) return reply }) + fastify.setNotFoundHandler((request, reply) => { + if (request.method === 'GET') { + reply.sendFile('plugins/chatgpt-plugin/server/static/index.html') + } else { + reply.code(404).send(new Error('Not Found')) + } + }) } export default routes \ No newline at end of file