@lobehub/lobehub 2.0.0-next.342 → 2.0.0-next.343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/changelog/v1.json +12 -0
  3. package/package.json +1 -1
  4. package/packages/database/src/models/__tests__/userMemories.test.ts +62 -5
  5. package/packages/database/src/models/agentCronJob.ts +9 -9
  6. package/packages/database/src/models/userMemory/__tests__/identity.test.ts +5 -5
  7. package/packages/database/src/models/userMemory/experience.ts +91 -1
  8. package/packages/database/src/models/userMemory/identity.ts +93 -2
  9. package/packages/database/src/models/userMemory/model.ts +27 -8
  10. package/packages/types/src/userMemory/experience.ts +25 -0
  11. package/packages/types/src/userMemory/identity.ts +27 -0
  12. package/packages/types/src/userMemory/index.ts +1 -0
  13. package/packages/types/src/userMemory/shared.ts +30 -0
  14. package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +3 -4
  15. package/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx +7 -8
  16. package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaDetail.tsx +58 -0
  17. package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaHeader.tsx +22 -0
  18. package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaSummary.tsx +43 -0
  19. package/src/app/[variants]/(main)/memory/(home)/features/Persona/index.tsx +53 -0
  20. package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +2 -2
  21. package/src/app/[variants]/(main)/memory/(home)/index.tsx +15 -3
  22. package/src/app/[variants]/(main)/memory/experiences/features/List/GridView/ExperienceCard.tsx +3 -3
  23. package/src/app/[variants]/(main)/memory/experiences/features/List/GridView/index.tsx +3 -3
  24. package/src/app/[variants]/(main)/memory/experiences/features/List/TimelineView/ExperienceCard.tsx +3 -3
  25. package/src/app/[variants]/(main)/memory/experiences/features/List/TimelineView/index.tsx +3 -3
  26. package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +2 -11
  27. package/src/app/[variants]/(main)/memory/features/TimeLineView/TimeLineCard.tsx +2 -9
  28. package/src/app/[variants]/(main)/memory/identities/features/IdentityRightPanel.tsx +1 -1
  29. package/src/app/[variants]/(main)/memory/identities/features/List/GridView/IdentityCard.tsx +5 -4
  30. package/src/app/[variants]/(main)/memory/identities/features/List/GridView/index.tsx +3 -3
  31. package/src/app/[variants]/(main)/memory/identities/features/List/TimelineView/IdentityCard.tsx +6 -6
  32. package/src/app/[variants]/(main)/memory/identities/features/List/TimelineView/index.tsx +6 -4
  33. package/src/app/[variants]/(main)/settings/profile/index.tsx +8 -8
  34. package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +0 -1
  35. package/src/app/[variants]/(main)/settings/skill/features/Actions.tsx +0 -1
  36. package/src/app/[variants]/(main)/settings/skill/features/KlavisSkillItem.tsx +9 -10
  37. package/src/app/[variants]/(main)/settings/skill/features/LobehubSkillItem.tsx +9 -10
  38. package/src/app/[variants]/(main)/settings/skill/features/McpSkillItem.tsx +4 -5
  39. package/src/app/[variants]/(main)/settings/skill/features/SkillList.tsx +4 -5
  40. package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +1 -4
  41. package/src/app/[variants]/share/t/[id]/_layout/index.tsx +47 -121
  42. package/src/app/[variants]/share/t/[id]/_layout/style.ts +59 -0
  43. package/src/app/[variants]/share/t/[id]/features/Portal/index.tsx +4 -5
  44. package/src/app/[variants]/share/t/[id]/index.tsx +30 -37
  45. package/src/components/404/index.tsx +15 -9
  46. package/src/components/DragUpload/index.tsx +15 -16
  47. package/src/features/EditorCanvas/DocumentIdMode.tsx +1 -2
  48. package/src/features/IntegrationDetailModal/index.tsx +11 -12
  49. package/src/features/ResourceManager/index.tsx +13 -6
  50. package/src/features/ShareModal/ShareImage/Preview.tsx +19 -28
  51. package/src/features/ShareModal/ShareImage/style.ts +4 -2
  52. package/src/features/ShareModal/index.tsx +5 -1
  53. package/src/features/ShareModal/style.ts +1 -0
  54. package/src/features/ShareModal/useContainerStyles.ts +1 -1
  55. package/src/features/SharePopover/index.tsx +16 -9
  56. package/src/features/SharePopover/style.ts +2 -2
  57. package/src/features/SkillStore/CommunityList/Item.tsx +2 -2
  58. package/src/features/SkillStore/LobeHubList/Item.tsx +2 -2
  59. package/src/features/SkillStore/LobeHubList/index.tsx +2 -3
  60. package/src/features/SkillStore/style.ts +4 -4
  61. package/src/layout/GlobalProvider/ServerVersionOutdatedAlert.tsx +28 -20
  62. package/src/server/routers/lambda/userMemories.ts +61 -5
  63. package/src/server/routers/lambda/userMemory.ts +5 -1
  64. package/src/services/chat/index.ts +2 -2
  65. package/src/services/userMemory/index.ts +25 -1
  66. package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +0 -1
  67. package/src/store/userMemory/initialState.ts +22 -52
  68. package/src/store/userMemory/slices/context/action.ts +1 -1
  69. package/src/store/userMemory/slices/context/index.ts +1 -0
  70. package/src/store/userMemory/slices/context/initialState.ts +22 -0
  71. package/src/store/userMemory/slices/experience/action.ts +10 -22
  72. package/src/store/userMemory/slices/experience/index.ts +1 -0
  73. package/src/store/userMemory/slices/experience/initialState.ts +22 -0
  74. package/src/store/userMemory/slices/home/action.ts +17 -0
  75. package/src/store/userMemory/slices/identity/action.ts +36 -24
  76. package/src/store/userMemory/slices/identity/initialState.ts +7 -4
  77. package/src/store/userMemory/slices/preference/action.ts +1 -1
  78. package/src/store/userMemory/slices/preference/index.ts +1 -0
  79. package/src/store/userMemory/slices/preference/initialState.ts +22 -0
@@ -76,3 +76,33 @@ export enum ContextStatusEnum {
76
76
  Planned = 'planned',
77
77
  }
78
78
  export const CONTEXT_STATUS = Object.values(ContextStatusEnum);
79
+
80
+ /**
81
+ * Shared types for memory list queries
82
+ */
83
+
84
+ export interface BaseListParams {
85
+ order?: 'asc' | 'desc';
86
+ page?: number;
87
+ pageSize?: number;
88
+ q?: string;
89
+ tags?: string[];
90
+ types?: string[];
91
+ }
92
+
93
+ export interface BaseListResult<T> {
94
+ items: T[];
95
+ page: number;
96
+ pageSize: number;
97
+ total: number;
98
+ }
99
+
100
+ export interface BaseListItem {
101
+ capturedAt: Date;
102
+ createdAt: Date;
103
+ id: string;
104
+ tags: string[] | null;
105
+ title: string | null;
106
+ type: string | null;
107
+ updatedAt: Date;
108
+ }
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { Flexbox } from '@lobehub/ui';
4
- import { createStyles } from 'antd-style';
4
+ import { createStaticStyles } from 'antd-style';
5
5
  import { Crown, Users } from 'lucide-react';
6
6
  import { memo, useMemo, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
@@ -17,7 +17,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';
17
17
  import AgentBuilderToggle from './AgentBuilderToggle';
18
18
  import ChromeTabs, { type ChromeTabItem } from './ChromeTabs';
19
19
 
20
- const useStyles = createStyles(({ css, token }) => ({
20
+ const styles = createStaticStyles(({ css, cssVar }) => ({
21
21
  header: css`
22
22
  overflow: hidden;
23
23
  flex: none;
@@ -26,7 +26,7 @@ const useStyles = createStyles(({ css, token }) => ({
26
26
  height: 44px;
27
27
  padding-block: 8px;
28
28
  padding-inline: 12px;
29
- border-block-end: 1px solid ${token.colorBorderSecondary};
29
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
30
30
  `,
31
31
  tabsWrapper: css`
32
32
  scrollbar-width: none;
@@ -42,7 +42,6 @@ const useStyles = createStyles(({ css, token }) => ({
42
42
 
43
43
  const Header = memo(() => {
44
44
  const { t } = useTranslation('chat');
45
- const { styles } = useStyles();
46
45
 
47
46
  const [showAddModal, setShowAddModal] = useState(false);
48
47
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { getKlavisServerByServerIdentifier, getLobehubSkillProviderById } from '@lobechat/const';
4
4
  import { Avatar, Flexbox, Icon } from '@lobehub/ui';
5
- import { createStyles } from 'antd-style';
5
+ import { createStaticStyles } from 'antd-style';
6
6
  import { Blocks } from 'lucide-react';
7
7
  import { type ReactNode, createElement, memo, useMemo, useState } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
@@ -11,7 +11,7 @@ import SkillStore from '@/features/SkillStore';
11
11
  import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
12
12
  import { useToolStore } from '@/store/tool';
13
13
 
14
- const useStyles = createStyles(({ css, token }) => ({
14
+ const styles = createStaticStyles(({ css, cssVar }) => ({
15
15
  banner: css`
16
16
  cursor: pointer;
17
17
 
@@ -28,24 +28,24 @@ const useStyles = createStyles(({ css, token }) => ({
28
28
  margin-block-end: 6px;
29
29
  padding-block: 42px 10px;
30
30
  padding-inline: 16px;
31
- border: 1px solid ${token.colorBorderSecondary};
31
+ border: 1px solid ${cssVar.colorBorderSecondary};
32
32
  border-radius: 20px;
33
33
 
34
- background: ${token.colorFillQuaternary};
34
+ background: ${cssVar.colorFillQuaternary};
35
35
  box-shadow: 0 12px 32px rgb(0 0 0 / 4%);
36
36
 
37
37
  transition: background 0.2s ease-in-out;
38
38
 
39
39
  &:hover {
40
- background: ${token.colorFillQuaternary};
40
+ background: ${cssVar.colorFillQuaternary};
41
41
  }
42
42
  `,
43
43
  icon: css`
44
- color: ${token.colorTextSecondary};
44
+ color: ${cssVar.colorTextSecondary};
45
45
  `,
46
46
  text: css`
47
47
  font-size: 13px;
48
- color: ${token.colorTextSecondary};
48
+ color: ${cssVar.colorTextSecondary};
49
49
  `,
50
50
  }));
51
51
 
@@ -60,7 +60,6 @@ const BANNER_SKILL_IDS = [
60
60
  ] as const;
61
61
 
62
62
  const SkillInstallBanner = memo(() => {
63
- const { styles } = useStyles();
64
63
  const { t } = useTranslation('plugin');
65
64
  const [open, setOpen] = useState(false);
66
65
 
@@ -0,0 +1,58 @@
1
+ import { Markdown } from '@lobehub/ui';
2
+ import { createStaticStyles } from 'antd-style';
3
+ import { memo } from 'react';
4
+
5
+ const styles = createStaticStyles(({ css, cssVar }) => ({
6
+ markdown: css`
7
+ h2 {
8
+ margin-block: 24px 12px;
9
+ font-size: 16px;
10
+ font-weight: 600;
11
+ }
12
+
13
+ h3 {
14
+ margin-block: 16px 8px;
15
+ font-size: 14px;
16
+ font-weight: 500;
17
+ }
18
+
19
+ p {
20
+ margin-block-end: 8px;
21
+ font-size: 14px;
22
+ line-height: 1.6;
23
+ color: ${cssVar.colorTextSecondary};
24
+ }
25
+
26
+ ul {
27
+ margin-block: 8px;
28
+ margin-inline: 0;
29
+ padding-inline-start: 20px;
30
+
31
+ li {
32
+ margin-block-end: 4px;
33
+ font-size: 14px;
34
+ line-height: 1.6;
35
+ color: ${cssVar.colorTextSecondary};
36
+ }
37
+ }
38
+
39
+ strong {
40
+ font-weight: 500;
41
+ color: ${cssVar.colorText};
42
+ }
43
+ `,
44
+ }));
45
+
46
+ interface PersonaDetailProps {
47
+ children: string;
48
+ }
49
+
50
+ const PersonaDetail = memo<PersonaDetailProps>(({ children }) => {
51
+ return (
52
+ <Markdown className={styles.markdown} enableImageGallery={false} enableLatex={false}>
53
+ {children}
54
+ </Markdown>
55
+ );
56
+ });
57
+
58
+ export default PersonaDetail;
@@ -0,0 +1,22 @@
1
+ import { Text } from '@lobehub/ui';
2
+ import { createStaticStyles } from 'antd-style';
3
+ import { memo } from 'react';
4
+
5
+ const styles = createStaticStyles(({ css, cssVar }) => ({
6
+ title: css`
7
+ font-size: 28px;
8
+ font-weight: 700;
9
+ line-height: 1.4;
10
+ color: ${cssVar.colorText};
11
+ `,
12
+ }));
13
+
14
+ const PersonaHeader = memo(() => {
15
+ return (
16
+ <Text as={'h1'} className={styles.title}>
17
+ Persona
18
+ </Text>
19
+ );
20
+ });
21
+
22
+ export default PersonaHeader;
@@ -0,0 +1,43 @@
1
+ import { createStaticStyles } from 'antd-style';
2
+ import { memo } from 'react';
3
+
4
+ const styles = createStaticStyles(({ css, cssVar }) => ({
5
+ summary: css`
6
+ position: relative;
7
+
8
+ padding-block: 16px;
9
+ padding-inline: 20px;
10
+ border-radius: 8px;
11
+
12
+ font-size: 15px;
13
+ font-style: italic;
14
+ line-height: 1.6;
15
+ color: ${cssVar.colorText};
16
+
17
+ background: ${cssVar.colorFillQuaternary};
18
+
19
+ &::before {
20
+ content: '"';
21
+
22
+ position: absolute;
23
+ inset-block-start: 8px;
24
+ inset-inline-start: 12px;
25
+
26
+ font-family: Georgia, serif;
27
+ font-size: 28px;
28
+ font-style: normal;
29
+ line-height: 1;
30
+ color: ${cssVar.colorTextQuaternary};
31
+ }
32
+ `,
33
+ }));
34
+
35
+ interface PersonaSummaryProps {
36
+ children: string;
37
+ }
38
+
39
+ const PersonaSummary = memo<PersonaSummaryProps>(({ children }) => {
40
+ return <div className={styles.summary}>{children}</div>;
41
+ });
42
+
43
+ export default PersonaSummary;
@@ -0,0 +1,53 @@
1
+ import { Flexbox } from '@lobehub/ui';
2
+ import { cx } from 'antd-style';
3
+ import { memo, useState } from 'react';
4
+
5
+ import { EditorModal } from '@/features/EditorModal';
6
+ import { useUserMemoryStore } from '@/store/userMemory';
7
+
8
+ import PersonaDetail from './PersonaDetail';
9
+ import PersonaSummary from './PersonaSummary';
10
+
11
+ interface PersonaProps {
12
+ className?: string;
13
+ onEditClick?: () => void;
14
+ }
15
+
16
+ export const usePersonaEditor = () => {
17
+ const [editOpen, setEditOpen] = useState(false);
18
+ const persona = useUserMemoryStore((s) => s.persona);
19
+
20
+ const openEditor = () => setEditOpen(true);
21
+ const closeEditor = () => setEditOpen(false);
22
+
23
+ const EditorModalElement = persona ? (
24
+ <EditorModal
25
+ onCancel={closeEditor}
26
+ onConfirm={async () => {
27
+ closeEditor();
28
+ }}
29
+ open={editOpen}
30
+ value={persona.content}
31
+ />
32
+ ) : null;
33
+
34
+ return { EditorModalElement, openEditor };
35
+ };
36
+
37
+ const Persona = memo<PersonaProps>(({ className }) => {
38
+ const useFetchPersona = useUserMemoryStore((s) => s.useFetchPersona);
39
+ const persona = useUserMemoryStore((s) => s.persona);
40
+
41
+ const { isLoading } = useFetchPersona();
42
+
43
+ if (isLoading || !persona) return null;
44
+
45
+ return (
46
+ <Flexbox className={cx(className)} gap={24}>
47
+ {persona.summary && <PersonaSummary>{persona.summary}</PersonaSummary>}
48
+ <PersonaDetail>{persona.content}</PersonaDetail>
49
+ </Flexbox>
50
+ );
51
+ });
52
+
53
+ export default Persona;
@@ -1,12 +1,12 @@
1
1
  import { ActionIcon, Block } from '@lobehub/ui';
2
2
  import { createStaticStyles, cx } from 'antd-style';
3
3
  import { MaximizeIcon, MinimizeIcon } from 'lucide-react';
4
- import dynamic from '@/libs/next/dynamic';
5
4
  import { memo, useEffect, useState } from 'react';
6
5
 
7
6
  import Loading from '@/components/Loading/BrandTextLoading';
8
7
  import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
9
8
  import { type QueryTagsResult } from '@/database/models/userMemory';
9
+ import dynamic from '@/libs/next/dynamic';
10
10
 
11
11
  const TagCloudCanvas = dynamic(() => import('./TagCloudCanvas'), {
12
12
  loading: () => <Loading debugId={'TagCloud'} />,
@@ -36,7 +36,7 @@ const styles = createStaticStyles(({ css }) => ({
36
36
  position: relative;
37
37
  overflow: hidden;
38
38
  width: 100%;
39
- height: 480px;
39
+ height: 400px;
40
40
 
41
41
  .fullscreen-icon {
42
42
  opacity: 0;
@@ -1,20 +1,24 @@
1
1
  import { Flexbox } from '@lobehub/ui';
2
+ // import { PencilLineIcon } from 'lucide-react';
2
3
  import { type FC } from 'react';
3
4
 
4
- import MemoryEmpty from '@/app/[variants]/(main)/memory/features/MemoryEmpty';
5
- import { SCROLL_PARENT_ID } from '@/app/[variants]/(main)/memory/features/TimeLineView/useScrollParent';
6
5
  import Loading from '@/components/Loading/BrandTextLoading';
7
6
  import NavHeader from '@/features/NavHeader';
8
7
  import WideScreenContainer from '@/features/WideScreenContainer';
9
8
  import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
10
9
  import { useUserMemoryStore } from '@/store/userMemory';
11
10
 
11
+ import MemoryEmpty from '../features/MemoryEmpty';
12
+ import { SCROLL_PARENT_ID } from '../features/TimeLineView/useScrollParent';
13
+ import Persona from './features/Persona';
14
+ import PersonaHeader from './features/Persona/PersonaHeader';
12
15
  import RoleTagCloud from './features/RoleTagCloud';
13
16
 
14
17
  const Home: FC = () => {
15
18
  const useFetchTags = useUserMemoryStore((s) => s.useFetchTags);
16
19
  const roles = useUserMemoryStore((s) => s.roles);
17
20
  const { isLoading } = useFetchTags();
21
+ // const { EditorModalElement, openEditor } = usePersonaEditor();
18
22
 
19
23
  if (isLoading) return <Loading debugId={'Home'} />;
20
24
 
@@ -25,7 +29,12 @@ const Home: FC = () => {
25
29
  return (
26
30
  <Flexbox flex={1} height={'100%'}>
27
31
  <NavHeader
28
- right={<WideScreenButton />}
32
+ right={
33
+ <Flexbox gap={8} horizontal>
34
+ {/* <ActionIcon icon={PencilLineIcon} onClick={openEditor} /> */}
35
+ <WideScreenButton />
36
+ </Flexbox>
37
+ }
29
38
  style={{
30
39
  zIndex: 1,
31
40
  }}
@@ -37,9 +46,12 @@ const Home: FC = () => {
37
46
  width={'100%'}
38
47
  >
39
48
  <WideScreenContainer gap={32} paddingBlock={48}>
49
+ <PersonaHeader />
40
50
  <RoleTagCloud tags={roles} />
51
+ <Persona />
41
52
  </WideScreenContainer>
42
53
  </Flexbox>
54
+ {/* {EditorModalElement} */}
43
55
  </Flexbox>
44
56
  );
45
57
  };
@@ -1,3 +1,4 @@
1
+ import type { ExperienceListItem } from '@lobechat/types';
1
2
  import dayjs from 'dayjs';
2
3
  import relativeTime from 'dayjs/plugin/relativeTime';
3
4
  import { memo } from 'react';
@@ -5,15 +6,14 @@ import { useTranslation } from 'react-i18next';
5
6
 
6
7
  import GridCard from '@/app/[variants]/(main)/memory/features/GridView/GridCard';
7
8
  import ProgressIcon from '@/app/[variants]/(main)/memory/features/ProgressIcon';
8
- import { type DisplayExperienceMemory } from '@/database/repositories/userMemory';
9
9
 
10
10
  import ExperienceDropdown from '../../ExperienceDropdown';
11
11
 
12
12
  dayjs.extend(relativeTime);
13
13
 
14
14
  interface ExperienceCardProps {
15
- experience: DisplayExperienceMemory;
16
- onClick: (experience: DisplayExperienceMemory) => void;
15
+ experience: ExperienceListItem;
16
+ onClick: (experience: ExperienceListItem) => void;
17
17
  }
18
18
 
19
19
  const ExperienceCard = memo<ExperienceCardProps>(({ experience, onClick }) => {
@@ -1,15 +1,15 @@
1
+ import type { ExperienceListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
- import { type DisplayExperienceMemory } from '@/database/repositories/userMemory';
4
4
  import { useUserMemoryStore } from '@/store/userMemory';
5
5
 
6
6
  import { GridView } from '../../../../features/GridView';
7
7
  import ExperienceCard from './ExperienceCard';
8
8
 
9
9
  interface GridViewProps {
10
- experiences: DisplayExperienceMemory[];
10
+ experiences: ExperienceListItem[];
11
11
  isLoading?: boolean;
12
- onClick: (experience: DisplayExperienceMemory) => void;
12
+ onClick: (experience: ExperienceListItem) => void;
13
13
  }
14
14
 
15
15
  const ExperiencesGridView = memo<GridViewProps>(({ experiences, isLoading, onClick }) => {
@@ -1,13 +1,13 @@
1
+ import type { ExperienceListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
4
  import TimeLineCard from '@/app/[variants]/(main)/memory/features/TimeLineView/TimeLineCard';
4
- import { type DisplayExperienceMemory } from '@/database/repositories/userMemory';
5
5
 
6
6
  import ExperienceDropdown from '../../ExperienceDropdown';
7
7
 
8
8
  interface ExperienceCardProps {
9
- experience: DisplayExperienceMemory;
10
- onClick: (experience: DisplayExperienceMemory) => void;
9
+ experience: ExperienceListItem;
10
+ onClick: (experience: ExperienceListItem) => void;
11
11
  }
12
12
 
13
13
  const ExperienceCard = memo<ExperienceCardProps>(({ experience, onClick }) => {
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
+ import type { ExperienceListItem } from '@lobechat/types';
3
4
  import { memo } from 'react';
4
5
 
5
- import { type DisplayExperienceMemory } from '@/database/repositories/userMemory';
6
6
  import { useUserMemoryStore } from '@/store/userMemory';
7
7
 
8
8
  import { TimelineView as GenericTimelineView } from '../../../../features/TimeLineView';
@@ -10,9 +10,9 @@ import { PeriodHeader, TimelineItemWrapper } from '../../../../features/TimeLine
10
10
  import ExperienceCard from './ExperienceCard';
11
11
 
12
12
  interface ExperienceTimelineViewProps {
13
- experiences: DisplayExperienceMemory[];
13
+ experiences: ExperienceListItem[];
14
14
  isLoading?: boolean;
15
- onCardClick: (experience: DisplayExperienceMemory) => void;
15
+ onCardClick: (experience: ExperienceListItem) => void;
16
16
  }
17
17
 
18
18
  const ExperienceTimelineView = memo<ExperienceTimelineViewProps>(
@@ -1,28 +1,19 @@
1
1
  import { Button, Icon, Text } from '@lobehub/ui';
2
2
  import { cssVar } from 'antd-style';
3
3
  import { Link2 } from 'lucide-react';
4
- import Link from '@/libs/router/Link';
5
4
  import { memo } from 'react';
6
- import { useNavigate } from 'react-router-dom';
7
5
 
8
6
  import { type MemorySource } from '@/database/repositories/userMemory';
7
+ import Link from '@/libs/router/Link';
9
8
 
10
9
  const SourceLink = memo<{ source?: MemorySource | null }>(({ source }) => {
11
- const navigate = useNavigate();
12
-
13
10
  if (!source) return;
14
11
 
15
12
  const title = source.title || source.id?.replace('tpc_', '').slice(0, 8);
16
13
 
17
14
  return (
18
15
  <Link
19
- href={`/agent/${source.agentId}?topicId=${source.id}`}
20
- onClick={(e) => {
21
- if (!source) return;
22
- e.stopPropagation();
23
- e.preventDefault();
24
- navigate(`/agent/${source.agentId}?topicId=${source.id}`);
25
- }}
16
+ href={`/agent/${source.agentId}?topic=${source.id}`}
26
17
  style={{
27
18
  flex: 1,
28
19
  maxWidth: '100%',
@@ -1,6 +1,5 @@
1
- import { Block, Flexbox, Icon, Tag, Text } from '@lobehub/ui';
1
+ import { Block, Flexbox, Tag, Text } from '@lobehub/ui';
2
2
  import { createStaticStyles, cssVar, cx } from 'antd-style';
3
- import { Link2 } from 'lucide-react';
4
3
  import { type ReactNode, memo } from 'react';
5
4
 
6
5
  import CateTag from '../CateTag';
@@ -67,13 +66,7 @@ const TimeLineCard = memo<TimeLineCardProps>(
67
66
  ) : (
68
67
  title
69
68
  )}
70
- {typeof titleAddon === 'string' ? (
71
- <Tag icon={<Icon icon={Link2} />} variant="borderless">
72
- {titleAddon}
73
- </Tag>
74
- ) : (
75
- titleAddon
76
- )}
69
+ {!!titleAddon ? <Tag>{titleAddon}</Tag> : titleAddon}
77
70
  </Flexbox>
78
71
  )}
79
72
  {typeof children === 'string' ? (
@@ -39,7 +39,7 @@ const IdentityRightPanel = memo(() => {
39
39
  }}
40
40
  weight={'bold'}
41
41
  >
42
- {identity.role || identity.relationship || 'Identity'}
42
+ {identity.title}
43
43
  </Text>
44
44
  <Time capturedAt={identity.capturedAt || identity.updatedAt || identity.createdAt} />
45
45
  {identity.description && <HighlightedContent>{identity.description}</HighlightedContent>}
@@ -1,13 +1,13 @@
1
+ import type { IdentityListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
4
  import GridCard from '@/app/[variants]/(main)/memory/features/GridView/GridCard';
4
- import { type DisplayIdentityMemory } from '@/database/repositories/userMemory';
5
5
 
6
6
  import IdentityDropdown from '../../IdentityDropdown';
7
7
 
8
8
  interface IdentityCardProps {
9
- identity: DisplayIdentityMemory;
10
- onClick?: (identity: DisplayIdentityMemory) => void;
9
+ identity: IdentityListItem;
10
+ onClick?: (identity: IdentityListItem) => void;
11
11
  }
12
12
 
13
13
  const IdentityCard = memo<IdentityCardProps>(({ identity, onClick }) => {
@@ -17,7 +17,8 @@ const IdentityCard = memo<IdentityCardProps>(({ identity, onClick }) => {
17
17
  cate={identity.type}
18
18
  hashTags={identity.tags}
19
19
  onClick={() => onClick?.(identity)}
20
- title={identity.role}
20
+ title={identity.title}
21
+ titleAddon={identity.role?.toLowerCase()}
21
22
  >
22
23
  {identity.description}
23
24
  </GridCard>
@@ -1,15 +1,15 @@
1
+ import type { IdentityListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
- import { type DisplayIdentityMemory } from '@/database/repositories/userMemory';
4
4
  import { useUserMemoryStore } from '@/store/userMemory';
5
5
 
6
6
  import { GridView } from '../../../../features/GridView';
7
7
  import IdentityCard from './IdentityCard';
8
8
 
9
9
  interface GridViewProps {
10
- identities: DisplayIdentityMemory[];
10
+ identities: IdentityListItem[];
11
11
  isLoading?: boolean;
12
- onClick?: (identity: DisplayIdentityMemory) => void;
12
+ onClick?: (identity: IdentityListItem) => void;
13
13
  }
14
14
 
15
15
  const IdentityGridView = memo<GridViewProps>(({ identities, isLoading, onClick }) => {
@@ -1,13 +1,12 @@
1
+ import type { IdentityListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
- import TimeLineCard from '@/app/[variants]/(main)/memory/features/TimeLineView/TimeLineCard';
4
- import { type DisplayIdentityMemory } from '@/database/repositories/userMemory';
5
-
4
+ import TimeLineCard from '../../../../features/TimeLineView/TimeLineCard';
6
5
  import IdentityDropdown from '../../IdentityDropdown';
7
6
 
8
7
  interface IdentityCardProps {
9
- identity: DisplayIdentityMemory;
10
- onClick?: (identity: DisplayIdentityMemory) => void;
8
+ identity: IdentityListItem;
9
+ onClick?: (identity: IdentityListItem) => void;
11
10
  }
12
11
 
13
12
  const IdentityCard = memo<IdentityCardProps>(({ identity, onClick }) => {
@@ -18,7 +17,8 @@ const IdentityCard = memo<IdentityCardProps>(({ identity, onClick }) => {
18
17
  cate={identity.type}
19
18
  hashTags={identity.tags}
20
19
  onClick={() => onClick?.(identity)}
21
- title={identity.role}
20
+ title={identity.title}
21
+ titleAddon={identity.role?.toLowerCase()}
22
22
  >
23
23
  {identity.description}
24
24
  </TimeLineCard>
@@ -1,6 +1,6 @@
1
+ import type { IdentityListItem } from '@lobechat/types';
1
2
  import { memo } from 'react';
2
3
 
3
- import { type DisplayIdentityMemory } from '@/database/repositories/userMemory';
4
4
  import { useUserMemoryStore } from '@/store/userMemory';
5
5
 
6
6
  import { TimelineView as GenericTimelineView } from '../../../../features/TimeLineView';
@@ -8,9 +8,9 @@ import { PeriodHeader, TimelineItemWrapper } from '../../../../features/TimeLine
8
8
  import IdentityCard from './IdentityCard';
9
9
 
10
10
  interface TimelineViewProps {
11
- identities: DisplayIdentityMemory[];
11
+ identities: IdentityListItem[];
12
12
  isLoading?: boolean;
13
- onClick?: (identity: DisplayIdentityMemory) => void;
13
+ onClick?: (identity: IdentityListItem) => void;
14
14
  }
15
15
 
16
16
  const TimelineView = memo<TimelineViewProps>(({ identities, isLoading, onClick }) => {
@@ -20,7 +20,9 @@ const TimelineView = memo<TimelineViewProps>(({ identities, isLoading, onClick }
20
20
  return (
21
21
  <GenericTimelineView
22
22
  data={identities}
23
- getDateForGrouping={(identity) => identity.episodicDate || identity.capturedAt || identity.createdAt}
23
+ getDateForGrouping={(identity) =>
24
+ identity.episodicDate || identity.capturedAt || identity.createdAt
25
+ }
24
26
  groupBy="month"
25
27
  hasMore={identitiesHasMore}
26
28
  isLoading={isLoading}