🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat: add unread completion indicator for agents and topics
Inneid1d46cfb412e
diff --git a/eslint-suppressions.json b/eslint-suppressions.jsonindex 4929e546d48..3233e3b78b5 100644--- a/eslint-suppressions.json+++ b/eslint-suppressions.json@@ -20,11 +20,6 @@"count": 1}},- "packages/builtin-tool-cloud-sandbox/src/manifest.ts": {- "sort-keys-fix/sort-keys-fix": {- "count": 1- }- },"packages/builtin-tool-group-agent-builder/src/manifest.ts": {"sort-keys-fix/sort-keys-fix": {"count": 2@@ -1074,11 +1069,6 @@"count": 1}},- "src/store/chat/slices/operation/actions.ts": {- "sort-keys-fix/sort-keys-fix": {- "count": 1- }- },"src/store/chat/slices/operation/types.ts": {"sort-keys-fix/sort-keys-fix": {"count": 1diff --git a/src/app/[variants]/(auth)/oauth/consent/[uid]/components/OAuthApplicationLogo.tsx b/src/app/[variants]/(auth)/oauth/consent/[uid]/components/OAuthApplicationLogo.tsxindex 4aee02b29e5..38b34612044 100644--- a/src/app/[variants]/(auth)/oauth/consent/[uid]/components/OAuthApplicationLogo.tsx+++ b/src/app/[variants]/(auth)/oauth/consent/[uid]/components/OAuthApplicationLogo.tsx@@ -10,7 +10,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({width: 40px;height: 40px;- @media (max-width: 768px) {+ @media (width <= 768px) {width: 32px;height: 32px;}@@ -20,7 +20,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({height: 1px;background-color: ${cssVar.colorBorderSecondary};- @media (max-width: 768px) {+ @media (width <= 768px) {width: 24px;}`,diff --git a/src/app/[variants]/(main)/agent/_layout/AgentIdSync.tsx b/src/app/[variants]/(main)/agent/_layout/AgentIdSync.tsxindex 184e40bd436..6a541da5e8f 100644--- a/src/app/[variants]/(main)/agent/_layout/AgentIdSync.tsx+++ b/src/app/[variants]/(main)/agent/_layout/AgentIdSync.tsx@@ -22,6 +22,10 @@ const AgentIdSync = () => {if (prevAgentId !== undefined && prevAgentId !== params.aid) {useChatStore.getState().switchTopic(null, { skipRefreshMessage: true });}+ // Clear unread completion indicator for the agent being viewed+ if (params.aid) {+ useChatStore.getState().clearUnreadCompletedAgent(params.aid);+ }}, [params.aid, prevAgentId]);useMount(() => {diff --git a/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx b/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsxindex fb4da43a139..daff467bdbc 100644--- a/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx+++ b/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/index.tsx@@ -1,6 +1,7 @@import { ActionIcon, Flexbox, Icon, Skeleton, Tag } from '@lobehub/ui';-import { cssVar } from 'antd-style';+import { createStaticStyles, cssVar } from 'antd-style';import { MessageSquareDashed, Star } from 'lucide-react';+import { AnimatePresence, m as motion } from 'motion/react';import { memo, Suspense, useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';@@ -8,6 +9,7 @@ import { isDesktop } from '@/const/version';import NavItem from '@/features/NavPanel/components/NavItem';import { useAgentStore } from '@/store/agent';import { useChatStore } from '@/store/chat';+import { operationSelectors } from '@/store/chat/selectors';import { useGlobalStore } from '@/store/global';import { useTopicNavigation } from '../../hooks/useTopicNavigation';@@ -16,6 +18,32 @@ 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};+ `,+}));+interface TopicItemProps {active?: boolean;fav?: boolean;@@ -40,6 +68,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 [favoriteTopic] = useChatStore((s) => [s.favoriteTopic]);const { navigateToTopic, isInAgentSubRoute } = useTopicNavigation();@@ -68,6 +100,54 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId }) =>toggleEditing,});+ const hasUnread = id && isUnreadCompleted;+ const successColor = cssVar.colorSuccess;+ const unreadNode = (+ <span className={styles.dotContainer} style={{ width: hasUnread ? 18 : 0 }}>+ <AnimatePresence mode="popLayout">+ {hasUnread && (+ <motion.div+ className={styles.neonDotWrapper}+ initial={{ scale: 0, opacity: 0 }}+ animate={{+ scale: 1,+ opacity: 1,+ }}+ exit={{+ scale: 0,+ opacity: 0,+ }}+ >+ <motion.span+ 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}`,+ ],+ }}+ style={{+ width: 6,+ height: 6,+ borderRadius: '50%',+ background: successColor,+ boxShadow: `0 0 3px ${successColor}, 0 0 6px ${successColor}`,+ }}+ transition={{+ duration: 1.2,+ repeat: Infinity,+ ease: 'easeInOut',+ }}+ />+ </motion.div>+ )}+ </AnimatePresence>+ </span>+ );+// For default topic (no id)if (!id) {return (@@ -119,6 +199,9 @@ const TopicItem = memo<TopicItemProps>(({ id, title, fav, active, threadId }) =>}}/>}+ slots={{+ iconPostfix: unreadNode,+ }}onClick={handleClick}onDoubleClick={handleDoubleClick}/>diff --git a/src/app/[variants]/(main)/community/(detail)/user/features/Header/Banner.tsx b/src/app/[variants]/(main)/community/(detail)/user/features/Header/Banner.tsxindex 8f89cc382d2..078d8075e6a 100644--- a/src/app/[variants]/(main)/community/(detail)/user/features/Header/Banner.tsx+++ b/src/app/[variants]/(main)/community/(detail)/user/features/Header/Banner.tsx@@ -1,7 +1,7 @@'use client';import { Center } from '@lobehub/ui';-import { createStaticStyles , responsive } from 'antd-style';+import { createStaticStyles, responsive } from 'antd-style';import { memo } from 'react';const styles = createStaticStyles(({ css, cssVar }) => ({@@ -23,7 +23,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({margin-inline: -16px;}- @media (max-width: 1720px) {+ @media (width <= 1720px) {height: 144px;padding: 0;}@@ -42,7 +42,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillTertiary};- @media (max-width: 1720px) {+ @media (width <= 1720px) {border-radius: 0;}`,diff --git a/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx b/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsxindex 23b743d745d..7be822eac30 100644--- a/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx+++ b/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx@@ -27,7 +27,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorBgContainer};box-shadow:- 0 0 8px -2px rgba(0, 0, 0, 5%),+ 0 0 8px -2px rgb(0 0 0 / 5%),0 0 0 1px ${cssVar.colorFillTertiary};`,banner: css`@@ -36,7 +36,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({position: absolute;z-index: 0;inset-block-end: 0;- inset-inline: 0 0;+ inset-inline: 0;display: flex;gap: 12px;diff --git a/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx b/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsxindex 2e152245b58..447453292d7 100644--- a/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx+++ b/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx@@ -4,8 +4,8 @@import { Center } from '@lobehub/ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { Image as ImageIcon, X } from 'lucide-react';-import type {FC} from 'react';-import React, { memo, useEffect, useRef, useState } from 'react';+import type { FC } from 'react';+import React, { memo, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { CONFIG_PANEL_WIDTH } from '@/app/[variants]/(main)/image/_layout/ConfigPanel/constants';@@ -14,9 +14,9 @@ import { useUploadFilesValidation } from '@/app/[variants]/(main)/image/_layout/import { configPanelStyles } from '@/app/[variants]/(main)/image/_layout/ConfigPanel/style';import Image from '@/libs/next/Image';import { useFileStore } from '@/store/file';-import type {FileUploadStatus} from '@/types/files/upload';+import type { FileUploadStatus } from '@/types/files/upload';-import type {ImageItem} from './ImageManageModal';+import type { ImageItem } from './ImageManageModal';import ImageManageModal from './ImageManageModal';// ======== Business Types ======== //@@ -128,8 +128,8 @@ const styles = createStaticStyles(({ css }) => {moreOverlay: css`position: absolute;- inset-block: 0 0;- inset-inline: 0 0;+ inset-block: 0;+ inset-inline: 0;display: flex;align-items: center;@@ -265,8 +265,8 @@ const styles = createStaticStyles(({ css }) => {uploadMoreOverlay: css`position: absolute;z-index: 5;- inset-block: 0 0;- inset-inline: 0 0;+ inset-block: 0;+ inset-inline: 0;display: flex;align-items: center;diff --git a/src/app/[variants]/(main)/memory/features/TimeLineView/PeriodGroup.tsx b/src/app/[variants]/(main)/memory/features/TimeLineView/PeriodGroup.tsxindex 4b9a55a4661..92a5f723f97 100644--- a/src/app/[variants]/(main)/memory/features/TimeLineView/PeriodGroup.tsx+++ b/src/app/[variants]/(main)/memory/features/TimeLineView/PeriodGroup.tsx@@ -3,10 +3,10 @@import { Flexbox, Text } from '@lobehub/ui';import { createStaticStyles } from 'antd-style';import dayjs from 'dayjs';-import type {ReactNode} from 'react';+import type { ReactNode } from 'react';import { memo } from 'react';-import type {GroupBy} from './index';+import type { GroupBy } from './index';const styles = createStaticStyles(({ css, cssVar }) => ({itemWrapper: css`@@ -33,7 +33,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({border-radius: 50%;background: ${cssVar.colorBgElevated};- box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 40%);+ box-shadow: 0 2px 4px -2px rgb(0 0 0 / 40%);`,}));diff --git a/src/app/[variants]/(main)/resource/features/modal/FullscreenModal.tsx b/src/app/[variants]/(main)/resource/features/modal/FullscreenModal.tsxindex fd3326751b8..0307df49cef 100644--- a/src/app/[variants]/(main)/resource/features/modal/FullscreenModal.tsx+++ b/src/app/[variants]/(main)/resource/features/modal/FullscreenModal.tsx@@ -3,8 +3,8 @@import { Modal } from '@lobehub/ui';import { ConfigProvider } from 'antd';import { createStaticStyles, cx } from 'antd-style';-import type {ReactNode} from 'react';-import { useCallback, useState } from 'react';+import type { ReactNode } from 'react';+import { useCallback, useState } from 'react';const styles = createStaticStyles(({ css, cssVar }) => ({body: css`@@ -19,7 +19,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({extra: css`position: fixed;z-index: ${cssVar.zIndexPopupBase + 10};- inset-block: 0 0;+ inset-block: 0;inset-inline-end: 0;width: 0;diff --git a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsxindex 23bc7067a3d..ccf016b9343 100644--- a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx@@ -81,10 +81,12 @@ const ChatAppearance = memo(() => {active={false}collapsible={false}desc={t('settingChatAppearance.autoScrollOnStreaming.desc')}+ title={t('settingChatAppearance.autoScrollOnStreaming.title')}+ variant={'filled'}extra={- <Flexbox align={'center'} gap={8} horizontal>+ <Flexbox horizontal align={'center'} gap={8}>{loadingStates.enableAutoScrollOnStreaming && (- <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />+ <Icon spin icon={Loader2Icon} size={16} style={{ opacity: 0.5 }} />)}<Switchchecked={general.enableAutoScrollOnStreaming ?? true}@@ -92,8 +94,6 @@ const ChatAppearance = memo(() => {/></Flexbox>}- title={t('settingChatAppearance.autoScrollOnStreaming.title')}- variant={'filled'}>{null}</FormGroup>diff --git a/src/app/[variants]/(mobile)/_layout/NavBar.tsx b/src/app/[variants]/(mobile)/_layout/NavBar.tsxindex 87900195530..8e57f6f7b9a 100644--- a/src/app/[variants]/(mobile)/_layout/NavBar.tsx+++ b/src/app/[variants]/(mobile)/_layout/NavBar.tsx@@ -1,8 +1,8 @@'use client';import { Icon } from '@lobehub/ui';-import type {TabBarProps} from '@lobehub/ui/mobile';-import { TabBar } from '@lobehub/ui/mobile';+import type { TabBarProps } from '@lobehub/ui/mobile';+import { TabBar } from '@lobehub/ui/mobile';import { createStaticStyles } from 'antd-style';import { Compass, MessageSquare, User } from 'lucide-react';import { memo, useMemo } from 'react';@@ -24,7 +24,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({position: fixed;z-index: 100;inset-block-end: 0;- inset-inline: 0 0;+ inset-inline: 0;`,}));diff --git a/src/app/[variants]/(mobile)/community/(list)/_layout/Header.tsx b/src/app/[variants]/(mobile)/community/(list)/_layout/Header.tsxindex d49914f1bd0..25160c5d941 100644--- a/src/app/[variants]/(mobile)/community/(list)/_layout/Header.tsx+++ b/src/app/[variants]/(mobile)/community/(list)/_layout/Header.tsx@@ -17,7 +17,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({position: absolute;z-index: 10;inset-block-start: 0;- inset-inline: 0 0;+ inset-inline: 0;background: ${cssVar.colorBgLayout};`,diff --git a/src/app/[variants]/initiallize.ts b/src/app/[variants]/initiallize.tsnew file mode 100644index 00000000000..d9df998a868--- /dev/null+++ b/src/app/[variants]/initiallize.ts@@ -0,0 +1,3 @@+import { enableMapSet } from 'immer';++enableMapSet();diff --git a/src/app/[variants]/layout.tsx b/src/app/[variants]/layout.tsxindex 1608af53194..b0ce737a9f6 100644--- a/src/app/[variants]/layout.tsx+++ b/src/app/[variants]/layout.tsx@@ -1,9 +1,11 @@+import './initiallize';+import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';import { SpeedInsights } from '@vercel/speed-insights/next';-import type {ResolvingViewport} from 'next';+import type { ResolvingViewport } from 'next';import Script from 'next/script';-import type {ReactNode} from 'react';-import { Suspense } from 'react';+import type { ReactNode } from 'react';+import { Suspense } from 'react';import { isRtlLang } from 'rtl-detect';import BusinessGlobalProvider from '@/business/client/BusinessGlobalProvider';@@ -12,8 +14,8 @@ import { DEFAULT_LANG } from '@/const/locale';import { isDesktop } from '@/const/version';import AuthProvider from '@/layout/AuthProvider';import GlobalProvider from '@/layout/GlobalProvider';-import type {Locales} from '@/locales/resources';-import type {DynamicLayoutProps} from '@/types/next';+import type { Locales } from '@/locales/resources';+import type { DynamicLayoutProps } from '@/types/next';import { RouteVariants } from '@/utils/server/routeVariants';const inVercel = process.env.VERCEL === '1';@@ -47,7 +49,6 @@ const RootLayout = async ({ children, params }: RootLayoutProps) => {return (<html suppressHydrationWarning dir={direction} lang={locale}><head>- { }<script dangerouslySetInnerHTML={{ __html: `(${outdateBrowserScript.toString()})();` }} />{process.env.DEBUG_REACT_SCAN === '1' && (<Script@@ -73,7 +74,6 @@ const RootLayout = async ({ children, params }: RootLayoutProps) => {};function outdateBrowserScript() {-function supportsImportMaps(): boolean {return (typeof HTMLScriptElement !== 'undefined' &&@@ -82,7 +82,6 @@ function outdateBrowserScript() {);}-function supportsCascadeLayers(): boolean {if (typeof document === 'undefined') return false;diff --git a/src/components/HighlightNotification/index.tsx b/src/components/HighlightNotification/index.tsxindex 316376dc91a..74728bd1e99 100644--- a/src/components/HighlightNotification/index.tsx+++ b/src/components/HighlightNotification/index.tsx@@ -5,7 +5,7 @@ import { ActionIcon, Button, Flexbox } from '@lobehub/ui';import { createStaticStyles, cssVar } from 'antd-style';import { X } from 'lucide-react';import Link from 'next/link';-import type {ReactNode} from 'react';+import type { ReactNode } from 'react';import { memo } from 'react';export interface HighlightNotificationProps {@@ -40,7 +40,7 @@ const styles = createStaticStyles(({ css }) => ({border-radius: 12px;background: ${cssVar.colorBgContainer};- box-shadow: 0 4px 24px rgba(0, 0, 0, 12%);+ box-shadow: 0 4px 24px rgb(0 0 0 / 12%);`,closeButton: css`position: absolute;diff --git a/src/features/AgentSetting/AgentOpening/OpeningQuestions.tsx b/src/features/AgentSetting/AgentOpening/OpeningQuestions.tsxindex 53bfd32d8bc..ea36f7b16cb 100644--- a/src/features/AgentSetting/AgentOpening/OpeningQuestions.tsx+++ b/src/features/AgentSetting/AgentOpening/OpeningQuestions.tsx@@ -113,7 +113,7 @@ const OpeningQuestions = memo(() => {{openingQuestions.length > 0 ? (<SortableListitems={items}- renderItem={(item) => (+ renderItem={(item: QuestionItem) => (<SortableList.ItemclassName={styles.questionItemContainer}id={item.id}diff --git a/src/features/Conversation/Error/style.tsx b/src/features/Conversation/Error/style.tsxindex b1f1079f9c3..15a44111a77 100644--- a/src/features/Conversation/Error/style.tsx+++ b/src/features/Conversation/Error/style.tsx@@ -1,7 +1,7 @@-import type {CenterProps} from '@lobehub/ui';-import { Avatar, Center, Flexbox } from '@lobehub/ui';-import { createStaticStyles,cssVar, cx } from 'antd-style';-import type {ReactNode} from 'react';+import type { CenterProps } from '@lobehub/ui';+import { Avatar, Center, Flexbox } from '@lobehub/ui';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import type { ReactNode } from 'react';import { memo } from 'react';export const styles = createStaticStyles(({ css, cssVar }) => ({@@ -19,7 +19,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({width: 100%;max-width: 360px;- @media (max-width: 768px) {+ @media (width <= 768px) {max-width: 90%;}`,diff --git a/src/features/FileViewer/Renderer/MSDoc/index.tsx b/src/features/FileViewer/Renderer/MSDoc/index.tsxindex f8a25bf7a6f..90108521e16 100644--- a/src/features/FileViewer/Renderer/MSDoc/index.tsx+++ b/src/features/FileViewer/Renderer/MSDoc/index.tsx@@ -12,7 +12,7 @@ const container = css`const content = css`position: absolute;- inset-block: -1px -1px;+ inset-block: -1px;inset-inline-start: -1px;width: calc(100% + 2px);diff --git a/src/features/FileViewer/Renderer/Video/index.tsx b/src/features/FileViewer/Renderer/Video/index.tsxindex 0d7524ee97a..bc5f6f3a423 100644--- a/src/features/FileViewer/Renderer/Video/index.tsx+++ b/src/features/FileViewer/Renderer/Video/index.tsx@@ -19,7 +19,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({box-shadow: ${cssVar.boxShadowTertiary};&::-webkit-media-controls-panel {- background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 30%) 100%);+ background: linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 30%) 100%);}&:focus {diff --git a/src/features/NavPanel/components/NavItem.tsx b/src/features/NavPanel/components/NavItem.tsxindex ac0f43327cb..2335db669e1 100644--- a/src/features/NavPanel/components/NavItem.tsx+++ b/src/features/NavPanel/components/NavItem.tsx@@ -1,16 +1,9 @@'use client';-import type {BlockProps, GenericItemType, IconProps} from '@lobehub/ui';-import {- Block,- Center,- ContextMenuTrigger,- Flexbox,- Icon,- Text-} from '@lobehub/ui';+import type { BlockProps, GenericItemType, IconProps } from '@lobehub/ui';+import { Block, Center, ContextMenuTrigger, Flexbox, Icon, Text } from '@lobehub/ui';import { createStaticStyles, cssVar, cx } from 'antd-style';-import type {ReactNode} from 'react';+import type { ReactNode } from 'react';import { memo } from 'react';import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';@@ -44,6 +37,11 @@ const styles = createStaticStyles(({ css }) => ({`,}));+export interface NavItemSlots {+ iconPostfix?: ReactNode;+ titlePrefix?: ReactNode;+}+export interface NavItemProps extends Omit<BlockProps, 'children' | 'title'> {actions?: ReactNode;active?: boolean;@@ -56,6 +54,7 @@ export interface NavItemProps extends Omit<BlockProps, 'children' | 'title'> {href?: string;icon?: IconProps['icon'];loading?: boolean;+ slots?: NavItemSlots;title: ReactNode;}@@ -72,12 +71,14 @@ const NavItem = memo<NavItemProps>(disabled,loading,extra,+ slots,...rest}) => {const iconColor = active ? cssVar.colorText : cssVar.colorTextDescription;const textColor = active ? cssVar.colorText : cssVar.colorTextSecondary;const variant = active ? 'filled' : 'borderless';+ const { titlePrefix, iconPostfix } = slots || {};// Link props for cmd+click supportconst linkProps = href? {@@ -119,8 +120,16 @@ const NavItem = memo<NavItemProps>(</Center>)}+ {iconPostfix}<Flexbox horizontal align={'center'} flex={1} gap={8} style={{ overflow: 'hidden' }}>- <Text ellipsis color={textColor} style={{ flex: 1 }}>+ {titlePrefix}+ <Text+ color={textColor}+ style={{ flex: 1 }}+ ellipsis={{+ tooltipWhenOverflow: true,+ }}+ >{title}</Text><Flexboxdiff --git a/src/features/ResourceManager/components/Explorer/ListView/ColumnResizeHandle.tsx b/src/features/ResourceManager/components/Explorer/ListView/ColumnResizeHandle.tsxindex bd46af88211..2cef2d3c79e 100644--- a/src/features/ResourceManager/components/Explorer/ListView/ColumnResizeHandle.tsx+++ b/src/features/ResourceManager/components/Explorer/ListView/ColumnResizeHandle.tsx@@ -10,7 +10,7 @@ const styles = createStaticStyles(({ css }) => ({position: absolute;z-index: 1;- inset-block: 0 0;+ inset-block: 0;inset-inline-end: 0;transform: translateX(-4px);diff --git a/src/features/ResourceManager/components/UploadDock/Item.tsx b/src/features/ResourceManager/components/UploadDock/Item.tsxindex 34f2f8fb1e6..e8dd678818d 100644--- a/src/features/ResourceManager/components/UploadDock/Item.tsx+++ b/src/features/ResourceManager/components/UploadDock/Item.tsx@@ -1,13 +1,13 @@import { ActionIcon, Flexbox, Text } from '@lobehub/ui';import { createStaticStyles } from 'antd-style';import { XIcon } from 'lucide-react';-import type {ReactNode} from 'react';-import { memo, useMemo } from 'react';+import type { ReactNode } from 'react';+import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';import FileIcon from '@/components/FileIcon';import { useFileStore } from '@/store/file';-import type {UploadFileItem} from '@/types/files/upload';+import type { UploadFileItem } from '@/types/files/upload';import { formatSize, formatSpeed, formatTime } from '@/utils/format';const styles = createStaticStyles(({ css, cssVar }) => {@@ -23,7 +23,7 @@ const styles = createStaticStyles(({ css, cssVar }) => {`,progress: css`position: absolute;- inset-block: 0 0;+ inset-block: 0;inset-inline: 0 1%;height: 100%;diff --git a/src/features/ResourceManager/components/UploadDock/index.tsx b/src/features/ResourceManager/components/UploadDock/index.tsxindex e5fc3c580e9..59b96949733 100644--- a/src/features/ResourceManager/components/UploadDock/index.tsx+++ b/src/features/ResourceManager/components/UploadDock/index.tsx@@ -32,7 +32,7 @@ const styles = createStaticStyles(({ css }) => {pointer-events: none;position: absolute;- inset-block: 0 0;+ inset-block: 0;inset-inline: 0 1%;height: 100%;diff --git a/src/features/ShareModal/SharePdf/PdfPreview.tsx b/src/features/ShareModal/SharePdf/PdfPreview.tsxindex 813c72c2c6d..90ca25352a6 100644--- a/src/features/ShareModal/SharePdf/PdfPreview.tsx+++ b/src/features/ShareModal/SharePdf/PdfPreview.tsx@@ -47,7 +47,7 @@ const styles = createStaticStyles(({ css }) => ({position: absolute;z-index: 10;inset-block-end: 0;- inset-inline: 0 0;+ inset-inline: 0;padding: 12px;border-block-start: 1px solid color-mix(in srgb, black 10%, transparent);diff --git a/src/features/User/UserAvatar.tsx b/src/features/User/UserAvatar.tsxindex a8d8dd65c81..ee042215d6c 100644--- a/src/features/User/UserAvatar.tsx+++ b/src/features/User/UserAvatar.tsx@@ -1,8 +1,8 @@'use client';import { BRANDING_NAME } from '@lobechat/business-const';-import type {AvatarProps} from '@lobehub/ui';-import { Avatar } from '@lobehub/ui';+import type { AvatarProps } from '@lobehub/ui';+import { Avatar } from '@lobehub/ui';import { createStaticStyles, cssVar } from 'antd-style';import { useMemo } from 'react';@@ -30,7 +30,7 @@ const styles = createStaticStyles(({ css }) => ({width: 25%;height: 100%;- background: rgba(255, 255, 255, 50%);+ background: rgb(255 255 255 / 50%);transition: all 200ms ease-out 0s;}@@ -49,42 +49,50 @@ export interface UserAvatarProps extends AvatarProps {clickable?: boolean;}-const UserAvatar = ({ ref, size = 40, background, clickable, className, style, ...rest }: UserAvatarProps & { ref?: React.RefObject<HTMLDivElement | null> }) => {- const [avatar, nickName, username] = useUserStore((s) => [- userProfileSelectors.userAvatar(s),- userProfileSelectors.nickName(s),- userProfileSelectors.username(s),- ]);-- const isSignedIn = useUserStore(authSelectors.isLogin);- const remoteServerUrl = useElectronStore(electronSyncSelectors.remoteServerUrl);-- // Process avatar URL for desktop environment- const avatarUrl = useMemo(() => {- if (!isSignedIn) return DEFAULT_USER_AVATAR_URL;- if (!avatar) return;-- // If in desktop environment and avatar starts with /, prepend the remote server URL- if (isDesktop && avatar.startsWith('/') && remoteServerUrl) {- return remoteServerUrl + avatar;- }+const UserAvatar = ({+ ref,+ size = 40,+ background,+ clickable,+ className,+ style,+ ...rest+}: UserAvatarProps & { ref?: React.RefObject<HTMLDivElement | null> }) => {+ const [avatar, nickName, username] = useUserStore((s) => [+ userProfileSelectors.userAvatar(s),+ userProfileSelectors.nickName(s),+ userProfileSelectors.username(s),+ ]);++ const isSignedIn = useUserStore(authSelectors.isLogin);+ const remoteServerUrl = useElectronStore(electronSyncSelectors.remoteServerUrl);++ // Process avatar URL for desktop environment+ const avatarUrl = useMemo(() => {+ if (!isSignedIn) return DEFAULT_USER_AVATAR_URL;+ if (!avatar) return;++ // If in desktop environment and avatar starts with /, prepend the remote server URL+ if (isDesktop && avatar.startsWith('/') && remoteServerUrl) {+ return remoteServerUrl + avatar;+ }- return avatar;- }, [isSignedIn, avatar, remoteServerUrl]);-- return (- <Avatar- alt={isSignedIn ? nickName || username || 'User' : BRANDING_NAME}- avatar={avatarUrl || nickName || username}- background={background}- className={clickable ? styles.clickable : className}- ref={ref}- shape={'square'}- size={size}- style={{ color: cssVar.colorText, flex: 'none', ...style }}- {...rest}- />- );- };+ return avatar;+ }, [isSignedIn, avatar, remoteServerUrl]);++ return (+ <Avatar+ alt={isSignedIn ? nickName || username || 'User' : BRANDING_NAME}+ avatar={avatarUrl || nickName || username}+ background={background}+ className={clickable ? styles.clickable : className}+ ref={ref}+ shape={'square'}+ size={size}+ style={{ color: cssVar.colorText, flex: 'none', ...style }}+ {...rest}+ />+ );+};export default UserAvatar;diff --git a/src/layout/GlobalProvider/AppTheme.tsx b/src/layout/GlobalProvider/AppTheme.tsxindex 343021ec9f0..59b8dba5d0d 100644--- a/src/layout/GlobalProvider/AppTheme.tsx+++ b/src/layout/GlobalProvider/AppTheme.tsx@@ -3,18 +3,14 @@import 'antd/dist/reset.css';import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';-import type {NeutralColors, PrimaryColors} from '@lobehub/ui';-import {- ConfigProvider,- FontLoader,- ThemeProvider-} from '@lobehub/ui';+import type { NeutralColors, PrimaryColors } from '@lobehub/ui';+import { ConfigProvider, FontLoader, ThemeProvider } from '@lobehub/ui';import { message as antdMessage } from 'antd';import { AppConfigContext } from 'antd/es/app/context';import { createStaticStyles, cx, useTheme } from 'antd-style';import * as motion from 'motion/react-m';-import type {ReactNode} from 'react';-import { memo, useEffect, useMemo, useState } from 'react';+import type { ReactNode } from 'react';+import { memo, useEffect, useMemo, useState } from 'react';import AntdStaticMethods from '@/components/AntdStaticMethods';import Link from '@/components/Link';@@ -43,7 +39,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({min-height: 100dvh;max-height: 100dvh;- @media (min-device-width: 576px) {+ @media (device-width >= 576px) {overflow: hidden;}`,diff --git a/src/store/chat/slices/aiAgent/actions/runAgent.ts b/src/store/chat/slices/aiAgent/actions/runAgent.tsindex 70c29b44554..d806e0de1a9 100644--- a/src/store/chat/slices/aiAgent/actions/runAgent.ts+++ b/src/store/chat/slices/aiAgent/actions/runAgent.ts@@ -1,12 +1,15 @@import { isDesktop } from '@lobechat/const';-import type {ChatToolPayload} from '@lobechat/types';+import type { ChatToolPayload } from '@lobechat/types';import debug from 'debug';import i18n from 'i18next';-import type {StreamEvent} from '@/services/agentRuntime';+import type { StreamEvent } from '@/services/agentRuntime';import { agentRuntimeService } from '@/services/agentRuntime';-import type {ChatStore} from '@/store/chat/store';-import type {StoreSetter} from '@/store/types';+import { getAgentStoreState } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';+import type { ChatStore } from '@/store/chat/store';+import { topicMapKey } from '@/store/chat/utils/topicMapKey';+import type { StoreSetter } from '@/store/types';const log = debug('store:chat:ai-agent:runAgent');@@ -240,14 +243,38 @@ export class AgentActionImpl {try {const { desktopNotificationService } =await import('@/services/electron/desktopNotification');++ // Use topic title or agent title as notification title+ let notificationTitle = i18n.t('desktopNotification.aiReplyCompleted.title', {+ ns: 'chat',+ });+ const opCtx = operation.context;+ if (opCtx.topicId && opCtx.agentId) {+ const key = topicMapKey({ agentId: opCtx.agentId, groupId: opCtx.groupId });+ const topicData = this.#get().topicDataMap[key];+ const topic = topicData?.items?.find((item) => item.id === opCtx.topicId);+ if (topic?.title) notificationTitle = topic.title;+ } else if (opCtx.agentId) {+ const agentMeta = agentSelectors.getAgentMetaById(opCtx.agentId)(+ getAgentStoreState(),+ );+ if (agentMeta?.title) notificationTitle = agentMeta.title;+ }+await desktopNotificationService.showNotification({body: i18n.t('desktopNotification.aiReplyCompleted.body', { ns: 'chat' }),- title: i18n.t('desktopNotification.aiReplyCompleted.title', { ns: 'chat' }),+ title: notificationTitle,});} catch (error) {console.error('Desktop notification error:', error);}}++ // Mark unread completion for background agents+ const op = this.#get().operations[operationId];+ if (op?.context.agentId) {+ this.#get().markUnreadCompleted(op.context.agentId, op.context.topicId);+ }break;}diff --git a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts b/src/store/chat/slices/aiChat/actions/streamingExecutor.tsindex e3681f4deea..303b8c44a94 100644--- a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts+++ b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts@@ -1,35 +1,42 @@/* eslint-disable sort-keys-fix/sort-keys-fix, typescript-sort-keys/interface */// Disable the auto sort key eslint rule to make the code more logic and readable-import type {AgentRuntimeContext, AgentState, Cost, Usage} from '@lobechat/agent-runtime';-import {- AgentRuntime,- computeStepContext,- GeneralChatAgent-} from '@lobechat/agent-runtime';+import type { AgentRuntimeContext, AgentState, Cost, Usage } from '@lobechat/agent-runtime';+import { AgentRuntime, computeStepContext, GeneralChatAgent } from '@lobechat/agent-runtime';import { PageAgentIdentifier } from '@lobechat/builtin-tool-page-agent';import { isDesktop } from '@lobechat/const';-import type {ChatToolPayload, ConversationContext, MessageMapScope, MessageToolCall, ModelUsage, RuntimeInitialContext, RuntimeStepContext, UIChatMessage} from '@lobechat/types';-import {- TraceNameMap+import type {+ ChatToolPayload,+ ConversationContext,+ MessageMapScope,+ MessageToolCall,+ ModelUsage,+ RuntimeInitialContext,+ RuntimeStepContext,+ UIChatMessage,} from '@lobechat/types';+import { TraceNameMap } from '@lobechat/types';import debug from 'debug';import { t } from 'i18next';import { createAgentToolsEngine } from '@/helpers/toolEngineering';import { chatService } from '@/services/chat';-import type {ResolvedAgentConfig} from '@/services/chat/mecha';+import type { ResolvedAgentConfig } from '@/services/chat/mecha';import { resolveAgentConfig } from '@/services/chat/mecha';import { messageService } from '@/services/message';+import { getAgentStoreState } from '@/store/agent';+import { agentSelectors } from '@/store/agent/selectors';import { createAgentExecutors } from '@/store/chat/agents/createAgentExecutors';-import type {ChatStore} from '@/store/chat/store';+import type { ChatStore } from '@/store/chat/store';import { getFileStoreState } from '@/store/file/store';import { pageAgentRuntime } from '@/store/tool/slices/builtin/executors/lobe-page-agent';-import type {StoreSetter} from '@/store/types';+import type { StoreSetter } from '@/store/types';import { toolInterventionSelectors } from '@/store/user/selectors';import { getUserStoreState } from '@/store/user/store';+import { markdownToTxt } from '@/utils/markdownToTxt';import { topicSelectors } from '../../../selectors';import { messageMapKey } from '../../../utils/messageMapKey';+import { topicMapKey } from '../../../utils/topicMapKey';import { selectTodosFromMessages } from '../../message/selectors/dbMessage';import { StreamingHandler } from './StreamingHandler';import type { StreamChunk } from './types/streaming';@@ -859,6 +866,12 @@ export class StreamingExecutorActionImpl {case 'done': {this.#get().completeOperation(operationId);log('[internal_execAgentRuntime] Operation completed successfully');++ // 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);+ }break;}case 'error': {@@ -891,9 +904,21 @@ export class StreamingExecutorActionImpl {const { desktopNotificationService } =await import('@/services/electron/desktopNotification');+ // Use topic title or agent title as notification title+ let notificationTitle = t('notification.finishChatGeneration', { ns: 'electron' });+ if (topicId) {+ const key = topicMapKey({ agentId, groupId });+ const topicData = this.#get().topicDataMap[key];+ const topic = topicData?.items?.find((item) => item.id === topicId);+ if (topic?.title) notificationTitle = topic.title;+ } else {+ const agentMeta = agentSelectors.getAgentMetaById(agentId)(getAgentStoreState());+ if (agentMeta?.title) notificationTitle = agentMeta.title;+ }+await desktopNotificationService.showNotification({- body: lastAssistant.content,- title: t('notification.finishChatGeneration', { ns: 'electron' }),+ body: markdownToTxt(lastAssistant.content),+ title: notificationTitle,});}} catch (error) {diff --git a/src/store/chat/slices/operation/actions.ts b/src/store/chat/slices/operation/actions.tsindex 27805b768ff..0e8ca746f9d 100644--- a/src/store/chat/slices/operation/actions.ts+++ b/src/store/chat/slices/operation/actions.ts@@ -1,12 +1,11 @@-/* eslint-disable sort-keys-fix/sort-keys-fix */import { nanoid } from '@lobechat/utils';import debug from 'debug';import { produce } from 'immer';-import type {ChatStore} from '@/store/chat/store';-import type {MessageMapKeyInput} from '@/store/chat/utils/messageMapKey';+import type { ChatStore } from '@/store/chat/store';+import type { MessageMapKeyInput } from '@/store/chat/utils/messageMapKey';import { messageMapKey } from '@/store/chat/utils/messageMapKey';-import type {StoreSetter} from '@/store/types';+import type { StoreSetter } from '@/store/types';import { setNamespace } from '@/utils/storeDebug';import type {@@ -637,6 +636,56 @@ export class OperationActionsImpl {n(`associateMessageWithOperation/${messageId}/${operationId}`),);};++ markUnreadCompleted = (agentId: string, topicId?: string | null): void => {+ const { activeAgentId, activeTopicId } = this.#get();++ // Only mark when user is NOT currently viewing this agent/topic+ const isViewingAgent = activeAgentId === agentId;+ const isViewingTopic = isViewingAgent && (activeTopicId ?? null) === (topicId ?? null);++ if (!isViewingAgent) {+ this.#set(+ produce((state: ChatStore) => {+ state.unreadCompletedAgentIds.add(agentId);+ }),+ false,+ n(`markUnreadCompleted/agent/${agentId}`),+ );+ }++ if (topicId && !isViewingTopic) {+ this.#set(+ produce((state: ChatStore) => {+ state.unreadCompletedTopicIds.add(topicId);+ }),+ false,+ n(`markUnreadCompleted/topic/${topicId}`),+ );+ }+ };++ clearUnreadCompletedAgent = (agentId: string): void => {+ if (!this.#get().unreadCompletedAgentIds.has(agentId)) return;+ this.#set(+ produce((state: ChatStore) => {+ state.unreadCompletedAgentIds.delete(agentId);+ }),+ false,+ n(`clearUnreadCompleted/agent/${agentId}`),+ );+ };++ clearUnreadCompletedTopic = (topicId: string): void => {+ if (!this.#get().unreadCompletedTopicIds.has(topicId)) return;+ this.#set(+ produce((state: ChatStore) => {+ state.unreadCompletedTopicIds.delete(topicId);+ }),+ false,+ n(`clearUnreadCompleted/topic/${topicId}`),+ );+ };}export type OperationActions = Pick<OperationActionsImpl, keyof OperationActionsImpl>;diff --git a/src/store/chat/slices/operation/initialState.ts b/src/store/chat/slices/operation/initialState.tsindex 7b741b95a79..d6267544c0f 100644--- a/src/store/chat/slices/operation/initialState.ts+++ b/src/store/chat/slices/operation/initialState.ts@@ -33,6 +33,16 @@ export interface ChatOperationState {* key: OperationType, value: operationId[]*/operationsByType: Record<OperationType, string[]>;++ /**+ * Agent IDs with unread completed generation+ */+ unreadCompletedAgentIds: Set<string>;++ /**+ * Topic IDs with unread completed generation+ */+ unreadCompletedTopicIds: Set<string>;}export const initialOperationState: ChatOperationState = {@@ -41,4 +51,6 @@ export const initialOperationState: ChatOperationState = {operationsByContext: {},operationsByMessage: {},operationsByType: {} as Record<OperationType, string[]>,+ unreadCompletedAgentIds: new Set(),+ unreadCompletedTopicIds: new Set(),};diff --git a/src/store/chat/slices/operation/selectors.ts b/src/store/chat/slices/operation/selectors.tsindex 2c5eaf328c1..809001d9762 100644--- a/src/store/chat/slices/operation/selectors.ts+++ b/src/store/chat/slices/operation/selectors.ts@@ -1,8 +1,8 @@import type { ChatStoreState } from '@/store/chat/initialState';import { messageMapKey } from '@/store/chat/utils/messageMapKey';-import type {Operation, OperationType} from './types';-import { AI_RUNTIME_OPERATION_TYPES } from './types';+import type { Operation, OperationType } from './types';+import { AI_RUNTIME_OPERATION_TYPES } from './types';// === Basic Queries ===/**@@ -473,6 +473,26 @@ const isSendingMessage = (s: ChatStoreState): boolean => {return hasRunningOperationType('sendMessage')(s);};+// === Unread Completion ===++/**+ * Check if an agent has unread completed generation+ */+const isAgentUnreadCompleted =+ (agentId: string) =>+ (s: ChatStoreState): boolean => {+ return s.unreadCompletedAgentIds.has(agentId);+ };++/**+ * Check if a topic has unread completed generation+ */+const isTopicUnreadCompleted =+ (topicId: string) =>+ (s: ChatStoreState): boolean => {+ return s.unreadCompletedTopicIds.has(topicId);+ };+/*** Operation Selectors*/@@ -501,6 +521,7 @@ export const operationSelectors = {isAgentRunning,isAgentRuntimeRunning,+ isAgentUnreadCompleted,isAgentRuntimeRunningByContext,isAnyMessageLoading,isContinuing,@@ -516,4 +537,5 @@ export const operationSelectors = {isMessageRegenerating,isRegenerating,isSendingMessage,+ isTopicUnreadCompleted,};diff --git a/src/store/chat/slices/topic/action.ts b/src/store/chat/slices/topic/action.tsindex 99551f793f7..06ff5d77a2f 100644--- a/src/store/chat/slices/topic/action.ts+++ b/src/store/chat/slices/topic/action.ts@@ -2,13 +2,11 @@// Note: To make the code more logic and readable, we just disable the auto sort key eslint rule// DON'T REMOVE THE FIRST LINEimport { chainSummaryTitle } from '@lobechat/prompts';-import type {ChatTopicMetadata, MessageMapScope, UIChatMessage} from '@lobechat/types';-import {- TraceNameMap-} from '@lobechat/types';+import type { ChatTopicMetadata, MessageMapScope, UIChatMessage } from '@lobechat/types';+import { TraceNameMap } from '@lobechat/types';import isEqual from 'fast-deep-equal';import { t } from 'i18next';-import type {SWRResponse} from 'swr';+import type { SWRResponse } from 'swr';import useSWR from 'swr';import { message } from '@/components/AntdStaticMethods';@@ -21,17 +19,17 @@ import type { ChatStore } from '@/store/chat';import { topicMapKey } from '@/store/chat/utils/topicMapKey';import { useGlobalStore } from '@/store/global';import { globalHelpers } from '@/store/global/helpers';-import type {StoreSetter} from '@/store/types';+import type { StoreSetter } from '@/store/types';import { useUserStore } from '@/store/user';import { systemAgentSelectors } from '@/store/user/selectors';-import type {ChatTopic, CreateTopicParams} from '@/types/topic';+import type { ChatTopic, CreateTopicParams } from '@/types/topic';import { merge } from '@/utils/merge';import { setNamespace } from '@/utils/storeDebug';import { displayMessageSelectors } from '../message/selectors';-import type {TopicData} from './initialState';-import type {ChatTopicDispatch} from './reducer';-import { topicReducer } from './reducer';+import type { TopicData } from './initialState';+import type { ChatTopicDispatch } from './reducer';+import { topicReducer } from './reducer';import { topicSelectors } from './selectors';const n = setNamespace('t');@@ -526,6 +524,10 @@ export class ChatTopicActionImpl {n('toggleTopic'),);+ if (id) {+ this.#get().clearUnreadCompletedTopic(id);+ }+if (opts.skipRefreshMessage) return;await this.#get().refreshMessages();};diff --git a/src/styles/global.ts b/src/styles/global.tsindex 101c33c6696..92c52ac3a44 100644--- a/src/styles/global.ts+++ b/src/styles/global.ts@@ -1,5 +1,5 @@import { CLASSNAMES } from '@lobehub/ui';-import type {Theme} from 'antd-style';+import type { Theme } from 'antd-style';import { css } from 'antd-style';// fix ios input keyboard@@ -17,7 +17,7 @@ export default ({ token }: { prefixCls: string; token: Theme }) => css`min-height: 100dvh;max-height: 100dvh;- @media (min-device-width: 576px) {+ @media (device-width >= 576px) {overflow: hidden;}}