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