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.

🐛 fix: add unread completion notification for group topic orchestration (#13407)

Arvin Xu23eab8769baa
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
index 03ac29080b2..facf671a572 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -45,6 +45,16 @@ const styles = createStaticStyles(({ css }) => ({
transition: width 0.2s ${cssVar.motionEaseOut};
`,
+ neonDot: css`
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+
+ background: ${cssVar.colorInfo};
+ box-shadow:
+ 0 0 3px ${cssVar.colorInfo},
+ 0 0 6px ${cssVar.colorInfo};
+ `,
}));
interface TopicItemProps {
@@ -119,7 +129,7 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, meta
});
const hasUnread = id && isUnreadCompleted;
- const successColor = cssVar.colorSuccess;
+ const infoColor = cssVar.colorInfo;
const unreadNode = (
<span className={styles.dotContainer} style={{ width: hasUnread ? 18 : 0 }}>
<AnimatePresence mode="popLayout">
@@ -137,23 +147,17 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId, meta
}}
>
<m.span
+ className={styles.neonDot}
initial={false}
animate={{
scale: [1, 1.3, 1],
opacity: [1, 0.9, 1],
boxShadow: [
- `0 0 3px ${successColor}, 0 0 6px ${successColor}`,
- `0 0 5px ${successColor}, 0 0 8px color-mix(in srgb, ${successColor} 60%, transparent)`,
- `0 0 3px ${successColor}, 0 0 6px ${successColor}`,
+ `0 0 3px ${infoColor}, 0 0 6px ${infoColor}`,
+ `0 0 5px ${infoColor}, 0 0 8px color-mix(in srgb, ${infoColor} 60%, transparent)`,
+ `0 0 3px ${infoColor}, 0 0 6px ${infoColor}`,
],
}}
- style={{
- width: 6,
- height: 6,
- borderRadius: '50%',
- background: successColor,
- boxShadow: `0 0 3px ${successColor}, 0 0 6px ${successColor}`,
- }}
transition={{
duration: 1.2,
repeat: Infinity,
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
index 3f207fdc348..7ce1c5d1245 100644
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx
@@ -1,6 +1,7 @@
import { Flexbox, Icon, Skeleton, Tag } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
+import { createStaticStyles, cssVar } from 'antd-style';
import { HashIcon, MessageSquareDashed } from 'lucide-react';
+import { AnimatePresence, m } from 'motion/react';
import { memo, Suspense, useCallback, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,6 +10,7 @@ import { pluginRegistry } from '@/features/Electron/titlebar/RecentlyViewed/plug
import NavItem from '@/features/NavPanel/components/NavItem';
import { useAgentGroupStore } from '@/store/agentGroup';
import { useChatStore } from '@/store/chat';
+import { operationSelectors } from '@/store/chat/selectors';
import { useElectronStore } from '@/store/electron';
import { useGlobalStore } from '@/store/global';
@@ -17,6 +19,42 @@ import Actions from './Actions';
import Editing from './Editing';
import { useTopicItemDropdownMenu } from './useDropdownMenu';
+const styles = createStaticStyles(({ css }) => ({
+ neonDotWrapper: css`
+ position: absolute;
+ inset: 0;
+
+ display: flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+
+ width: 18px;
+ height: 18px;
+ `,
+ dotContainer: css`
+ will-change: width;
+
+ position: relative;
+
+ width: 18px;
+ height: 18px;
+ margin-inline-start: -6px;
+
+ transition: width 0.2s ${cssVar.motionEaseOut};
+ `,
+ neonDot: css`
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+
+ background: ${cssVar.colorInfo};
+ box-shadow:
+ 0 0 3px ${cssVar.colorInfo},
+ 0 0 6px ${cssVar.colorInfo};
+ `,
+}));
+
interface TopicItemProps {
active?: boolean;
fav?: boolean;
@@ -42,6 +80,10 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId }) =>
id ? s.topicLoadingIds.includes(id) : false,
]);
+ const isUnreadCompleted = useChatStore(
+ id ? operationSelectors.isTopicUnreadCompleted(id) : () => false,
+ );
+
const toggleEditing = useCallback(
(visible?: boolean) => {
useChatStore.setState({ topicRenamingId: visible && id ? id : '' });
@@ -84,6 +126,48 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId }) =>
toggleEditing,
});
+ const hasUnread = id && isUnreadCompleted;
+ const infoColor = cssVar.colorInfo;
+ const unreadNode = (
+ <span className={styles.dotContainer} style={{ width: hasUnread ? 18 : 0 }}>
+ <AnimatePresence mode="popLayout">
+ {hasUnread && (
+ <m.div
+ className={styles.neonDotWrapper}
+ initial={{ scale: 0, opacity: 0 }}
+ animate={{
+ scale: 1,
+ opacity: 1,
+ }}
+ exit={{
+ scale: 0,
+ opacity: 0,
+ }}
+ >
+ <m.span
+ className={styles.neonDot}
+ initial={false}
+ animate={{
+ scale: [1, 1.3, 1],
+ opacity: [1, 0.9, 1],
+ boxShadow: [
+ `0 0 3px ${infoColor}, 0 0 6px ${infoColor}`,
+ `0 0 5px ${infoColor}, 0 0 8px color-mix(in srgb, ${infoColor} 60%, transparent)`,
+ `0 0 3px ${infoColor}, 0 0 6px ${infoColor}`,
+ ],
+ }}
+ transition={{
+ duration: 1.2,
+ repeat: Infinity,
+ ease: 'easeInOut',
+ }}
+ />
+ </m.div>
+ )}
+ </AnimatePresence>
+ </span>
+ );
+
// For default topic (no id)
if (!id) {
return (
@@ -125,6 +209,9 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId }) =>
icon={
<Icon icon={HashIcon} size={'small'} style={{ color: cssVar.colorTextDescription }} />
}
+ slots={{
+ iconPostfix: unreadNode,
+ }}
onClick={handleClick}
onDoubleClick={handleDoubleClick}
/>
diff --git a/src/store/chat/slices/aiAgent/actions/groupOrchestration.ts b/src/store/chat/slices/aiAgent/actions/groupOrchestration.ts
index d39b90d65b3..1b6f0068e7d 100644
--- a/src/store/chat/slices/aiAgent/actions/groupOrchestration.ts
+++ b/src/store/chat/slices/aiAgent/actions/groupOrchestration.ts
@@ -346,6 +346,13 @@ export class GroupOrchestrationActionImpl {
// 8. Complete Operation
if (state.status === 'done') {
this.#get().completeOperation(operationId);
+
+ // Mark unread completion for background conversations
+ const completedOp = this.#get().operations[operationId];
+ if (completedOp?.context.agentId) {
+ this.#get().markUnreadCompleted(completedOp.context.agentId, completedOp.context.topicId);
+ }
+
log('[internal_execGroupOrchestration] Operation completed successfully');
} else if (state.status === 'error') {
this.#get().failOperation(operationId, {