diff --git a/app/components/chat.tsx b/app/components/chat.tsx
index bcd0e605d..305cd8833 100644
--- a/app/components/chat.tsx
+++ b/app/components/chat.tsx
@@ -97,6 +97,9 @@ import { ExportMessageModal } from "./exporter";
import { getClientConfig } from "../config/client";
import { useAllModels } from "../utils/hooks";
import { MultimodalContent } from "../client/api";
+import { listen } from "@tauri-apps/api/event";
+import { InputRange } from "./input-range";
+import { config } from "process";
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
loading: () => ,
@@ -625,6 +628,31 @@ export function EditMessageModal(props: { onClose: () => void }) {
}
>
+
+
+ chatStore.updateCurrentSession(
+ (session) =>
+ ((session.overrideModelConfig ??= {}).historyMessageCount =
+ e.currentTarget.valueAsNumber),
+ )
+ }
+ >
+
) => {
const currentModel = chatStore.currentSession().mask.modelConfig.model;
- if(!isVisionModel(currentModel)){return;}
+ if (!isVisionModel(currentModel)) {
+ return;
+ }
const items = (event.clipboardData || window.clipboardData).items;
for (const item of items) {
if (item.kind === "file" && item.type.startsWith("image/")) {
diff --git a/app/store/chat.ts b/app/store/chat.ts
index f97d7d725..2586d7076 100644
--- a/app/store/chat.ts
+++ b/app/store/chat.ts
@@ -57,6 +57,8 @@ export interface ChatSession {
clearContextIndex?: number;
mask: Mask;
+
+ overrideModelConfig?: Partial;
}
export const DEFAULT_TOPIC = Locale.Store.DefaultTopic;
@@ -466,7 +468,9 @@ export const useChatStore = createPersistStore(
// short term memory
const shortTermMemoryStartIndex = Math.max(
0,
- totalMessageCount - modelConfig.historyMessageCount,
+ totalMessageCount -
+ (session.overrideModelConfig?.historyMessageCount ??
+ modelConfig.historyMessageCount),
);
// lets concat send messages, including 4 parts:
@@ -580,7 +584,12 @@ export const useChatStore = createPersistStore(
if (historyMsgLength > modelConfig?.max_tokens ?? 4000) {
const n = toBeSummarizedMsgs.length;
toBeSummarizedMsgs = toBeSummarizedMsgs.slice(
- Math.max(0, n - modelConfig.historyMessageCount),
+ Math.max(
+ 0,
+ n -
+ (session.overrideModelConfig?.historyMessageCount ??
+ modelConfig.historyMessageCount),
+ ),
);
}