Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(topic): present "completed" as "archive" in the topic UI (#17073)

AmAzing-974d6054c8ef
diff --git a/locales/en-US/topic.json b/locales/en-US/topic.json
index c961a49aef5..5b818322c67 100644
--- a/locales/en-US/topic.json
+++ b/locales/en-US/topic.json
@@ -15,14 +15,14 @@
"actions.export": "Export Topics",
"actions.favorite": "Favorite",
"actions.import": "Import Topics",
- "actions.markCompleted": "Mark as Completed",
+ "actions.markCompleted": "Archive",
"actions.moveToAgent": "Move to another agent",
"actions.openInNewTab": "Open in New Tab",
"actions.openInNewWindow": "Open in a new window",
"actions.removeAll": "Delete All Topics",
"actions.removeUnstarred": "Delete Unstarred Topics",
"actions.unfavorite": "Unfavorite",
- "actions.unmarkCompleted": "Mark as Active",
+ "actions.unmarkCompleted": "Unarchive",
"defaultTitle": "Default Topic",
"displayItems": "Display Items",
"draft": "[Draft]",
@@ -36,14 +36,14 @@
"filter.groupMode.byTime": "By time",
"filter.groupMode.flat": "Flat",
"filter.organize": "Organize",
- "filter.showCompleted": "Include Completed",
+ "filter.showCompleted": "Include Archived",
"filter.sort": "Sort by",
"filter.sortBy.createdAt": "Created time",
"filter.sortBy.updatedAt": "Updated time",
"groupTitle.byProject.noProject": "No directory",
"groupTitle.byStatus.active": "Active",
"groupTitle.byStatus.archived": "Archived",
- "groupTitle.byStatus.completed": "Completed",
+ "groupTitle.byStatus.completed": "Archived",
"groupTitle.byStatus.failed": "Failed",
"groupTitle.byStatus.paused": "Paused",
"groupTitle.byStatus.pending": "Needs attention",
@@ -67,7 +67,7 @@
"loadMore": "Load More",
"management.actions.newChat": "New chat",
"management.actions.select": "Select",
- "management.actionsMenu.archiveStale.confirm": "Archive {{count}} topics that have been inactive for over 3 months? They will be marked as completed.",
+ "management.actionsMenu.archiveStale.confirm": "Archive {{count}} topics that have been inactive for over 3 months?",
"management.actionsMenu.archiveStale.confirmOk": "Archive",
"management.actionsMenu.archiveStale.done": "Archived {{count}} stale topics.",
"management.actionsMenu.archiveStale.label": "Archive topics inactive for 3+ months",
@@ -104,7 +104,7 @@
"management.filters.status.active": "Active",
"management.filters.status.all": "All",
"management.filters.status.archived": "Archived",
- "management.filters.status.completed": "Completed",
+ "management.filters.status.completed": "Archived",
"management.filters.status.favorite": "Favorites",
"management.filters.status.running": "Running",
"management.filters.time.all": "All time",
@@ -142,7 +142,7 @@
"management.sort.updatedAt": "Updated time",
"management.status.active": "Active",
"management.status.archived": "Archived",
- "management.status.completed": "Completed",
+ "management.status.completed": "Archived",
"management.status.failed": "Failed",
"management.status.idle": "Idle",
"management.status.paused": "Paused",
diff --git a/locales/zh-CN/topic.json b/locales/zh-CN/topic.json
index 3a75acce369..630aa6ad381 100644
--- a/locales/zh-CN/topic.json
+++ b/locales/zh-CN/topic.json
@@ -15,14 +15,14 @@
"actions.export": "导出话题",
"actions.favorite": "收藏",
"actions.import": "导入对话",
- "actions.markCompleted": "标为已完成",
+ "actions.markCompleted": "归档",
"actions.moveToAgent": "移动到其他助手",
"actions.openInNewTab": "在新标签页中打开",
"actions.openInNewWindow": "打开独立窗口",
"actions.removeAll": "删除全部话题",
"actions.removeUnstarred": "删除未收藏话题",
"actions.unfavorite": "取消收藏",
- "actions.unmarkCompleted": "标为进行中",
+ "actions.unmarkCompleted": "取消归档",
"defaultTitle": "默认话题",
"displayItems": "显示条目",
"draft": "[草稿]",
@@ -36,14 +36,14 @@
"filter.groupMode.byTime": "按时间阶段",
"filter.groupMode.flat": "平铺",
"filter.organize": "整理",
- "filter.showCompleted": "显示已完成",
+ "filter.showCompleted": "显示已归档",
"filter.sort": "排序",
"filter.sortBy.createdAt": "按创建时间",
"filter.sortBy.updatedAt": "按更新时间",
"groupTitle.byProject.noProject": "无目录",
"groupTitle.byStatus.active": "活跃",
"groupTitle.byStatus.archived": "已归档",
- "groupTitle.byStatus.completed": "已完成",
+ "groupTitle.byStatus.completed": "已归档",
"groupTitle.byStatus.failed": "已失败",
"groupTitle.byStatus.paused": "已暂停",
"groupTitle.byStatus.pending": "待处理",
@@ -67,7 +67,7 @@
"loadMore": "更多",
"management.actions.newChat": "新对话",
"management.actions.select": "选择",
- "management.actionsMenu.archiveStale.confirm": "将 {{count}} 个超过 3 个月未活动的话题归档(标记为已完成)?",
+ "management.actionsMenu.archiveStale.confirm": "将 {{count}} 个超过 3 个月未活动的话题归档?",
"management.actionsMenu.archiveStale.confirmOk": "归档",
"management.actionsMenu.archiveStale.done": "已归档 {{count}} 个话题。",
"management.actionsMenu.archiveStale.label": "归档 3 个月未活动的话题",
@@ -104,7 +104,7 @@
"management.filters.status.active": "活跃",
"management.filters.status.all": "全部",
"management.filters.status.archived": "已归档",
- "management.filters.status.completed": "已完成",
+ "management.filters.status.completed": "已归档",
"management.filters.status.favorite": "已收藏",
"management.filters.status.running": "运行中",
"management.filters.time.all": "全部时间",
@@ -142,7 +142,7 @@
"management.sort.updatedAt": "按更新时间",
"management.status.active": "活跃",
"management.status.archived": "已归档",
- "management.status.completed": "已完成",
+ "management.status.completed": "已归档",
"management.status.failed": "已失败",
"management.status.idle": "空闲中",
"management.status.paused": "已暂停",
diff --git a/packages/locales/src/default/topic.ts b/packages/locales/src/default/topic.ts
index e59d50fe7d8..31e6ec329e3 100644
--- a/packages/locales/src/default/topic.ts
+++ b/packages/locales/src/default/topic.ts
@@ -16,8 +16,8 @@ export default {
'actions.moveToAgent': 'Move to another agent',
'actions.favorite': 'Favorite',
'actions.unfavorite': 'Unfavorite',
- 'actions.markCompleted': 'Mark as Completed',
- 'actions.unmarkCompleted': 'Mark as Active',
+ 'actions.markCompleted': 'Archive',
+ 'actions.unmarkCompleted': 'Unarchive',
'actions.export': 'Export Topics',
'actions.import': 'Import Topics',
'actions.openInNewTab': 'Open in New Tab',
@@ -45,14 +45,14 @@ export default {
'filter.groupMode.byTime': 'By time',
'filter.groupMode.flat': 'Flat',
'filter.organize': 'Organize',
- 'filter.showCompleted': 'Include Completed',
+ 'filter.showCompleted': 'Include Archived',
'filter.sort': 'Sort by',
'filter.sortBy.createdAt': 'Created time',
'filter.sortBy.updatedAt': 'Updated time',
'groupTitle.byProject.noProject': 'No directory',
'groupTitle.byStatus.active': 'Active',
'groupTitle.byStatus.archived': 'Archived',
- 'groupTitle.byStatus.completed': 'Completed',
+ 'groupTitle.byStatus.completed': 'Archived',
'groupTitle.byStatus.failed': 'Failed',
'groupTitle.byStatus.paused': 'Paused',
'groupTitle.byStatus.pending': 'Needs attention',
@@ -87,7 +87,7 @@ export default {
'management.actions.newChat': 'New chat',
'management.actions.select': 'Select',
'management.actionsMenu.archiveStale.confirm':
- 'Archive {{count}} topics that have been inactive for over 3 months? They will be marked as completed.',
+ 'Archive {{count}} topics that have been inactive for over 3 months?',
'management.actionsMenu.archiveStale.confirmOk': 'Archive',
'management.actionsMenu.archiveStale.done': 'Archived {{count}} stale topics.',
'management.actionsMenu.archiveStale.label': 'Archive topics inactive for 3+ months',
@@ -127,7 +127,7 @@ export default {
'management.filters.status.active': 'Active',
'management.filters.status.all': 'All',
'management.filters.status.archived': 'Archived',
- 'management.filters.status.completed': 'Completed',
+ 'management.filters.status.completed': 'Archived',
'management.filters.status.running': 'Running',
'management.filters.status.favorite': 'Favorites',
'management.filters.time.all': 'All time',
@@ -165,7 +165,7 @@ export default {
'management.sort.updatedAt': 'Updated time',
'management.status.active': 'Active',
'management.status.archived': 'Archived',
- 'management.status.completed': 'Completed',
+ 'management.status.completed': 'Archived',
'management.status.failed': 'Failed',
'management.status.idle': 'Idle',
'management.status.paused': 'Paused',
diff --git a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
index a14ac7d3095..988be941c81 100644
--- a/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
+++ b/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx
@@ -5,8 +5,8 @@ import { Icon } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
import { App } from 'antd';
import {
- CheckCircle2,
- Circle,
+ Archive,
+ ArchiveRestore,
ExternalLink,
Hash,
Link2,
@@ -91,7 +91,7 @@ export const useDropdownMenu = ({
[
{
disabled: !canEditTopic,
- icon: <Icon icon={isCompleted ? Circle : CheckCircle2} />,
+ icon: <Icon icon={isCompleted ? ArchiveRestore : Archive} />,
key: 'markCompleted',
label: isCompleted
? t('actions.unmarkCompleted', { ns: 'topic' })
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
index 27ccffb0177..f9db5251049 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
@@ -5,8 +5,8 @@ import { Icon } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
import { App } from 'antd';
import {
- CheckCircle2,
- Circle,
+ Archive,
+ ArchiveRestore,
ExternalLink,
FolderInput,
Hash,
@@ -92,7 +92,7 @@ export const useTopicItemDropdownMenu = ({
return [
{
disabled: !canEditTopic,
- icon: <Icon icon={isCompleted ? Circle : CheckCircle2} />,
+ icon: <Icon icon={isCompleted ? ArchiveRestore : Archive} />,
key: 'markCompleted',
label: isCompleted ? t('actions.unmarkCompleted') : t('actions.markCompleted'),
onClick: () => {
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
index d5c3236bcb2..68c8501930c 100644
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx
@@ -5,8 +5,8 @@ import { Icon } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
import { App } from 'antd';
import {
- CheckCircle2,
- Circle,
+ Archive,
+ ArchiveRestore,
ExternalLink,
Hash,
Link2,
@@ -75,7 +75,7 @@ export const useTopicItemDropdownMenu = ({
return [
{
disabled: !canEditTopic,
- icon: <Icon icon={isCompleted ? Circle : CheckCircle2} />,
+ icon: <Icon icon={isCompleted ? ArchiveRestore : Archive} />,
key: 'markCompleted',
label: isCompleted ? t('actions.unmarkCompleted') : t('actions.markCompleted'),
onClick: () => {
diff --git a/src/store/chat/slices/topic/action.test.ts b/src/store/chat/slices/topic/action.test.ts
index 69602e22520..3911470a1d3 100644
--- a/src/store/chat/slices/topic/action.test.ts
+++ b/src/store/chat/slices/topic/action.test.ts
@@ -523,6 +523,42 @@ describe('topic action', () => {
expect(updateFavoriteSpy).toHaveBeenCalledWith(topicId, { favorite: favState });
});
});
+ describe('updateTopicStatus', () => {
+ // Unique ids: updateTopicStatus registers a TTL-bounded pending status-write
+ // in a private map that beforeEach's state reset can't clear, so a shared id
+ // would bleed status onto other tests' fetched-topic fixtures.
+ it('stamps completedAt when archiving (status: completed)', async () => {
+ const { result } = renderHook(() => useChatStore());
+ const topicId = 'update-status-completed-topic';
+
+ const updateSpy = vi.spyOn(topicService, 'updateTopic').mockResolvedValue(undefined as any);
+
+ await act(async () => {
+ await result.current.updateTopicStatus({ status: 'completed', topicId });
+ });
+
+ // "Archive" persists the completion timestamp alongside the status so the
+ // bulk/stale archive matches the single-item markTopicCompleted.
+ expect(updateSpy).toHaveBeenCalledWith(topicId, {
+ completedAt: expect.any(Date),
+ status: 'completed',
+ });
+ });
+
+ it('does not touch completedAt for non-completed transitions', async () => {
+ const { result } = renderHook(() => useChatStore());
+ const topicId = 'update-status-running-topic';
+
+ const updateSpy = vi.spyOn(topicService, 'updateTopic').mockResolvedValue(undefined as any);
+
+ await act(async () => {
+ await result.current.updateTopicStatus({ status: 'running', topicId });
+ });
+
+ // Agent-run status writes must stay a pure status update — no completedAt.
+ expect(updateSpy).toHaveBeenCalledWith(topicId, { status: 'running' });
+ });
+ });
describe('useFetchTopics', () => {
it('should fetch topics for a given session id', async () => {
const sessionId = 'test-session-id';
diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.ts
index d3208d03627..9379c4ca13c 100644
--- a/src/store/chat/slices/topic/action.ts
+++ b/src/store/chat/slices/topic/action.ts
@@ -473,6 +473,13 @@ export class ChatTopicActionImpl {
// Already at the target status — both the in-memory and DB writes are no-ops.
if (topic?.status === status) return;
+ // "Archive" in the UI writes status:'completed'. Stamp `completedAt` on that
+ // transition so bulk/stale archive records when the topic was completed,
+ // matching the single-item `markTopicCompleted`. Other status transitions
+ // (agent runs → running/active/unread/…) leave `completedAt` untouched.
+ const patch: Partial<ChatTopic> =
+ status === 'completed' ? { completedAt: new Date(), status } : { status };
+
this.#pendingTopicStatusWrites.set(topicId, { expiresAt: Date.now() + 15_000, status });
// Scope on the payload routes the write to the owning bucket inside
@@ -481,13 +488,13 @@ export class ChatTopicActionImpl {
state.internal_dispatchTopic({
type: 'updateTopic',
id: topicId,
- value: { status },
+ value: patch,
agentId,
groupId,
scope,
});
- await topicService.updateTopic(topicId, { status }).catch((err) => {
+ await topicService.updateTopic(topicId, patch).catch((err) => {
console.error('[updateTopicStatus] persist failed:', err);
// The DB never got the write — stop pinning it over fetched rows.
this.#pendingTopicStatusWrites.delete(topicId);