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.

✨ feat(topic): add bulk move topics to another assistant UI (#15809)

Arvin Xu455c25ed1be2
diff --git a/.agents/skills/react/SKILL.md b/.agents/skills/react/SKILL.md
index b68b3789334..dfe64dcf6ba 100644
--- a/.agents/skills/react/SKILL.md
+++ b/.agents/skills/react/SKILL.md
@@ -53,6 +53,20 @@ For Modal specifically, see the dedicated **modal** skill — use the imperative
| Layout | Center, DraggablePanel, Flexbox, Grid, Header, MaskShadow |
| Navigation | Burger, Menu, SideNav, Tabs |
+## Loading indicators
+
+**Do NOT use antd `Spin` / `<Spin />`** — it doesn't match the product's loading
+visual. Use the project loaders in `src/components` instead:
+
+| Need | Component |
+| ------------------------------ | ----------------------------------------------------------------------------- |
+| Default loading (spinner spot) | `NeuralNetworkLoading` from `@/components/NeuralNetworkLoading` (`size` prop) |
+| Inline dots | `DotsLoading` / `BubblesLoading` from `@/components` |
+| Branded full-page | `Loading` from `@/components/Loading/BrandTextLoading` |
+
+When in doubt, reach for `NeuralNetworkLoading` — it is the default in-flight
+indicator (e.g. modal "in progress" states).
+
## State
When a feature component manages more than 3 pieces of state (`useState`/`useReducer`/derived state), extract the logic into a custom hook (e.g. `useXxx`). Keep the component focused on rendering — the hook holds state and handlers, so logic can be unit-tested without rendering the component.
@@ -108,15 +122,16 @@ errorElement: <ErrorBoundary />;
## Common Mistakes
-| Mistake | Fix |
-| ------------------------------------------------------------------ | --------------------------------------------------------------------------- |
-| Using `next/link` in SPA | Use `react-router-dom` `Link` |
-| Using antd directly | Use `@lobehub/ui/base-ui` first, then `@lobehub/ui` |
-| `import { Select } from '@lobehub/ui'` | `import { Select } from '@lobehub/ui/base-ui'` |
-| `import { Modal } from '@lobehub/ui'` + `<Modal open>` declarative | `createModal` / `confirmModal` from `@lobehub/ui/base-ui` (see modal skill) |
-| `import { DropdownMenu/Popover/Switch } from '@lobehub/ui'` | Import same name from `@lobehub/ui/base-ui` instead |
-| `createStyles` for static styles | Use `createStaticStyles` + `cssVar` |
-| Editing only `desktopRouter.config.tsx` | Must edit both `.tsx` and `.desktop.tsx` |
-| Using `margin` for flex spacing | Use `gap` prop on Flexbox |
-| Accessing zustand store without selector | Use selectors to access store data (see zustand skill) |
-| Text or icon-text actions built with `Flexbox`/`Text` + `onClick` | Use `Button type={'text'} size={'small'}` with `icon` when needed |
+| Mistake | Fix |
+| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
+| Using `next/link` in SPA | Use `react-router-dom` `Link` |
+| Using antd directly | Use `@lobehub/ui/base-ui` first, then `@lobehub/ui` |
+| antd `Spin` / `<Spin />` for loading | Use `NeuralNetworkLoading` from `@/components/NeuralNetworkLoading` (see Loading indicators) |
+| `import { Select } from '@lobehub/ui'` | `import { Select } from '@lobehub/ui/base-ui'` |
+| `import { Modal } from '@lobehub/ui'` + `<Modal open>` declarative | `createModal` / `confirmModal` from `@lobehub/ui/base-ui` (see modal skill) |
+| `import { DropdownMenu/Popover/Switch } from '@lobehub/ui'` | Import same name from `@lobehub/ui/base-ui` instead |
+| `createStyles` for static styles | Use `createStaticStyles` + `cssVar` |
+| Editing only `desktopRouter.config.tsx` | Must edit both `.tsx` and `.desktop.tsx` |
+| Using `margin` for flex spacing | Use `gap` prop on Flexbox |
+| Accessing zustand store without selector | Use selectors to access store data (see zustand skill) |
+| Text or icon-text actions built with `Flexbox`/`Text` + `onClick` | Use `Button type={'text'} size={'small'}` with `icon` when needed |
diff --git a/locales/en-US/topic.json b/locales/en-US/topic.json
index 3271c42eeec..7358ef0ca19 100644
--- a/locales/en-US/topic.json
+++ b/locales/en-US/topic.json
@@ -16,6 +16,7 @@
"actions.favorite": "Favorite",
"actions.import": "Import Conversation",
"actions.markCompleted": "Mark as Completed",
+ "actions.moveToAgent": "Move to another assistant",
"actions.openInNewTab": "Open in New Tab",
"actions.openInNewWindow": "Open in a new window",
"actions.removeAll": "Delete All Topics",
@@ -80,6 +81,9 @@
"management.bulk.deleteConfirm": "You are about to delete {{count}} topics. This action cannot be undone.",
"management.bulk.deleteTitle": "Delete topics?",
"management.bulk.favorite": "Favorite",
+ "management.bulk.move": "Move to assistant",
+ "management.bulk.moveEmpty": "No other assistants",
+ "management.bulk.moveSearchPlaceholder": "Search assistants…",
"management.bulk.selectedCount_one": "{{count}} selected",
"management.bulk.selectedCount_other": "{{count}} selected",
"management.card.noPreview": "No preview available",
@@ -118,6 +122,17 @@
"management.group.noProject": "No project",
"management.group.none": "None",
"management.loadingMore": "Loading more topics…",
+ "management.moveModal.back": "Back",
+ "management.moveModal.confirmContent_one": "Move {{count}} topic to “{{title}}”?",
+ "management.moveModal.confirmContent_other": "Move {{count}} topics to “{{title}}”?",
+ "management.moveModal.confirmOk": "Move",
+ "management.moveModal.doneOk": "Done",
+ "management.moveModal.done_one": "{{count}} topic moved",
+ "management.moveModal.done_other": "{{count}} topics moved",
+ "management.moveModal.error": "Move failed, please try again",
+ "management.moveModal.goToTarget": "Go to “{{title}}”",
+ "management.moveModal.moving": "Moving…",
+ "management.moveModal.title": "Move topics",
"management.searchPlaceholder": "Search this agent's topics…",
"management.sidebarEntry": "Topics",
"management.sort.createdAt": "Created time",
diff --git a/locales/zh-CN/topic.json b/locales/zh-CN/topic.json
index b1e30125f57..6d80e090b5b 100644
--- a/locales/zh-CN/topic.json
+++ b/locales/zh-CN/topic.json
@@ -16,6 +16,7 @@
"actions.favorite": "收藏",
"actions.import": "导入对话",
"actions.markCompleted": "标为已完成",
+ "actions.moveToAgent": "移动到其他助手",
"actions.openInNewTab": "在新标签页中打开",
"actions.openInNewWindow": "打开独立窗口",
"actions.removeAll": "删除全部话题",
@@ -80,6 +81,9 @@
"management.bulk.deleteConfirm": "即将删除 {{count}} 个话题,此操作无法撤销。",
"management.bulk.deleteTitle": "删除话题?",
"management.bulk.favorite": "收藏",
+ "management.bulk.move": "移动到助手",
+ "management.bulk.moveEmpty": "没有其他助手",
+ "management.bulk.moveSearchPlaceholder": "搜索助手…",
"management.bulk.selectedCount_one": "已选 {{count}} 项",
"management.bulk.selectedCount_other": "已选 {{count}} 项",
"management.card.noPreview": "暂无预览内容",
@@ -118,6 +122,17 @@
"management.group.noProject": "无项目",
"management.group.none": "不分组",
"management.loadingMore": "正在加载更多话题…",
+ "management.moveModal.back": "返回",
+ "management.moveModal.confirmContent_one": "确认将 {{count}} 个话题移动到「{{title}}」吗?",
+ "management.moveModal.confirmContent_other": "确认将 {{count}} 个话题移动到「{{title}}」吗?",
+ "management.moveModal.confirmOk": "确认移动",
+ "management.moveModal.doneOk": "完成",
+ "management.moveModal.done_one": "已移动 {{count}} 个话题",
+ "management.moveModal.done_other": "已移动 {{count}} 个话题",
+ "management.moveModal.error": "移动失败,请重试",
+ "management.moveModal.goToTarget": "前往「{{title}}」查看",
+ "management.moveModal.moving": "正在移动…",
+ "management.moveModal.title": "移动话题",
"management.searchPlaceholder": "在当前助手的话题中搜索…",
"management.sidebarEntry": "话题",
"management.sort.createdAt": "按创建时间",
diff --git a/packages/locales/src/default/topic.ts b/packages/locales/src/default/topic.ts
index 7a48d5fe3ad..207d073c1a7 100644
--- a/packages/locales/src/default/topic.ts
+++ b/packages/locales/src/default/topic.ts
@@ -13,6 +13,7 @@ export default {
'actions.copyWorkingDirectory': 'Copy Working Directory',
'actions.copyWorkingDirectorySuccess': 'Working directory copied',
'actions.duplicate': 'Duplicate',
+ 'actions.moveToAgent': 'Move to another assistant',
'actions.favorite': 'Favorite',
'actions.unfavorite': 'Unfavorite',
'actions.markCompleted': 'Mark as Completed',
@@ -92,6 +93,9 @@ export default {
'You are about to delete {{count}} topics. This action cannot be undone.',
'management.bulk.deleteTitle': 'Delete topics?',
'management.bulk.favorite': 'Favorite',
+ 'management.bulk.move': 'Move to assistant',
+ 'management.bulk.moveEmpty': 'No other assistants',
+ 'management.bulk.moveSearchPlaceholder': 'Search assistants…',
'management.bulk.selectedCount_one': '{{count}} selected',
'management.bulk.selectedCount_other': '{{count}} selected',
'management.card.noPreview': 'No preview available',
@@ -131,6 +135,17 @@ export default {
'management.group.none': 'None',
'management.group.noProject': 'No project',
'management.loadingMore': 'Loading more topics…',
+ 'management.moveModal.back': 'Back',
+ 'management.moveModal.confirmContent_one': 'Move {{count}} topic to “{{title}}”?',
+ 'management.moveModal.confirmContent_other': 'Move {{count}} topics to “{{title}}”?',
+ 'management.moveModal.confirmOk': 'Move',
+ 'management.moveModal.done_one': '{{count}} topic moved',
+ 'management.moveModal.done_other': '{{count}} topics moved',
+ 'management.moveModal.doneOk': 'Done',
+ 'management.moveModal.error': 'Move failed, please try again',
+ 'management.moveModal.goToTarget': 'Go to “{{title}}”',
+ 'management.moveModal.moving': 'Moving…',
+ 'management.moveModal.title': 'Move topics',
'management.searchPlaceholder': "Search this agent's topics…",
'management.sidebarEntry': 'Topics',
'management.sort.createdAt': 'Created time',
diff --git a/src/features/AgentTopicManager/BulkActionBar.tsx b/src/features/AgentTopicManager/BulkActionBar.tsx
index 906c89eb5cb..04d2e793d03 100644
--- a/src/features/AgentTopicManager/BulkActionBar.tsx
+++ b/src/features/AgentTopicManager/BulkActionBar.tsx
@@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next';
import { useChatStore } from '@/store/chat';
+import MoveToAgentButton from './MoveToAgentButton';
import { useTopicsViewStore } from './store';
const styles = createStaticStyles(({ css }) => ({
@@ -103,6 +104,7 @@ const BulkActionBar = memo(() => {
title={t('management.bulk.archive')}
onClick={handleBatchArchive}
/>
+ <MoveToAgentButton />
<ActionIcon
icon={Trash2}
size={'small'}
diff --git a/src/features/AgentTopicManager/MoveToAgentButton.tsx b/src/features/AgentTopicManager/MoveToAgentButton.tsx
new file mode 100644
index 00000000000..c09bc887b55
--- /dev/null
+++ b/src/features/AgentTopicManager/MoveToAgentButton.tsx
@@ -0,0 +1,39 @@
+'use client';
+
+import { ActionIcon } from '@lobehub/ui';
+import { FolderInput } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useChatStore } from '@/store/chat';
+
+import { createMoveTopicsModal } from './MoveTopicsModal';
+import { useTopicsViewStore } from './store';
+
+const MoveToAgentButton = memo(() => {
+ const { t } = useTranslation('topic');
+
+ const selectedIds = useTopicsViewStore((s) => s.selectedIds);
+ const exitSelectMode = useTopicsViewStore((s) => s.exitSelectMode);
+ const activeAgentId = useChatStore((s) => s.activeAgentId);
+
+ return (
+ <ActionIcon
+ icon={FolderInput}
+ size={'small'}
+ title={t('management.bulk.move')}
+ onClick={() => {
+ if (selectedIds.length === 0) return;
+ createMoveTopicsModal({
+ onMoved: exitSelectMode,
+ sourceAgentId: activeAgentId,
+ topicIds: selectedIds,
+ });
+ }}
+ />
+ );
+});
+
+MoveToAgentButton.displayName = 'AgentTopicManagerMoveToAgentButton';
+
+export default MoveToAgentButton;
diff --git a/src/features/AgentTopicManager/MoveTopicsModal/Content.tsx b/src/features/AgentTopicManager/MoveTopicsModal/Content.tsx
new file mode 100644
index 00000000000..d5ab09fa7f9
--- /dev/null
+++ b/src/features/AgentTopicManager/MoveTopicsModal/Content.tsx
@@ -0,0 +1,222 @@
+'use client';
+
+import { DEFAULT_INBOX_AVATAR } from '@lobechat/const';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { useModalContext } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { CircleCheck } from 'lucide-react';
+import { memo, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+
+import { message } from '@/components/AntdStaticMethods';
+import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
+import { SESSION_CHAT_URL } from '@/const/url';
+import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import AgentItem from '@/features/PageEditor/Copilot/AgentSelector/AgentItem';
+import { useFetchAgentList } from '@/hooks/useFetchAgentList';
+import { useAgentStore } from '@/store/agent';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
+import { useChatStore } from '@/store/chat';
+import { useHomeStore } from '@/store/home';
+import { homeAgentListSelectors } from '@/store/home/selectors';
+
+type Step = 'pick' | 'confirm' | 'moving' | 'done';
+
+export interface MoveTopicsContentProps {
+ /** Called after the move succeeds (e.g. to exit multi-select mode). */
+ onMoved?: () => void;
+ /** Source agent — excluded from the picker so a no-op move can't be chosen. */
+ sourceAgentId?: string | null;
+ topicIds: string[];
+}
+
+const styles = createStaticStyles(({ css }) => ({
+ searchInput: css`
+ width: 100%;
+ padding-block: 6px;
+ padding-inline: 10px;
+ border: none;
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+
+ font-family: inherit;
+ font-size: 13px;
+ color: ${cssVar.colorText};
+
+ background: transparent;
+ outline: none;
+
+ &::placeholder {
+ color: ${cssVar.colorTextPlaceholder};
+ }
+ `,
+}));
+
+const MoveTopicsContent = memo<MoveTopicsContentProps>(({ onMoved, sourceAgentId, topicIds }) => {
+ const { t } = useTranslation(['topic', 'chat', 'common']);
+ const { close, setCanDismissByClickOutside } = useModalContext();
+ const navigate = useNavigate();
+
+ const [step, setStep] = useState<Step>('pick');
+ const [search, setSearch] = useState('');
+ const [target, setTarget] = useState<{ id: string; title: string } | null>(null);
+
+ const batchMoveTopicsToAgent = useChatStore((s) => s.batchMoveTopicsToAgent);
+ const agents = useHomeStore(homeAgentListSelectors.allAgents);
+ const isAgentListInit = useHomeStore(homeAgentListSelectors.isAgentListInit);
+
+ // The inbox (default "LobeAI") agent is virtual, so it's filtered out of the
+ // sidebar agent list — add it back so topics can be moved to it too.
+ const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
+ const inboxMeta = useAgentStore((s) =>
+ inboxAgentId ? agentSelectors.getAgentMetaById(inboxAgentId)(s) : undefined,
+ );
+
+ useFetchAgentList();
+
+ const count = topicIds.length;
+
+ // Source agent is excluded — moving topics back to where they already live
+ // would be a no-op. The inbox agent is prepended when not already present.
+ const targetAgents = useMemo(() => {
+ const available = agents.filter((a) => a.type === 'agent');
+ const withInbox =
+ inboxAgentId && !available.some((a) => a.id === inboxAgentId)
+ ? [
+ {
+ avatar: inboxMeta?.avatar || DEFAULT_INBOX_AVATAR,
+ description: null,
+ id: inboxAgentId,
+ pinned: false,
+ title: inboxMeta?.title || t('inbox.title', { ns: 'chat' }),
+ type: 'agent' as const,
+ updatedAt: new Date(),
+ },
+ ...available,
+ ]
+ : available;
+ return withInbox.filter((a) => a.id !== sourceAgentId);
+ }, [agents, inboxAgentId, inboxMeta, sourceAgentId, t]);
+
+ const filteredAgents = useMemo(() => {
+ const q = search.trim().toLowerCase();
+ if (!q) return targetAgents;
+ return targetAgents.filter((a) => (a.title || '').toLowerCase().includes(q));
+ }, [targetAgents, search]);
+
+ const handleConfirm = async () => {
+ if (!target) return;
+ setStep('moving');
+ // Lock dismissal so the move can't be interrupted mid-flight.
+ setCanDismissByClickOutside?.(false);
+ try {
+ await batchMoveTopicsToAgent(topicIds, target.id);
+ onMoved?.();
+ setStep('done');
+ } catch (error) {
+ console.error('[MoveTopics] move failed:', error);
+ message.error(t('management.moveModal.error'));
+ setStep('confirm');
+ } finally {
+ setCanDismissByClickOutside?.(true);
+ }
+ };
+
+ if (step === 'pick') {
+ return (
+ <Flexbox>
+ <input
+ autoFocus
+ className={styles.searchInput}
+ placeholder={t('management.bulk.moveSearchPlaceholder')}
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ />
+ {!isAgentListInit ? (
+ <SkeletonList rows={6} />
+ ) : filteredAgents.length === 0 ? (
+ <Flexbox align={'center'} justify={'center'} padding={24}>
+ <Text fontSize={12} type={'secondary'}>
+ {t('management.bulk.moveEmpty')}
+ </Text>
+ </Flexbox>
+ ) : (
+ <Flexbox
+ gap={4}
+ padding={8}
+ style={{ maxHeight: '50vh', overflowY: 'auto', width: '100%' }}
+ >
+ {filteredAgents.map((agent) => (
+ <AgentItem
+ active={false}
+ agentId={agent.id}
+ agentTitle={agent.title || t('untitledAgent', { ns: 'chat' })}
+ avatar={agent.avatar}
+ key={agent.id}
+ onClose={() => {}}
+ onAgentChange={() => {
+ setTarget({
+ id: agent.id,
+ title: agent.title || t('untitledAgent', { ns: 'chat' }),
+ });
+ setStep('confirm');
+ }}
+ />
+ ))}
+ </Flexbox>
+ )}
+ </Flexbox>
+ );
+ }
+
+ if (step === 'confirm') {
+ return (
+ <Flexbox gap={20} padding={24}>
+ <Text>{t('management.moveModal.confirmContent', { count, title: target?.title })}</Text>
+ <Flexbox horizontal gap={8} justify={'flex-end'}>
+ <Button onClick={() => setStep('pick')}>{t('management.moveModal.back')}</Button>
+ <Button type={'primary'} onClick={handleConfirm}>
+ {t('management.moveModal.confirmOk')}
+ </Button>
+ </Flexbox>
+ </Flexbox>
+ );
+ }
+
+ if (step === 'moving') {
+ return (
+ <Flexbox align={'center'} gap={16} justify={'center'} padding={48}>
+ <NeuralNetworkLoading size={48} />
+ <Text type={'secondary'}>{t('management.moveModal.moving')}</Text>
+ </Flexbox>
+ );
+ }
+
+ // done
+ return (
+ <Flexbox align={'center'} gap={20} justify={'center'} padding={48}>
+ <Flexbox align={'center'} gap={12}>
+ <Icon color={cssVar.colorSuccess} icon={CircleCheck} size={32} />
+ <Text weight={500}>{t('management.moveModal.done', { count })}</Text>
+ </Flexbox>
+ <Flexbox horizontal gap={8}>
+ <Button onClick={close}>{t('management.moveModal.doneOk')}</Button>
+ {target && (
+ <Button
+ type={'primary'}
+ onClick={() => {
+ navigate(SESSION_CHAT_URL(target.id));
+ close();
+ }}
+ >
+ {t('management.moveModal.goToTarget', { title: target.title })}
+ </Button>
+ )}
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+MoveTopicsContent.displayName = 'MoveTopicsContent';
+
+export default MoveTopicsContent;
diff --git a/src/features/AgentTopicManager/MoveTopicsModal/index.tsx b/src/features/AgentTopicManager/MoveTopicsModal/index.tsx
new file mode 100644
index 00000000000..8d0ac56d18e
--- /dev/null
+++ b/src/features/AgentTopicManager/MoveTopicsModal/index.tsx
@@ -0,0 +1,18 @@
+'use client';
+
+import { createModal, type ModalInstance } from '@lobehub/ui/base-ui';
+import { t } from 'i18next';
+
+import MoveTopicsContent, { type MoveTopicsContentProps } from './Content';
+
+export const createMoveTopicsModal = (props: MoveTopicsContentProps): ModalInstance =>
+ createModal({
+ content: <MoveTopicsContent {...props} />,
+ footer: null,
+ maskClosable: true,
+ styles: {
+ content: { overflow: 'hidden', padding: 0 },
+ },
+ title: t('management.moveModal.title', { ns: 'topic' }),
+ width: 'min(90%, 420px)',
+ });
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.test.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.test.tsx
index 56c6ed3410a..22099ac839c 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.test.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/useDropdownMenu.test.tsx
@@ -121,6 +121,7 @@ describe('useTopicItemDropdownMenu', () => {
'autoRename',
'rename',
'duplicate',
+ 'moveToAgent',
'share',
'delete',
]) {
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 f7c28b62d43..0bca46ade2b 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
@@ -7,6 +7,7 @@ import {
CheckCircle2,
Circle,
ExternalLink,
+ FolderInput,
Hash,
Link2,
LucideCopy,
@@ -23,6 +24,7 @@ import { useTranslation } from 'react-i18next';
import { openRenameModal } from '@/components/RenameModal';
import { SESSION_CHAT_TOPIC_URL } from '@/const/url';
import { isDesktop } from '@/const/version';
+import { createMoveTopicsModal } from '@/features/AgentTopicManager/MoveTopicsModal';
import { openShareModal } from '@/features/ShareModal';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useAppOrigin } from '@/hooks/useAppOrigin';
@@ -196,6 +198,15 @@ export const useTopicItemDropdownMenu = ({
duplicateTopic(id);
},
},
+ {
+ disabled: !canEditTopic,
+ icon: <Icon icon={FolderInput} />,
+ key: 'moveToAgent',
+ label: t('actions.moveToAgent'),
+ onClick: () => {
+ createMoveTopicsModal({ sourceAgentId: activeAgentId, topicIds: [id] });
+ },
+ },
{
type: 'divider' as const,
},
diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.ts
index 40720add779..b29209e5d94 100644
--- a/src/store/chat/slices/topic/action.ts
+++ b/src/store/chat/slices/topic/action.ts
@@ -926,6 +926,25 @@ export class ChatTopicActionImpl {
switchTopic(null);
};
+ batchMoveTopicsToAgent = async (topicIds: string[], targetAgentId: string): Promise<void> => {
+ if (topicIds.length === 0) return;
+
+ const { activeTopicId, switchTopic, refreshTopic, purgeUnreadTopics } = this.#get();
+
+ await topicService.batchMoveTopics(topicIds, targetAgentId);
+
+ // Moved topics leave the current agent's list — drop them locally so the UI
+ // updates immediately, then refetch to reconcile with the server.
+ topicIds.forEach((id) =>
+ this.#get().internal_dispatchTopic({ type: 'deleteTopic', id }, 'batchMoveTopicsToAgent'),
+ );
+ purgeUnreadTopics(topicIds);
+ await refreshTopic();
+
+ // If the active topic was moved away, fall back to the default topic.
+ if (activeTopicId && topicIds.includes(activeTopicId)) switchTopic(null);
+ };
+
internal_updateTopicTitleInSummary = (id: string, title: string): void => {
this.#get().internal_dispatchTopic(
{ type: 'updateTopic', id, value: { title } },