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.

🔨 chore(userMemories): can render persona even without roles (#12237)

Neko3346c07ed100
diff --git a/src/app/[variants]/(main)/memory/(home)/index.tsx b/src/app/[variants]/(main)/memory/(home)/index.tsx
index 1b93b782168..2996a95c84b 100644
--- a/src/app/[variants]/(main)/memory/(home)/index.tsx
+++ b/src/app/[variants]/(main)/memory/(home)/index.tsx
@@ -2,6 +2,8 @@ import { Flexbox } from '@lobehub/ui';
// import { PencilLineIcon } from 'lucide-react';
import { type FC } from 'react';
+import MemoryAnalysis from '@/app/[variants]/(main)/memory/features/MemoryAnalysis';
+import MemoryEmpty from '@/app/[variants]/(main)/memory/features/MemoryEmpty';
import { SCROLL_PARENT_ID } from '@/app/[variants]/(main)/memory/features/TimeLineView/useScrollParent';
import Loading from '@/components/Loading/BrandTextLoading';
import NavHeader from '@/features/NavHeader';
@@ -9,27 +11,21 @@ import WideScreenContainer from '@/features/WideScreenContainer';
import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
import { useUserMemoryStore } from '@/store/userMemory';
-import MemoryAnalysis from '@/app/[variants]/(main)/memory/features/MemoryAnalysis';
-import MemoryEmpty from '@/app/[variants]/(main)/memory/features/MemoryEmpty';
import Persona from './features/Persona';
import PersonaHeader from './features/Persona/PersonaHeader';
import RoleTagCloud from './features/RoleTagCloud';
const Home: FC = () => {
const useFetchTags = useUserMemoryStore((s) => s.useFetchTags);
+ const useFetchPersona = useUserMemoryStore((s) => s.useFetchPersona);
const roles = useUserMemoryStore((s) => s.roles);
- const { isLoading } = useFetchTags();
- // const { EditorModalElement, openEditor } = usePersonaEditor();
+ const persona = useUserMemoryStore((s) => s.persona);
- if (isLoading) return <Loading debugId={'Home'} />;
+ const { isLoading: isTagsLoading } = useFetchTags();
+ const { isLoading: isPersonaLoading } = useFetchPersona();
+ // const { EditorModalElement, openEditor } = usePersonaEditor();
- if (!roles || roles.length === 0) {
- return (
- <MemoryEmpty>
- <MemoryAnalysis />
- </MemoryEmpty>
- );
- }
+ if (isTagsLoading || isPersonaLoading) return <Loading debugId={'Home'} />;
return (
<Flexbox flex={1} height={'100%'}>
@@ -52,9 +48,19 @@ const Home: FC = () => {
width={'100%'}
>
<WideScreenContainer gap={32} paddingBlock={48}>
- <PersonaHeader />
- <RoleTagCloud tags={roles} />
- <Persona />
+ {roles?.length > 0 && <RoleTagCloud tags={roles} />}
+ {persona ? (
+ <>
+ <PersonaHeader />
+ <Persona />
+ </>
+ ) : (
+ !roles?.length && (
+ <MemoryEmpty>
+ <MemoryAnalysis />
+ </MemoryEmpty>
+ )
+ )}
</WideScreenContainer>
</Flexbox>
{/* {EditorModalElement} */}