fix history
This commit is contained in:
@@ -263,7 +263,13 @@ const ChatTemplateItem = ({
|
|||||||
);
|
);
|
||||||
if (!confirm) return;
|
if (!confirm) return;
|
||||||
}
|
}
|
||||||
setChatStore({ ...newChatStore({ ...chatStore, ...t }) });
|
setChatStore({
|
||||||
|
...newChatStore({
|
||||||
|
...chatStore,
|
||||||
|
...{ use_this_history: t.history ?? chatStore.history },
|
||||||
|
...t,
|
||||||
|
}),
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NavigationMenuLink asChild>
|
<NavigationMenuLink asChild>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
CHATGPT_API_WEB_VERSION,
|
CHATGPT_API_WEB_VERSION,
|
||||||
} from "@/const";
|
} from "@/const";
|
||||||
import { getDefaultParams } from "@/utils/getDefaultParam";
|
import { getDefaultParams } from "@/utils/getDefaultParam";
|
||||||
import { ChatStore } from "@/types/chatstore";
|
import { ChatStore, ChatStoreMessage } from "@/types/chatstore";
|
||||||
import { models } from "@/types/models";
|
import { models } from "@/types/models";
|
||||||
|
|
||||||
interface NewChatStoreOptions {
|
interface NewChatStoreOptions {
|
||||||
@@ -36,6 +36,7 @@ interface NewChatStoreOptions {
|
|||||||
json_mode?: boolean;
|
json_mode?: boolean;
|
||||||
logprobs?: boolean;
|
logprobs?: boolean;
|
||||||
maxTokens?: number;
|
maxTokens?: number;
|
||||||
|
use_this_history?: ChatStoreMessage[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
|
export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
|
||||||
@@ -46,7 +47,7 @@ export const newChatStore = (options: NewChatStoreOptions): ChatStore => {
|
|||||||
options.systemMessageContent ?? ""
|
options.systemMessageContent ?? ""
|
||||||
),
|
),
|
||||||
toolsString: options.toolsString ?? "",
|
toolsString: options.toolsString ?? "",
|
||||||
history: [],
|
history: options.use_this_history ?? [],
|
||||||
postBeginIndex: 0,
|
postBeginIndex: 0,
|
||||||
tokenMargin: 1024,
|
tokenMargin: 1024,
|
||||||
totalTokens: 0,
|
totalTokens: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user