Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ› fix: Close historySummary correctly #7010

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/features/Conversation/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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}>
Expand Down
4 changes: 3 additions & 1 deletion src/store/chat/slices/aiChat/actions/generateAIChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down