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: correct mobile header agent selector and topic count (#12204)

Sun13138a9d9e7adf031
diff --git a/src/app/[variants]/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx b/src/app/[variants]/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
index 6db9a3f6025..e1e5c780fb3 100644
--- a/src/app/[variants]/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
+++ b/src/app/[variants]/(mobile)/chat/features/ChatHeader/ChatHeaderTitle.tsx
@@ -6,21 +6,19 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
import { useChatStore } from '@/store/chat';
import { topicSelectors } from '@/store/chat/selectors';
import { useGlobalStore } from '@/store/global';
-import { useSessionStore } from '@/store/session';
-import { sessionSelectors } from '@/store/session/selectors';
const ChatHeaderTitle = memo(() => {
const { t } = useTranslation(['chat', 'topic']);
const toggleConfig = useGlobalStore((s) => s.toggleMobileTopic);
- const [topicLength, topic] = useChatStore((s) => [
- topicSelectors.currentTopicLength(s),
+ const [topicCount, topic] = useChatStore((s) => [
+ topicSelectors.currentTopicCount(s),
topicSelectors.currentActiveTopic(s),
]);
- const isInbox = useSessionStore(sessionSelectors.isInboxSession);
+ const isInbox = useAgentStore(builtinAgentSelectors.isInboxAgent);
const title = useAgentStore(agentSelectors.currentAgentTitle);
const displayTitle = isInbox ? 'Lobe AI' : title;
@@ -62,7 +60,7 @@ const ChatHeaderTitle = memo(() => {
onClick={() => toggleConfig()}
>
{displayTitle}
- {topicLength > 1 ? `(${topicLength + 1})` : ''}
+ {topicCount > 0 ? ` (${topicCount})` : ''}
</div>
}
/>
diff --git a/src/app/[variants]/(mobile)/chat/features/Topic/features/AgentConfig/Header/index.tsx b/src/app/[variants]/(mobile)/chat/features/Topic/features/AgentConfig/Header/index.tsx
index aa85feaf262..ea6f020325a 100644
--- a/src/app/[variants]/(mobile)/chat/features/Topic/features/AgentConfig/Header/index.tsx
+++ b/src/app/[variants]/(mobile)/chat/features/Topic/features/AgentConfig/Header/index.tsx
@@ -4,14 +4,12 @@ import { Flexbox, Text } from '@lobehub/ui';
import { memo } from 'react';
import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-import { useSessionStore } from '@/store/session';
-import { sessionSelectors } from '@/store/session/selectors';
+import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
import Avatar from './Avatar';
const HeaderInfo = memo(() => {
- const isInbox = useSessionStore(sessionSelectors.isInboxSession);
+ const isInbox = useAgentStore(builtinAgentSelectors.isInboxAgent);
const title = useAgentStore(agentSelectors.currentAgentTitle);
const displayTitle = isInbox ? 'Lobe AI' : title;