From 138b607ac7f005839990a5100d364e7728a5a793 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Mon, 13 Mar 2023 19:48:19 +0800 Subject: [PATCH] =?UTF-8?q?perf:=E6=8F=90=E7=A4=BA=E6=96=87=E6=A1=88?= =?UTF-8?q?=EF=BC=9B=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/index.tsx | 14 -------------- src/constants/theme.ts | 3 +++ src/pages/_app.tsx | 4 ++-- src/pages/api/chat/chatGpt.ts | 14 ++++++-------- src/pages/api/user/update.ts | 2 +- src/service/errorCode.ts | 2 +- 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index e01cc7501..281f4ef67 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -80,20 +80,6 @@ const Layout = ({ children }: { children: JSX.Element }) => { )} - - @ Make by Archer - - 桂ICP备19010228号-1 - - ) : ( diff --git a/src/constants/theme.ts b/src/constants/theme.ts index 5c60060bc..4b4618500 100644 --- a/src/constants/theme.ts +++ b/src/constants/theme.ts @@ -82,6 +82,9 @@ export const theme = extendTheme({ '8xl': '6rem', '9xl': '8rem' }, + fonts: { + body: '-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"' + }, components: { Modal: ModalTheme, Button diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 2d8ed11bb..0ae701a49 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -30,8 +30,8 @@ export default function App({ Component, pageProps }: AppProps) { return ( <> - 日记分享 - + Fast GPT + { res.end(); }); + req.on('error', () => { + res.end(); + }); const { chatId, windowId } = req.query as { chatId: string; windowId: string }; @@ -114,14 +117,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } }; - try { - for await (const chunk of chatResponse.data as any) { - const parser = createParser(onParse); - parser.feed(decoder.decode(chunk)); - } - } catch (error) { - console.log(error, '===='); - throw new Error('错误了'); + for await (const chunk of chatResponse.data as any) { + const parser = createParser(onParse); + parser.feed(decoder.decode(chunk)); } } catch (err: any) { console.log('error->', err?.response, '==='); diff --git a/src/pages/api/user/update.ts b/src/pages/api/user/update.ts index 8d3052404..7f1320948 100644 --- a/src/pages/api/user/update.ts +++ b/src/pages/api/user/update.ts @@ -13,7 +13,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< const { authorization } = req.headers; if (!authorization) { - throw new Error('缺少参数'); + throw new Error('无权操作'); } const userId = await authToken(authorization); diff --git a/src/service/errorCode.ts b/src/service/errorCode.ts index 690f37e3d..9f1db2926 100644 --- a/src/service/errorCode.ts +++ b/src/service/errorCode.ts @@ -2,5 +2,5 @@ export const openaiError: Record = { context_length_exceeded: '内容超长了,请重置对话', Unauthorized: 'API-KEY 不合法', rate_limit_reached: '同时访问用户过多,请稍后再试', - 'Bad Request': '内容太多了~' + 'Bad Request': '上下文太多了,请重开对话~' };