perf: 优化系统提示消息

This commit is contained in:
Archer
2023-03-17 00:53:27 +08:00
parent 1e770088d0
commit d85b4c0945
6 changed files with 26 additions and 28 deletions

View File

@@ -249,9 +249,9 @@ const Chat = ({
/* 对长度进行限制 */
const maxContext = chatSiteData.secret.contextMaxLen;
const requestPrompt =
newChatList.length > maxContext + 2
? [newChatList[0], ...newChatList.slice(newChatList.length - maxContext - 1, -1)]
: newChatList.slice(0, newChatList.length - 1);
newChatList.length > maxContext + 1
? newChatList.slice(newChatList.length - maxContext - 1, -1)
: newChatList.slice(0, -1);
if (typeof fnMap[chatSiteData.chatModel] === 'function') {
await fnMap[chatSiteData.chatModel](requestPrompt);