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