mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2026-04-26 04:54:27 +08:00
Compare commits
4 Commits
0af04e0f2f
...
4ac27fdd4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ac27fdd4d | ||
|
|
b6b2c501fd | ||
|
|
c56587c438 | ||
|
|
840c151ab9 |
@@ -214,7 +214,11 @@ export const useChatStore = createPersistStore(
|
||||
const newSession = createEmptySession();
|
||||
|
||||
newSession.topic = currentSession.topic;
|
||||
newSession.messages = [...currentSession.messages];
|
||||
// 深拷贝消息
|
||||
newSession.messages = currentSession.messages.map(msg => ({
|
||||
...msg,
|
||||
id: nanoid(), // 生成新的消息 ID
|
||||
}));
|
||||
newSession.mask = {
|
||||
...currentSession.mask,
|
||||
modelConfig: {
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
同时为了让 ChatGPT 理解我们对话的上下文,往往会携带多条历史消息来提供上下文信息,而当对话进行一段时间之后,很容易就会触发长度限制。
|
||||
|
||||
为了解决此问题,我们增加了历史记录压缩功能,假设阈值为 1000 字符,那么每次用户产生的聊天记录超过 1000 字符时,都会将没有被总结过的消息,发送给 ChatGPT,让其产生一个 100 字所有的摘要。
|
||||
为了解决此问题,我们增加了历史记录压缩功能,假设阈值为 1000 字符,那么每次用户产生的聊天记录超过 1000 字符时,都会将没有被总结过的消息,发送给 ChatGPT,让其产生一个 100 字左右的摘要。
|
||||
|
||||
这样,历史信息就从 1000 字压缩到了 100 字,这是一种有损压缩,但已能满足大多数使用场景。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user