@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.
- package/CHANGELOG.md +41 -0
- package/changelog/v1.json +12 -0
- package/package.json +1 -1
- package/packages/database/src/models/__tests__/userMemories.test.ts +62 -5
- package/packages/database/src/models/agentCronJob.ts +9 -9
- package/packages/database/src/models/userMemory/__tests__/identity.test.ts +5 -5
- package/packages/database/src/models/userMemory/experience.ts +91 -1
- package/packages/database/src/models/userMemory/identity.ts +93 -2
- package/packages/database/src/models/userMemory/model.ts +27 -8
- package/packages/types/src/userMemory/experience.ts +25 -0
- package/packages/types/src/userMemory/identity.ts +27 -0
- package/packages/types/src/userMemory/index.ts +1 -0
- package/packages/types/src/userMemory/shared.ts +30 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +3 -4
- package/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx +7 -8
- package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaDetail.tsx +58 -0
- package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaHeader.tsx +22 -0
- package/src/app/[variants]/(main)/memory/(home)/features/Persona/PersonaSummary.tsx +43 -0
- package/src/app/[variants]/(main)/memory/(home)/features/Persona/index.tsx +53 -0
- package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +2 -2
- package/src/app/[variants]/(main)/memory/(home)/index.tsx +15 -3
- package/src/app/[variants]/(main)/memory/experiences/features/List/GridView/ExperienceCard.tsx +3 -3
- package/src/app/[variants]/(main)/memory/experiences/features/List/GridView/index.tsx +3 -3
- package/src/app/[variants]/(main)/memory/experiences/features/List/TimelineView/ExperienceCard.tsx +3 -3
- package/src/app/[variants]/(main)/memory/experiences/features/List/TimelineView/index.tsx +3 -3
- package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +2 -11
- package/src/app/[variants]/(main)/memory/features/TimeLineView/TimeLineCard.tsx +2 -9
- package/src/app/[variants]/(main)/memory/identities/features/IdentityRightPanel.tsx +1 -1
- package/src/app/[variants]/(main)/memory/identities/features/List/GridView/IdentityCard.tsx +5 -4
- package/src/app/[variants]/(main)/memory/identities/features/List/GridView/index.tsx +3 -3
- package/src/app/[variants]/(main)/memory/identities/features/List/TimelineView/IdentityCard.tsx +6 -6
- package/src/app/[variants]/(main)/memory/identities/features/List/TimelineView/index.tsx +6 -4
- package/src/app/[variants]/(main)/settings/profile/index.tsx +8 -8
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +0 -1
- package/src/app/[variants]/(main)/settings/skill/features/Actions.tsx +0 -1
- package/src/app/[variants]/(main)/settings/skill/features/KlavisSkillItem.tsx +9 -10
- package/src/app/[variants]/(main)/settings/skill/features/LobehubSkillItem.tsx +9 -10
- package/src/app/[variants]/(main)/settings/skill/features/McpSkillItem.tsx +4 -5
- package/src/app/[variants]/(main)/settings/skill/features/SkillList.tsx +4 -5
- package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +1 -4
- package/src/app/[variants]/share/t/[id]/_layout/index.tsx +47 -121
- package/src/app/[variants]/share/t/[id]/_layout/style.ts +59 -0
- package/src/app/[variants]/share/t/[id]/features/Portal/index.tsx +4 -5
- package/src/app/[variants]/share/t/[id]/index.tsx +30 -37
- package/src/components/404/index.tsx +15 -9
- package/src/components/DragUpload/index.tsx +15 -16
- package/src/features/EditorCanvas/DocumentIdMode.tsx +1 -2
- package/src/features/IntegrationDetailModal/index.tsx +11 -12
- package/src/features/ResourceManager/index.tsx +13 -6
- package/src/features/ShareModal/ShareImage/Preview.tsx +19 -28
- package/src/features/ShareModal/ShareImage/style.ts +4 -2
- package/src/features/ShareModal/index.tsx +5 -1
- package/src/features/ShareModal/style.ts +1 -0
- package/src/features/ShareModal/useContainerStyles.ts +1 -1
- package/src/features/SharePopover/index.tsx +16 -9
- package/src/features/SharePopover/style.ts +2 -2
- package/src/features/SkillStore/CommunityList/Item.tsx +2 -2
- package/src/features/SkillStore/LobeHubList/Item.tsx +2 -2
- package/src/features/SkillStore/LobeHubList/index.tsx +2 -3
- package/src/features/SkillStore/style.ts +4 -4
- package/src/layout/GlobalProvider/ServerVersionOutdatedAlert.tsx +28 -20
- package/src/server/routers/lambda/userMemories.ts +61 -5
- package/src/server/routers/lambda/userMemory.ts +5 -1
- package/src/services/chat/index.ts +2 -2
- package/src/services/userMemory/index.ts +25 -1
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +0 -1
- package/src/store/userMemory/initialState.ts +22 -52
- package/src/store/userMemory/slices/context/action.ts +1 -1
- package/src/store/userMemory/slices/context/index.ts +1 -0
- package/src/store/userMemory/slices/context/initialState.ts +22 -0
- package/src/store/userMemory/slices/experience/action.ts +10 -22
- package/src/store/userMemory/slices/experience/index.ts +1 -0
- package/src/store/userMemory/slices/experience/initialState.ts +22 -0
- package/src/store/userMemory/slices/home/action.ts +17 -0
- package/src/store/userMemory/slices/identity/action.ts +36 -24
- package/src/store/userMemory/slices/identity/initialState.ts +7 -4
- package/src/store/userMemory/slices/preference/action.ts +1 -1
- package/src/store/userMemory/slices/preference/index.ts +1 -0
- package/src/store/userMemory/slices/preference/initialState.ts +22 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { isDesktop } from '@lobechat/const';
|
|
4
|
-
import { Flexbox, FormGroup, Text } from '@lobehub/ui';
|
|
5
|
-
import {
|
|
4
|
+
import { Flexbox, FormGroup, Skeleton, Text } from '@lobehub/ui';
|
|
5
|
+
import { Divider } from 'antd';
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
@@ -28,20 +28,20 @@ const SkeletonRow = ({ mobile }: { mobile?: boolean }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
<Flexbox gap={12} style={rowStyle}>
|
|
30
30
|
<Flexbox align="center" horizontal justify="space-between">
|
|
31
|
-
<
|
|
32
|
-
<
|
|
31
|
+
<Skeleton.Button active size="small" style={{ height: 22, width: 60 }} />
|
|
32
|
+
<Skeleton.Button active size="small" style={{ height: 22, width: 80 }} />
|
|
33
33
|
</Flexbox>
|
|
34
|
-
<
|
|
34
|
+
<Skeleton.Button active size="small" style={{ height: 22, width: 120 }} />
|
|
35
35
|
</Flexbox>
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
return (
|
|
39
39
|
<Flexbox align="center" gap={24} horizontal justify="space-between" style={rowStyle}>
|
|
40
40
|
<Flexbox align="center" gap={24} horizontal style={{ flex: 1 }}>
|
|
41
|
-
<
|
|
42
|
-
<
|
|
41
|
+
<Skeleton.Button active size="small" style={{ ...labelStyle, height: 22 }} />
|
|
42
|
+
<Skeleton.Button active size="small" style={{ height: 22, minWidth: 120, width: 160 }} />
|
|
43
43
|
</Flexbox>
|
|
44
|
-
<
|
|
44
|
+
<Skeleton.Button active size="small" style={{ height: 22, width: 100 }} />
|
|
45
45
|
</Flexbox>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type KlavisServerType } from '@lobechat/const';
|
|
4
4
|
import { ActionIcon, Avatar, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
|
|
5
5
|
import { App, Button } from 'antd';
|
|
6
|
-
import {
|
|
6
|
+
import { createStaticStyles, cssVar } from 'antd-style';
|
|
7
7
|
import { Loader2, MoreVerticalIcon, SquareArrowOutUpRight, Unplug } from 'lucide-react';
|
|
8
8
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
@@ -17,10 +17,10 @@ import { userProfileSelectors } from '@/store/user/selectors';
|
|
|
17
17
|
const POLL_INTERVAL_MS = 1000;
|
|
18
18
|
const POLL_TIMEOUT_MS = 15_000;
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
21
21
|
connected: css`
|
|
22
22
|
font-size: 14px;
|
|
23
|
-
color: ${
|
|
23
|
+
color: ${cssVar.colorSuccess};
|
|
24
24
|
`,
|
|
25
25
|
container: css`
|
|
26
26
|
padding-block: 12px;
|
|
@@ -28,11 +28,11 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
28
28
|
`,
|
|
29
29
|
disconnected: css`
|
|
30
30
|
font-size: 14px;
|
|
31
|
-
color: ${
|
|
31
|
+
color: ${cssVar.colorTextTertiary};
|
|
32
32
|
`,
|
|
33
33
|
error: css`
|
|
34
34
|
font-size: 14px;
|
|
35
|
-
color: ${
|
|
35
|
+
color: ${cssVar.colorError};
|
|
36
36
|
`,
|
|
37
37
|
icon: css`
|
|
38
38
|
display: flex;
|
|
@@ -44,20 +44,20 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
44
44
|
height: 48px;
|
|
45
45
|
border-radius: 12px;
|
|
46
46
|
|
|
47
|
-
background: ${
|
|
47
|
+
background: ${cssVar.colorFillTertiary};
|
|
48
48
|
`,
|
|
49
49
|
pending: css`
|
|
50
50
|
font-size: 14px;
|
|
51
|
-
color: ${
|
|
51
|
+
color: ${cssVar.colorWarning};
|
|
52
52
|
`,
|
|
53
53
|
title: css`
|
|
54
54
|
cursor: pointer;
|
|
55
55
|
font-size: 15px;
|
|
56
56
|
font-weight: 500;
|
|
57
|
-
color: ${
|
|
57
|
+
color: ${cssVar.colorText};
|
|
58
58
|
|
|
59
59
|
&:hover {
|
|
60
|
-
color: ${
|
|
60
|
+
color: ${cssVar.colorPrimary};
|
|
61
61
|
}
|
|
62
62
|
`,
|
|
63
63
|
}));
|
|
@@ -69,7 +69,6 @@ interface KlavisSkillItemProps {
|
|
|
69
69
|
|
|
70
70
|
const KlavisSkillItem = memo<KlavisSkillItemProps>(({ serverType, server }) => {
|
|
71
71
|
const { t } = useTranslation('setting');
|
|
72
|
-
const { styles } = useStyles();
|
|
73
72
|
const { modal } = App.useApp();
|
|
74
73
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
75
74
|
const [isWaitingAuth, setIsWaitingAuth] = useState(false);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type LobehubSkillProviderType } from '@lobechat/const';
|
|
4
4
|
import { ActionIcon, Avatar, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
|
|
5
5
|
import { App, Button } from 'antd';
|
|
6
|
-
import {
|
|
6
|
+
import { createStaticStyles, cssVar } from 'antd-style';
|
|
7
7
|
import { Loader2, MoreVerticalIcon, SquareArrowOutUpRight, Unplug } from 'lucide-react';
|
|
8
8
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
const POLL_INTERVAL_MS = 1000;
|
|
19
19
|
const POLL_TIMEOUT_MS = 15_000;
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
22
22
|
connected: css`
|
|
23
23
|
font-size: 14px;
|
|
24
|
-
color: ${
|
|
24
|
+
color: ${cssVar.colorSuccess};
|
|
25
25
|
`,
|
|
26
26
|
container: css`
|
|
27
27
|
padding-block: 12px;
|
|
@@ -29,17 +29,17 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
29
29
|
`,
|
|
30
30
|
disconnected: css`
|
|
31
31
|
font-size: 14px;
|
|
32
|
-
color: ${
|
|
32
|
+
color: ${cssVar.colorTextTertiary};
|
|
33
33
|
`,
|
|
34
34
|
disconnectedIcon: css`
|
|
35
35
|
opacity: 0.5;
|
|
36
36
|
`,
|
|
37
37
|
disconnectedTitle: css`
|
|
38
|
-
color: ${
|
|
38
|
+
color: ${cssVar.colorTextTertiary};
|
|
39
39
|
`,
|
|
40
40
|
error: css`
|
|
41
41
|
font-size: 14px;
|
|
42
|
-
color: ${
|
|
42
|
+
color: ${cssVar.colorError};
|
|
43
43
|
`,
|
|
44
44
|
icon: css`
|
|
45
45
|
display: flex;
|
|
@@ -51,16 +51,16 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
51
51
|
height: 48px;
|
|
52
52
|
border-radius: 12px;
|
|
53
53
|
|
|
54
|
-
background: ${
|
|
54
|
+
background: ${cssVar.colorFillTertiary};
|
|
55
55
|
`,
|
|
56
56
|
title: css`
|
|
57
57
|
cursor: pointer;
|
|
58
58
|
font-size: 15px;
|
|
59
59
|
font-weight: 500;
|
|
60
|
-
color: ${
|
|
60
|
+
color: ${cssVar.colorText};
|
|
61
61
|
|
|
62
62
|
&:hover {
|
|
63
|
-
color: ${
|
|
63
|
+
color: ${cssVar.colorPrimary};
|
|
64
64
|
}
|
|
65
65
|
`,
|
|
66
66
|
}));
|
|
@@ -72,7 +72,6 @@ interface LobehubSkillItemProps {
|
|
|
72
72
|
|
|
73
73
|
const LobehubSkillItem = memo<LobehubSkillItemProps>(({ provider, server }) => {
|
|
74
74
|
const { t } = useTranslation('setting');
|
|
75
|
-
const { styles } = useStyles();
|
|
76
75
|
const { modal } = App.useApp();
|
|
77
76
|
const [isConnecting, setIsConnecting] = useState(false);
|
|
78
77
|
const [isWaitingAuth, setIsWaitingAuth] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Block, Flexbox, Modal } from '@lobehub/ui';
|
|
4
|
-
import {
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
5
5
|
import { memo, useState } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ import { type LobeToolType } from '@/types/tool/tool';
|
|
|
15
15
|
|
|
16
16
|
import Actions from './Actions';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
19
19
|
container: css`
|
|
20
20
|
padding-block: 12px;
|
|
21
21
|
padding-inline: 0;
|
|
@@ -33,10 +33,10 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
33
33
|
cursor: pointer;
|
|
34
34
|
font-size: 15px;
|
|
35
35
|
font-weight: 500;
|
|
36
|
-
color: ${
|
|
36
|
+
color: ${cssVar.colorText};
|
|
37
37
|
|
|
38
38
|
&:hover {
|
|
39
|
-
color: ${
|
|
39
|
+
color: ${cssVar.colorPrimary};
|
|
40
40
|
}
|
|
41
41
|
`,
|
|
42
42
|
}));
|
|
@@ -52,7 +52,6 @@ interface McpSkillItemProps {
|
|
|
52
52
|
|
|
53
53
|
const McpSkillItem = memo<McpSkillItemProps>(
|
|
54
54
|
({ identifier, title, avatar, type, runtimeType, author }) => {
|
|
55
|
-
const { styles } = useStyles();
|
|
56
55
|
const { t } = useTranslation('plugin');
|
|
57
56
|
const isMCP = runtimeType === 'mcp';
|
|
58
57
|
const isCustomPlugin = type === 'customPlugin';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getLobehubSkillProviderById,
|
|
12
12
|
} from '@lobechat/const';
|
|
13
13
|
import { Divider } from 'antd';
|
|
14
|
-
import {
|
|
14
|
+
import { createStaticStyles } from 'antd-style';
|
|
15
15
|
import isEqual from 'fast-deep-equal';
|
|
16
16
|
import { memo, useMemo } from 'react';
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
@@ -33,7 +33,7 @@ import McpSkillItem from './McpSkillItem';
|
|
|
33
33
|
import KlavisSkillItem from './KlavisSkillItem';
|
|
34
34
|
import LobehubSkillItem from './LobehubSkillItem';
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
37
37
|
container: css`
|
|
38
38
|
display: flex;
|
|
39
39
|
flex-direction: column;
|
|
@@ -41,18 +41,17 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
41
41
|
`,
|
|
42
42
|
description: css`
|
|
43
43
|
margin-block-end: 8px;
|
|
44
|
-
color: ${
|
|
44
|
+
color: ${cssVar.colorTextSecondary};
|
|
45
45
|
`,
|
|
46
46
|
empty: css`
|
|
47
47
|
padding: 24px;
|
|
48
|
-
color: ${
|
|
48
|
+
color: ${cssVar.colorTextTertiary};
|
|
49
49
|
text-align: center;
|
|
50
50
|
`,
|
|
51
51
|
}));
|
|
52
52
|
|
|
53
53
|
const SkillList = memo(() => {
|
|
54
54
|
const { t } = useTranslation('setting');
|
|
55
|
-
const { styles } = useStyles();
|
|
56
55
|
|
|
57
56
|
const isLobehubSkillEnabled = useServerConfigStore(serverConfigSelectors.enableLobehubSkill);
|
|
58
57
|
const isKlavisEnabled = useServerConfigStore(serverConfigSelectors.enableKlavis);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Flexbox } from '@lobehub/ui';
|
|
4
3
|
import { memo, useCallback, useMemo } from 'react';
|
|
5
4
|
|
|
6
5
|
import { ChatList, ConversationProvider, MessageItem } from '@/features/Conversation';
|
|
@@ -44,9 +43,7 @@ const SharedMessageList = memo<SharedMessageListProps>(({ agentId, groupId, shar
|
|
|
44
43
|
replaceMessages(messages, { context: ctx });
|
|
45
44
|
}}
|
|
46
45
|
>
|
|
47
|
-
<
|
|
48
|
-
<ChatList disableActionsBar itemContent={itemContent} />
|
|
49
|
-
</Flexbox>
|
|
46
|
+
<ChatList disableActionsBar itemContent={itemContent} />
|
|
50
47
|
</ConversationProvider>
|
|
51
48
|
);
|
|
52
49
|
});
|
|
@@ -1,52 +1,27 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createStyles, cssVar } from 'antd-style';
|
|
3
|
+
import { Alert, Center, Flexbox, Text } from '@lobehub/ui';
|
|
4
|
+
import { cx } from 'antd-style';
|
|
6
5
|
import NextLink from 'next/link';
|
|
7
|
-
import { PropsWithChildren, memo, useEffect
|
|
6
|
+
import { PropsWithChildren, memo, useEffect } from 'react';
|
|
8
7
|
import { useTranslation } from 'react-i18next';
|
|
9
8
|
import { Link, Outlet, useParams } from 'react-router-dom';
|
|
10
9
|
import useSWR from 'swr';
|
|
11
10
|
|
|
12
11
|
import { ProductLogo } from '@/components/Branding';
|
|
13
|
-
import { DEFAULT_AVATAR } from '@/const/meta';
|
|
14
|
-
import GroupAvatar from '@/features/GroupAvatar';
|
|
15
12
|
import UserAvatar from '@/features/User/UserAvatar';
|
|
13
|
+
import { useIsDark } from '@/hooks/useIsDark';
|
|
16
14
|
import { lambdaClient } from '@/libs/trpc/client';
|
|
17
15
|
import { useAgentStore } from '@/store/agent';
|
|
18
16
|
import { useUserStore } from '@/store/user';
|
|
19
17
|
import { authSelectors } from '@/store/user/slices/auth/selectors';
|
|
20
18
|
|
|
21
19
|
import SharePortal from '../features/Portal';
|
|
22
|
-
|
|
23
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
24
|
-
container: css`
|
|
25
|
-
width: 100vw;
|
|
26
|
-
min-height: 100vh;
|
|
27
|
-
background: ${token.colorBgLayout};
|
|
28
|
-
`,
|
|
29
|
-
content: css`
|
|
30
|
-
flex: 1;
|
|
31
|
-
width: 100%;
|
|
32
|
-
padding-block: 24px;
|
|
33
|
-
padding-inline: 24px;
|
|
34
|
-
`,
|
|
35
|
-
footer: css`
|
|
36
|
-
padding-block: 16px;
|
|
37
|
-
padding-inline: 24px;
|
|
38
|
-
color: ${token.colorTextTertiary};
|
|
39
|
-
text-align: center;
|
|
40
|
-
`,
|
|
41
|
-
header: css`
|
|
42
|
-
height: 52px;
|
|
43
|
-
padding: 8px;
|
|
44
|
-
`,
|
|
45
|
-
}));
|
|
20
|
+
import { styles } from './style';
|
|
46
21
|
|
|
47
22
|
const ShareTopicLayout = memo<PropsWithChildren>(({ children }) => {
|
|
48
|
-
const { styles } = useStyles();
|
|
49
23
|
const { t } = useTranslation('chat');
|
|
24
|
+
const isDarkMode = useIsDark();
|
|
50
25
|
const { id } = useParams<{ id: string }>();
|
|
51
26
|
const dispatchAgentMap = useAgentStore((s) => s.internal_dispatchAgentMap);
|
|
52
27
|
const isLogin = useUserStore(authSelectors.isLogin);
|
|
@@ -69,100 +44,51 @@ const ShareTopicLayout = memo<PropsWithChildren>(({ children }) => {
|
|
|
69
44
|
}
|
|
70
45
|
}, [data?.agentId, data?.agentMeta, dispatchAgentMap]);
|
|
71
46
|
|
|
72
|
-
const isGroup = !!data?.groupId;
|
|
73
|
-
const isInboxAgent = !isGroup && data?.agentMeta?.slug === 'inbox';
|
|
74
|
-
const agentOrGroupTitle =
|
|
75
|
-
data?.groupMeta?.title || (isInboxAgent ? 'LobeAI' : data?.agentMeta?.title);
|
|
76
|
-
const agentMarketIdentifier = data?.agentMeta?.marketIdentifier;
|
|
77
|
-
|
|
78
|
-
// Build group avatars for GroupAvatar component
|
|
79
|
-
const groupAvatars = useMemo(() => {
|
|
80
|
-
if (!isGroup || !data?.groupMeta?.members) return [];
|
|
81
|
-
return data.groupMeta.members.map((member) => ({
|
|
82
|
-
avatar: member.avatar || DEFAULT_AVATAR,
|
|
83
|
-
backgroundColor: member.backgroundColor || undefined,
|
|
84
|
-
}));
|
|
85
|
-
}, [isGroup, data?.groupMeta?.members]);
|
|
86
|
-
|
|
87
|
-
const renderAgentOrGroupAvatar = () => {
|
|
88
|
-
// For group: use GroupAvatar with members
|
|
89
|
-
if (isGroup && groupAvatars.length > 0) {
|
|
90
|
-
return <GroupAvatar avatars={groupAvatars} size={24} />;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// For inbox agent: skip avatar as it's the same as product icon
|
|
94
|
-
if (isInboxAgent) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// For agent: use single Avatar
|
|
99
|
-
if (data?.agentMeta?.avatar) {
|
|
100
|
-
return (
|
|
101
|
-
<Avatar
|
|
102
|
-
avatar={data.agentMeta.avatar}
|
|
103
|
-
background={data.agentMeta.backgroundColor || cssVar.colorFillTertiary}
|
|
104
|
-
shape="square"
|
|
105
|
-
size={24}
|
|
106
|
-
/>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return null;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const renderAgentOrGroupTitle = () => {
|
|
114
|
-
if (!agentOrGroupTitle) return null;
|
|
115
|
-
|
|
116
|
-
// If agent has marketIdentifier, render as link to assistant page
|
|
117
|
-
if (agentMarketIdentifier && !data?.groupMeta?.title) {
|
|
118
|
-
return (
|
|
119
|
-
<a href={`/community/agent/${agentMarketIdentifier}`} rel="noreferrer" target="_blank">
|
|
120
|
-
<Typography.Text ellipsis strong>
|
|
121
|
-
{agentOrGroupTitle}
|
|
122
|
-
</Typography.Text>
|
|
123
|
-
</a>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<Typography.Text ellipsis strong>
|
|
129
|
-
{agentOrGroupTitle}
|
|
130
|
-
</Typography.Text>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
47
|
return (
|
|
135
|
-
<Flexbox className={styles.
|
|
136
|
-
<Flexbox
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
{
|
|
148
|
-
|
|
48
|
+
<Flexbox className={styles.outerContainer} height={'100%'} padding={8} width={'100%'}>
|
|
49
|
+
<Flexbox
|
|
50
|
+
className={cx(isDarkMode ? styles.innerContainerDark : styles.innerContainerLight)}
|
|
51
|
+
height={'100%'}
|
|
52
|
+
width={'100%'}
|
|
53
|
+
>
|
|
54
|
+
<Flexbox
|
|
55
|
+
align={'center'}
|
|
56
|
+
gap={8}
|
|
57
|
+
horizontal
|
|
58
|
+
justify={'space-between'}
|
|
59
|
+
padding={8}
|
|
60
|
+
width={'100%'}
|
|
61
|
+
>
|
|
62
|
+
<Flexbox align="center" flex={1} gap={12} horizontal>
|
|
63
|
+
{isLogin ? (
|
|
64
|
+
<Link to="/">
|
|
65
|
+
<UserAvatar size={32} />
|
|
66
|
+
</Link>
|
|
67
|
+
) : (
|
|
68
|
+
<NextLink href="/login">
|
|
69
|
+
<ProductLogo size={32} />
|
|
70
|
+
</NextLink>
|
|
71
|
+
)}
|
|
72
|
+
</Flexbox>
|
|
73
|
+
<Center flex={2} gap={12} horizontal>
|
|
74
|
+
{data?.title && (
|
|
75
|
+
<Text align={'center'} ellipsis style={{ textAlign: 'center' }} weight={500}>
|
|
76
|
+
{data.title}
|
|
77
|
+
</Text>
|
|
78
|
+
)}
|
|
79
|
+
</Center>
|
|
80
|
+
<Flexbox align="center" flex={1} gap={12} horizontal justify={'flex-end'} />
|
|
149
81
|
</Flexbox>
|
|
150
|
-
{
|
|
151
|
-
<
|
|
152
|
-
{
|
|
153
|
-
</
|
|
154
|
-
|
|
155
|
-
<Flexbox align="center" flex={1} horizontal justify="flex-end">
|
|
156
|
-
{isLogin && <UserAvatar size={24} />}
|
|
157
|
-
</Flexbox>
|
|
158
|
-
</Flexbox>
|
|
159
|
-
<Flexbox className={styles.content} horizontal style={{ overflow: 'hidden' }}>
|
|
160
|
-
<Flexbox flex={1} style={{ overflow: 'hidden' }}>
|
|
161
|
-
{children ?? <Outlet />}
|
|
82
|
+
<Flexbox className={styles.content} horizontal style={{ overflow: 'hidden' }}>
|
|
83
|
+
<Flexbox flex={1} style={{ overflow: 'hidden' }}>
|
|
84
|
+
{children ?? <Outlet />}
|
|
85
|
+
</Flexbox>
|
|
86
|
+
<SharePortal />
|
|
162
87
|
</Flexbox>
|
|
163
|
-
<
|
|
88
|
+
<Center padding={8} style={{ opacity: 0.25 }}>
|
|
89
|
+
<Alert title={t('sharePageDisclaimer')} type={'secondary'} variant={'borderless'} />
|
|
90
|
+
</Center>
|
|
164
91
|
</Flexbox>
|
|
165
|
-
<Typography.Text className={styles.footer}>{t('sharePageDisclaimer')}</Typography.Text>
|
|
166
92
|
</Flexbox>
|
|
167
93
|
);
|
|
168
94
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createStaticStyles } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
4
|
+
container: css`
|
|
5
|
+
width: 100vw;
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
background: ${cssVar.colorBgLayout};
|
|
8
|
+
`,
|
|
9
|
+
|
|
10
|
+
content: css`
|
|
11
|
+
flex: 1;
|
|
12
|
+
width: 100%;
|
|
13
|
+
`,
|
|
14
|
+
|
|
15
|
+
// Divider 样式
|
|
16
|
+
divider: css`
|
|
17
|
+
height: 24px;
|
|
18
|
+
`,
|
|
19
|
+
|
|
20
|
+
footer: css`
|
|
21
|
+
padding-block: 16px;
|
|
22
|
+
padding-inline: 24px;
|
|
23
|
+
color: ${cssVar.colorTextTertiary};
|
|
24
|
+
text-align: center;
|
|
25
|
+
`,
|
|
26
|
+
|
|
27
|
+
header: css`
|
|
28
|
+
height: 52px;
|
|
29
|
+
padding: 8px;
|
|
30
|
+
`,
|
|
31
|
+
|
|
32
|
+
// 内层容器 - 深色模式
|
|
33
|
+
innerContainerDark: css`
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
|
|
38
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
39
|
+
border-radius: ${cssVar.borderRadius};
|
|
40
|
+
|
|
41
|
+
background: ${cssVar.colorBgContainer};
|
|
42
|
+
`,
|
|
43
|
+
|
|
44
|
+
// 内层容器 - 浅色模式
|
|
45
|
+
innerContainerLight: css`
|
|
46
|
+
position: relative;
|
|
47
|
+
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
|
|
50
|
+
border: 1px solid ${cssVar.colorBorder};
|
|
51
|
+
border-radius: ${cssVar.borderRadius};
|
|
52
|
+
|
|
53
|
+
background: ${cssVar.colorBgContainer};
|
|
54
|
+
`,
|
|
55
|
+
// 外层容器
|
|
56
|
+
outerContainer: css`
|
|
57
|
+
position: relative;
|
|
58
|
+
`,
|
|
59
|
+
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { DraggablePanel } from '@lobehub/ui';
|
|
4
|
-
import {
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { CHAT_PORTAL_TOOL_UI_WIDTH } from '@/const/layoutTokens';
|
|
@@ -9,7 +9,7 @@ import { PortalContent } from '@/features/Portal/router';
|
|
|
9
9
|
import { useChatStore } from '@/store/chat';
|
|
10
10
|
import { chatPortalSelectors } from '@/store/chat/selectors';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const styles = createStaticStyles(({ cssVar, css }) => ({
|
|
13
13
|
body: css`
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
display: flex;
|
|
@@ -30,17 +30,16 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
30
30
|
min-height: 100%;
|
|
31
31
|
max-height: 100%;
|
|
32
32
|
|
|
33
|
-
background: ${
|
|
33
|
+
background: ${cssVar.colorBgContainer};
|
|
34
34
|
`,
|
|
35
35
|
drawer: css`
|
|
36
36
|
z-index: 10;
|
|
37
37
|
height: 100%;
|
|
38
|
-
background: ${
|
|
38
|
+
background: ${cssVar.colorBgContainer};
|
|
39
39
|
`,
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
42
|
const SharePortal = memo(() => {
|
|
43
|
-
const { styles } = useStyles();
|
|
44
43
|
const showPortal = useChatStore(chatPortalSelectors.showPortal);
|
|
45
44
|
|
|
46
45
|
return (
|