Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix(web): hide the chat history for an agent that keeps no memory (#242)

Croffd4a913d801af
diff --git a/apps/web/messages/ar/aiChat.json b/apps/web/messages/ar/aiChat.json
index ca863fd9..f619fe3e 100644
--- a/apps/web/messages/ar/aiChat.json
+++ b/apps/web/messages/ar/aiChat.json
@@ -13,6 +13,7 @@
"renameHint": "انقر نقرًا مزدوجًا لإعادة التسمية",
"moreTabs": "محادثات أخرى ({count})",
"history": "السجلّ",
+ "noHistory": "لا يحتفظ الوكيل بالسجلّ. ستضيع هذه المحادثة عند إعادة التحميل.",
"untitledThread": "محادثة جديدة",
"deleteThread": "حذف المحادثة",
"deleteThreadConfirm": "سيُحذف «{title}» ورسائله نهائيًا.",
diff --git a/apps/web/messages/en/aiChat.json b/apps/web/messages/en/aiChat.json
index 979d2355..2c2398d9 100644
--- a/apps/web/messages/en/aiChat.json
+++ b/apps/web/messages/en/aiChat.json
@@ -13,6 +13,7 @@
"renameHint": "Double-click to rename",
"moreTabs": "More chats ({count})",
"history": "History",
+ "noHistory": "The agent keeps no history. This chat is lost on reload.",
"untitledThread": "New conversation",
"deleteThread": "Delete conversation",
"deleteThreadConfirm": "“{title}” and its messages are deleted permanently.",
diff --git a/apps/web/messages/ru/aiChat.json b/apps/web/messages/ru/aiChat.json
index 32cb8c8b..e63565b9 100644
--- a/apps/web/messages/ru/aiChat.json
+++ b/apps/web/messages/ru/aiChat.json
@@ -13,6 +13,7 @@
"renameHint": "Двойной клик, чтобы переименовать",
"moreTabs": "Ещё чаты ({count})",
"history": "История",
+ "noHistory": "Агент не хранит историю. Чат пропадёт после перезагрузки.",
"untitledThread": "Новый разговор",
"deleteThread": "Удалить разговор",
"deleteThreadConfirm": "«{title}» и его сообщения будут удалены навсегда.",
diff --git a/apps/web/messages/uk/aiChat.json b/apps/web/messages/uk/aiChat.json
index b18f2b83..629fc7a5 100644
--- a/apps/web/messages/uk/aiChat.json
+++ b/apps/web/messages/uk/aiChat.json
@@ -13,6 +13,7 @@
"renameHint": "Подвійний клік, щоб перейменувати",
"moreTabs": "Ще чати ({count})",
"history": "Історія",
+ "noHistory": "Агент не зберігає історію. Чат зникне після перезавантаження.",
"untitledThread": "Нова розмова",
"deleteThread": "Видалити розмову",
"deleteThreadConfirm": "«{title}» та її повідомлення буде видалено назавжди.",
diff --git a/apps/web/messages/zh-CN/aiChat.json b/apps/web/messages/zh-CN/aiChat.json
index 28a4b544..d1419491 100644
--- a/apps/web/messages/zh-CN/aiChat.json
+++ b/apps/web/messages/zh-CN/aiChat.json
@@ -13,6 +13,7 @@
"renameHint": "双击重命名",
"moreTabs": "更多聊天({count})",
"history": "历史记录",
+ "noHistory": "该代理不保存历史记录。刷新后此对话会丢失。",
"untitledThread": "新对话",
"deleteThread": "删除对话",
"deleteThreadConfirm": "将永久删除“{title}”及其中的消息。",
diff --git a/apps/web/src/features/ai-chat/components/panel/ChatPanelSession.tsx b/apps/web/src/features/ai-chat/components/panel/ChatPanelSession.tsx
index 27477255..edcd688e 100644
--- a/apps/web/src/features/ai-chat/components/panel/ChatPanelSession.tsx
+++ b/apps/web/src/features/ai-chat/components/panel/ChatPanelSession.tsx
@@ -1,8 +1,12 @@
'use client';
import { useCallback } from 'react';
+import { MessageSquareOff } from 'lucide-react';
+import { useTranslations } from 'next-intl';
import type { AiAgent } from '@/lib/api';
import { AgentContextSize } from '@/components/common/agent-chat/AgentContextSize';
+import { InputGroupButton } from '@/components/ui/input-group';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { cn } from '@/lib/utils';
import { AiChatSessionBadge } from '../shared/AiChatSessionBadge';
import { AiChatThread } from '../shared/AiChatThread';
@@ -51,6 +55,10 @@ export function ChatPanelSession({
[session.id, onStateChange],
);
const thread = useShownThread(projectKey, agent.id, session.threadId);
+ const t = useTranslations('aiChat');
+ // An internal agent with memory off stores no thread and no message, so it has no
+ // history to list and its conversation ends with the page.
+ const keepsHistory = agent.kind === 'external' || agent.memoryEnabled;
return (
<div className={cn('absolute inset-0', !active && 'hidden')}>
@@ -70,14 +78,31 @@ export function ChatPanelSession({
disabled={session.running}
onSelect={(agentId) => onSelectAgent(session, agentId)}
/>
- <ChatPanelHistory
- projectKey={projectKey}
- agentId={agent.id}
- agentName={agent.name}
- selectedThreadId={session.threadId}
- onSelect={(threadId) => onSelectThread(agent.id, threadId)}
- onDeleted={onThreadDeleted}
- />
+ {keepsHistory ? (
+ <ChatPanelHistory
+ projectKey={projectKey}
+ agentId={agent.id}
+ agentName={agent.name}
+ selectedThreadId={session.threadId}
+ onSelect={(threadId) => onSelectThread(agent.id, threadId)}
+ onDeleted={onThreadDeleted}
+ />
+ ) : (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InputGroupButton
+ type="button"
+ variant="ghost"
+ size="icon-xs"
+ className="rounded-md text-muted-foreground"
+ >
+ <MessageSquareOff />
+ <span className="sr-only">{t('noHistory')}</span>
+ </InputGroupButton>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-56">{t('noHistory')}</TooltipContent>
+ </Tooltip>
+ )}
{thread?.cliSessionId && <AiChatSessionBadge sessionId={thread.cliSessionId} />}
</>
}