From b2f064f184cd66e855c77bd4a460e58601d066d0 Mon Sep 17 00:00:00 2001
From: sxjeru <sxjeru@gmail.com>
Date: Mon, 17 Mar 2025 15:27:46 +0800
Subject: [PATCH] update

---
 src/features/Conversation/components/History/index.tsx | 8 +++++++-
 src/store/chat/slices/aiChat/actions/generateAIChat.ts | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/features/Conversation/components/History/index.tsx b/src/features/Conversation/components/History/index.tsx
index 9e0732af533b3..77865fe7c745e 100644
--- a/src/features/Conversation/components/History/index.tsx
+++ b/src/features/Conversation/components/History/index.tsx
@@ -7,6 +7,8 @@ import { memo } from 'react';
 import { useTranslation } from 'react-i18next';
 import { Center, Flexbox } from 'react-layout-kit';
 
+import { agentChatConfigSelectors } from '@/store/agent/selectors';
+import { useAgentStore } from '@/store/agent/store';
 import { useChatStore } from '@/store/chat';
 import { topicSelectors } from '@/store/chat/selectors';
 
@@ -35,10 +37,14 @@ const History = memo(() => {
     return [history?.content, history?.model];
   });
 
+  const enableCompressHistory = useAgentStore(
+    agentChatConfigSelectors.currentChatConfig,
+  ).enableCompressHistory;
+
   return (
     <Flexbox paddingInline={16} style={{ paddingBottom: 8 }}>
       <HistoryDivider enable />
-      {!!content && (
+      {enableCompressHistory && !!content && (
         <Flexbox className={styles.container} gap={8}>
           <Flexbox align={'flex-start'} gap={8} horizontal>
             <Center height={20} width={20}>
diff --git a/src/store/chat/slices/aiChat/actions/generateAIChat.ts b/src/store/chat/slices/aiChat/actions/generateAIChat.ts
index b5ac15710a100..48347e497de43 100644
--- a/src/store/chat/slices/aiChat/actions/generateAIChat.ts
+++ b/src/store/chat/slices/aiChat/actions/generateAIChat.ts
@@ -538,7 +538,9 @@ export const generateAIChat: StateCreator<
     // to upload image
     const uploadTasks: Map<string, Promise<{ id?: string; url?: string }>> = new Map();
 
-    const historySummary = topicSelectors.currentActiveTopicSummary(get());
+    const historySummary = chatConfig.enableCompressHistory
+      ? topicSelectors.currentActiveTopicSummary(get())
+      : undefined;
     await chatService.createAssistantMessageStream({
       abortController,
       params: {