From 502d8d8c73a0fe459c658d7d19fdb721669993fa Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Sun, 30 Jul 2023 12:45:15 +0800 Subject: [PATCH] detail ux --- client/src/api/fetch.ts | 5 ++++- client/src/components/ChatBox/index.tsx | 2 +- client/src/service/models/chat.ts | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/api/fetch.ts b/client/src/api/fetch.ts index 3db83bdae..942f93a36 100644 --- a/client/src/api/fetch.ts +++ b/client/src/api/fetch.ts @@ -90,7 +90,10 @@ export const streamFetch = ({ responseData }); } - reject(getErrText(err, '请求异常')); + reject({ + responseText, + message: getErrText(err, '请求异常') + }); } }; read(); diff --git a/client/src/components/ChatBox/index.tsx b/client/src/components/ChatBox/index.tsx index 2cd425079..3ed732858 100644 --- a/client/src/components/ChatBox/index.tsx +++ b/client/src/components/ChatBox/index.tsx @@ -693,7 +693,7 @@ const ChatBox = ( }} onKeyDown={(e) => { // 触发快捷发送 - if (e.keyCode === 13 && !e.shiftKey) { + if (isPc && e.keyCode === 13 && !e.shiftKey) { handleSubmit((data) => sendPrompt(data, TextareaDom.current?.value))(); e.preventDefault(); } diff --git a/client/src/service/models/chat.ts b/client/src/service/models/chat.ts index 37e039e78..71c086214 100644 --- a/client/src/service/models/chat.ts +++ b/client/src/service/models/chat.ts @@ -84,4 +84,12 @@ const ChatSchema = new Schema({ } }); +try { + ChatSchema.index({ userId: 1 }); + ChatSchema.index({ updateTime: -1 }); + ChatSchema.index({ appId: 1 }); +} catch (error) { + console.log(error); +} + export const Chat: Model = models['chat'] || model('chat', ChatSchema);