@lobehub/chat 0.70.2 → 0.70.3
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 +25 -0
- package/package.json +1 -1
- package/src/const/url.ts +2 -0
- package/src/features/MobileTabBar/index.tsx +4 -12
- package/src/features/SideBar/BottomActions.tsx +12 -2
- package/src/features/SideBar/TopActions.tsx +7 -1
- package/src/layout/AppMobileLayout.tsx +11 -8
- package/src/pages/chat/features/Conversation/Input/index.tsx +4 -3
- package/src/pages/chat/features/Header/Mobile.tsx +1 -1
- package/src/pages/chat/features/Header/index.tsx +3 -4
- package/src/pages/chat/features/SessionList/Desktop.tsx +24 -0
- package/src/pages/chat/features/SessionList/{Header.tsx → Header/Desktop.tsx} +2 -26
- package/src/pages/chat/features/SessionList/Header/Mobile.tsx +42 -0
- package/src/pages/chat/features/SessionList/Header/index.tsx +14 -0
- package/src/pages/chat/features/SessionList/Mobile.tsx +26 -0
- package/src/pages/chat/features/SessionList/index.tsx +11 -25
- package/src/pages/chat/features/Sidebar/Desktop.tsx +58 -0
- package/src/pages/chat/features/Sidebar/{SystemRole.tsx → SystemRole/index.tsx} +3 -37
- package/src/pages/chat/features/Sidebar/SystemRole/style.ts +36 -0
- package/src/pages/chat/features/Sidebar/index.tsx +20 -78
- package/src/pages/chat/index.page.tsx +14 -13
- package/src/pages/chat/{mobile.tsx → layout.mobile.tsx} +2 -8
- package/src/pages/chat/layout.tsx +8 -13
- package/src/pages/chat/mobile/index.page.tsx +1 -1
- package/src/pages/chat/setting/features/Header/Desktop.tsx +21 -0
- package/src/pages/chat/setting/features/Header/Mobile.tsx +19 -0
- package/src/pages/chat/setting/features/Header/index.tsx +57 -0
- package/src/pages/chat/setting/index.page.tsx +5 -21
- package/src/pages/chat/setting/layout.mobile.tsx +18 -0
- package/src/pages/chat/setting/layout.tsx +22 -0
- package/src/pages/market/features/Header/Desktop.tsx +54 -0
- package/src/pages/market/features/Header/Mobile.tsx +42 -0
- package/src/pages/market/features/Header/index.tsx +13 -0
- package/src/pages/market/index.page.tsx +30 -0
- package/src/pages/market/layout.mobile.tsx +19 -0
- package/src/pages/market/layout.tsx +23 -0
- package/src/pages/settings/{Header.tsx → features/Header/Desktop.tsx} +2 -2
- package/src/pages/settings/features/Header/Mobile.tsx +18 -0
- package/src/pages/settings/features/Header/index.tsx +14 -0
- package/src/pages/settings/{Settings → features/Settings}/index.tsx +1 -2
- package/src/pages/settings/index.page.tsx +8 -21
- package/src/pages/settings/layout.mobile.tsx +18 -0
- package/src/pages/settings/layout.tsx +8 -1
- package/src/pages/welcome/{Banner → features/Banner}/AgentTemplate.tsx +1 -1
- package/src/pages/welcome/{Banner → features/Banner}/Hero.tsx +1 -1
- package/src/pages/welcome/{Banner → features/Banner}/index.tsx +1 -1
- package/src/pages/welcome/index.page.tsx +3 -3
- package/src/pages/welcome/layout.tsx +1 -1
- package/src/pages/chat/setting/Header.tsx +0 -82
- package/src/pages/chat/setting/mobile.tsx +0 -11
- package/src/pages/settings/mobile.tsx +0 -20
- /package/src/pages/chat/features/Header/{PC.tsx → Desktop.tsx} +0 -0
- /package/src/pages/chat/features/Header/{PluginTag.tsx → PluginTag/index.tsx} +0 -0
- /package/src/pages/chat/features/Header/{ShareButton.tsx → ShareButton/index.tsx} +0 -0
- /package/src/pages/chat/features/SessionList/{CollapseGroup.tsx → CollapseGroup/index.tsx} +0 -0
- /package/src/pages/chat/features/SessionList/{Inbox.tsx → Inbox/index.tsx} +0 -0
- /package/src/pages/chat/features/Sidebar/{Header.tsx → SystemRole/Header.tsx} +0 -0
- /package/src/pages/settings/{Settings → features/Settings}/Agent.tsx +0 -0
- /package/src/pages/settings/{Settings → features/Settings}/Common.tsx +0 -0
- /package/src/pages/settings/{ThemeSwatches → features/ThemeSwatches}/ThemeSwatchesNeutral.tsx +0 -0
- /package/src/pages/settings/{ThemeSwatches → features/ThemeSwatches}/ThemeSwatchesPrimary.tsx +0 -0
- /package/src/pages/settings/{ThemeSwatches → features/ThemeSwatches}/index.ts +0 -0
- /package/src/pages/welcome/{Banner → features/Banner}/AgentCard.tsx +0 -0
- /package/src/pages/welcome/{style.ts → features/Banner/style.ts} +0 -0
- /package/src/pages/welcome/{Footer → features/Footer}/index.tsx +0 -0
- /package/src/pages/welcome/{mobile.tsx → layout.mobile.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.70.3](https://github.com/lobehub/lobe-chat/compare/v0.70.2...v0.70.3)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-09-09**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Better mobile style.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Better mobile style ([776c407](https://github.com/lobehub/lobe-chat/commit/776c407))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.70.2](https://github.com/lobehub/lobe-chat/compare/v0.70.1...v0.70.2)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-09-08**</sup>
|
package/package.json
CHANGED
package/src/const/url.ts
CHANGED
|
@@ -10,5 +10,7 @@ export const DISCORD = 'https://discord.gg/AYFPHvv2jT';
|
|
|
10
10
|
export const PLUGINS_INDEX_URL =
|
|
11
11
|
process.env.PLUGINS_INDEX_URL ?? 'https://chat-plugins.lobehub.com';
|
|
12
12
|
|
|
13
|
+
export const AGENTS_INDEX_URL = process.env.AGENTS_INDEX_URL ?? 'https://chat-agents.lobehub.com';
|
|
14
|
+
|
|
13
15
|
export const SESSION_CHAT_URL = (id: string = INBOX_SESSION_ID, mobile?: boolean) =>
|
|
14
16
|
mobile ? `/chat/mobile#session=${id}` : `/chat#session=${id}`;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Icon, MobileTabBar, type MobileTabBarProps } from '@lobehub/ui';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
|
-
import { MessageSquare,
|
|
3
|
+
import { MessageSquare, Sticker } from 'lucide-react';
|
|
4
4
|
import Router from 'next/router';
|
|
5
5
|
import { rgba } from 'polished';
|
|
6
6
|
import { memo, useMemo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
9
|
import { useGlobalStore } from '@/store/global';
|
|
10
|
-
import { useSessionStore } from '@/store/session';
|
|
11
10
|
|
|
12
11
|
const useStyles = createStyles(({ css, token }) => ({
|
|
13
12
|
active: css`
|
|
@@ -21,7 +20,6 @@ export default memo<{ className?: string }>(({ className }) => {
|
|
|
21
20
|
const [tab, setTab] = useGlobalStore((s) => [s.sidebarKey, s.switchSideBar]);
|
|
22
21
|
const { t } = useTranslation('common');
|
|
23
22
|
const { styles } = useStyles();
|
|
24
|
-
const switchSession = useSessionStore((s) => s.switchSession);
|
|
25
23
|
const items: MobileTabBarProps['items'] = useMemo(
|
|
26
24
|
() => [
|
|
27
25
|
{
|
|
@@ -30,23 +28,17 @@ export default memo<{ className?: string }>(({ className }) => {
|
|
|
30
28
|
),
|
|
31
29
|
key: 'chat',
|
|
32
30
|
onClick: () => {
|
|
33
|
-
|
|
31
|
+
Router.push('/chat');
|
|
34
32
|
},
|
|
35
33
|
title: t('tab.chat'),
|
|
36
34
|
},
|
|
37
35
|
{
|
|
38
36
|
icon: (active) => <Icon className={active ? styles.active : undefined} icon={Sticker} />,
|
|
39
37
|
key: 'market',
|
|
40
|
-
|
|
41
|
-
title: t('tab.market'),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
icon: (active) => <Icon className={active ? styles.active : undefined} icon={Settings2} />,
|
|
45
|
-
key: 'settings',
|
|
46
38
|
onClick: () => {
|
|
47
|
-
Router.push('/
|
|
39
|
+
Router.push('/market');
|
|
48
40
|
},
|
|
49
|
-
title: t('tab.
|
|
41
|
+
title: t('tab.market'),
|
|
50
42
|
},
|
|
51
43
|
],
|
|
52
44
|
[t],
|
|
@@ -110,8 +110,18 @@ const BottomActions = memo<BottomActionProps>(({ tab, setTab }) => {
|
|
|
110
110
|
|
|
111
111
|
return (
|
|
112
112
|
<>
|
|
113
|
-
<ActionIcon
|
|
114
|
-
|
|
113
|
+
<ActionIcon
|
|
114
|
+
icon={DiscordIcon}
|
|
115
|
+
onClick={() => window.open(DISCORD, '__blank')}
|
|
116
|
+
placement={'right'}
|
|
117
|
+
title={'Discord'}
|
|
118
|
+
/>
|
|
119
|
+
<ActionIcon
|
|
120
|
+
icon={Github}
|
|
121
|
+
onClick={() => window.open(GITHUB, '__blank')}
|
|
122
|
+
placement={'right'}
|
|
123
|
+
title={'Github'}
|
|
124
|
+
/>
|
|
115
125
|
<Dropdown arrow={false} menu={{ items }} trigger={['click']}>
|
|
116
126
|
<ActionIcon active={tab === 'settings'} icon={Settings2} />
|
|
117
127
|
</Dropdown>
|
|
@@ -26,13 +26,19 @@ const TopActions = memo<TopActionProps>(({ tab, setTab }) => {
|
|
|
26
26
|
switchBackToChat();
|
|
27
27
|
setTab('chat');
|
|
28
28
|
}}
|
|
29
|
+
placement={'right'}
|
|
29
30
|
size="large"
|
|
30
31
|
title={t('tab.chat')}
|
|
31
32
|
/>
|
|
32
33
|
<ActionIcon
|
|
33
34
|
active={tab === 'market'}
|
|
34
35
|
icon={Sticker}
|
|
35
|
-
|
|
36
|
+
onClick={() => {
|
|
37
|
+
if (Router.asPath.startsWith('/market')) return;
|
|
38
|
+
Router.push('/market');
|
|
39
|
+
setTab('market');
|
|
40
|
+
}}
|
|
41
|
+
placement={'right'}
|
|
36
42
|
size="large"
|
|
37
43
|
title={t('tab.market')}
|
|
38
44
|
/>
|
|
@@ -8,16 +8,19 @@ import SafeSpacing from '@/components/SafeSpacing';
|
|
|
8
8
|
import MobileTabBar from '@/features/MobileTabBar';
|
|
9
9
|
import { useOnFinishHydrationSession, useSessionStore } from '@/store/session';
|
|
10
10
|
|
|
11
|
-
const useStyles = createStyles(({ css }) => ({
|
|
12
|
-
container:
|
|
13
|
-
|
|
11
|
+
const useStyles = createStyles(({ css, cx, stylish }) => ({
|
|
12
|
+
container: cx(
|
|
13
|
+
stylish.noScrollbar,
|
|
14
|
+
css`
|
|
15
|
+
position: relative;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
overflow-x: hidden;
|
|
18
|
+
overflow-y: auto;
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
width: 100vw;
|
|
21
|
+
height: 100vh;
|
|
22
|
+
`,
|
|
23
|
+
),
|
|
21
24
|
mobileNavBar: css`
|
|
22
25
|
position: fixed;
|
|
23
26
|
z-index: 100;
|
|
@@ -14,7 +14,7 @@ import Token from './Token';
|
|
|
14
14
|
const ChatInput = () => {
|
|
15
15
|
const { t } = useTranslation('common');
|
|
16
16
|
const [expand, setExpand] = useState<boolean>(false);
|
|
17
|
-
const [
|
|
17
|
+
const [message, setMessage] = useState('');
|
|
18
18
|
|
|
19
19
|
const [inputHeight, updatePreference] = useGlobalStore((s) => [
|
|
20
20
|
s.preference.inputHeight,
|
|
@@ -51,7 +51,7 @@ const ChatInput = () => {
|
|
|
51
51
|
actions={
|
|
52
52
|
<>
|
|
53
53
|
<InputActions />
|
|
54
|
-
<Token input={
|
|
54
|
+
<Token input={message} />
|
|
55
55
|
</>
|
|
56
56
|
}
|
|
57
57
|
actionsRight={<ActionsRight />}
|
|
@@ -60,7 +60,7 @@ const ChatInput = () => {
|
|
|
60
60
|
loading={isLoading}
|
|
61
61
|
minHeight={CHAT_TEXTAREA_HEIGHT}
|
|
62
62
|
onExpandChange={setExpand}
|
|
63
|
-
onInputChange={
|
|
63
|
+
onInputChange={setMessage}
|
|
64
64
|
onSend={sendMessage}
|
|
65
65
|
onStop={stopGenerateMessage}
|
|
66
66
|
placeholder={t('sendPlaceholder')}
|
|
@@ -68,6 +68,7 @@ const ChatInput = () => {
|
|
|
68
68
|
send: t('send'),
|
|
69
69
|
stop: t('stop'),
|
|
70
70
|
}}
|
|
71
|
+
value={message}
|
|
71
72
|
/>
|
|
72
73
|
</DraggablePanel>
|
|
73
74
|
);
|
|
@@ -24,7 +24,7 @@ const MobileHeader = memo(() => {
|
|
|
24
24
|
return (
|
|
25
25
|
<MobileNavBar
|
|
26
26
|
center={<MobileNavBarTitle desc={model} title={displayTitle} />}
|
|
27
|
-
onBackClick={() => Router.
|
|
27
|
+
onBackClick={() => Router.push('/chat')}
|
|
28
28
|
right={
|
|
29
29
|
<>
|
|
30
30
|
<ActionIcon icon={LayoutList} onClick={() => toggleConfig()} />
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { useResponsive } from 'antd-style';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
|
|
4
|
+
import Desktop from './Desktop';
|
|
4
5
|
import Mobile from './Mobile';
|
|
5
|
-
import PC from './PC';
|
|
6
6
|
|
|
7
7
|
const Header = memo(() => {
|
|
8
8
|
const { mobile } = useResponsive();
|
|
9
|
+
const Render = mobile ? Mobile : Desktop;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return <PC />;
|
|
11
|
+
return <Render />;
|
|
13
12
|
});
|
|
14
13
|
|
|
15
14
|
export default Header;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DraggablePanelBody } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { ReactNode, memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import FolderPanel from '@/features/FolderPanel';
|
|
6
|
+
|
|
7
|
+
import Header from './Header';
|
|
8
|
+
|
|
9
|
+
const useStyles = createStyles(({ stylish }) => stylish.noScrollbar);
|
|
10
|
+
|
|
11
|
+
const Sessions = memo<{ children: ReactNode }>(({ children }) => {
|
|
12
|
+
const { styles } = useStyles();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<FolderPanel>
|
|
16
|
+
<Header />
|
|
17
|
+
<DraggablePanelBody className={styles} style={{ padding: 0 }}>
|
|
18
|
+
{children}
|
|
19
|
+
</DraggablePanelBody>
|
|
20
|
+
</FolderPanel>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default Sessions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionIcon, Logo,
|
|
1
|
+
import { ActionIcon, Logo, SearchBar } from '@lobehub/ui';
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
3
|
import { MessageSquarePlus } from 'lucide-react';
|
|
4
4
|
import Link from 'next/link';
|
|
@@ -6,7 +6,6 @@ import { memo } from 'react';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
|
8
8
|
|
|
9
|
-
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
10
9
|
import { useSessionStore } from '@/store/session';
|
|
11
10
|
|
|
12
11
|
export const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -19,34 +18,11 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
19
18
|
`,
|
|
20
19
|
}));
|
|
21
20
|
|
|
22
|
-
const Header = memo
|
|
21
|
+
const Header = memo(() => {
|
|
23
22
|
const { styles } = useStyles();
|
|
24
23
|
const { t } = useTranslation('common');
|
|
25
24
|
const [keywords, createSession] = useSessionStore((s) => [s.searchKeywords, s.createSession]);
|
|
26
25
|
|
|
27
|
-
if (mobile === 'navbar') {
|
|
28
|
-
return (
|
|
29
|
-
<MobileNavBar
|
|
30
|
-
center={<Logo type={'text'} />}
|
|
31
|
-
left={<AvatarWithUpload size={28} style={{ marginLeft: 8 }} />}
|
|
32
|
-
right={<ActionIcon icon={MessageSquarePlus} onClick={createSession} />}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (mobile === 'search')
|
|
38
|
-
return (
|
|
39
|
-
<Flexbox className={styles.top} padding={16}>
|
|
40
|
-
<SearchBar
|
|
41
|
-
allowClear
|
|
42
|
-
onChange={(e) => useSessionStore.setState({ searchKeywords: e.target.value })}
|
|
43
|
-
placeholder={t('searchAgentPlaceholder')}
|
|
44
|
-
type={'block'}
|
|
45
|
-
value={keywords}
|
|
46
|
-
/>
|
|
47
|
-
</Flexbox>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
26
|
return (
|
|
51
27
|
<Flexbox className={styles.top} gap={16} padding={16}>
|
|
52
28
|
<Flexbox distribution={'space-between'} horizontal>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ActionIcon, Logo, MobileNavBar } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { MessageSquarePlus, Settings2 } from 'lucide-react';
|
|
4
|
+
import Router from 'next/router';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
|
|
7
|
+
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
8
|
+
import { useSessionStore } from '@/store/session';
|
|
9
|
+
|
|
10
|
+
export const useStyles = createStyles(({ css, token }) => ({
|
|
11
|
+
logo: css`
|
|
12
|
+
fill: ${token.colorText};
|
|
13
|
+
`,
|
|
14
|
+
top: css`
|
|
15
|
+
position: sticky;
|
|
16
|
+
top: 0;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const Header = memo(() => {
|
|
21
|
+
const [createSession] = useSessionStore((s) => [s.createSession]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<MobileNavBar
|
|
25
|
+
center={<Logo type={'text'} />}
|
|
26
|
+
left={<AvatarWithUpload size={28} style={{ marginLeft: 8 }} />}
|
|
27
|
+
right={
|
|
28
|
+
<>
|
|
29
|
+
<ActionIcon icon={MessageSquarePlus} onClick={createSession} />
|
|
30
|
+
<ActionIcon
|
|
31
|
+
icon={Settings2}
|
|
32
|
+
onClick={() => {
|
|
33
|
+
Router.push({ pathname: `/settings` });
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default Header;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useResponsive } from 'antd-style';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import Desktop from './Desktop';
|
|
5
|
+
import Mobile from './Mobile';
|
|
6
|
+
|
|
7
|
+
const Header = memo(() => {
|
|
8
|
+
const { mobile } = useResponsive();
|
|
9
|
+
const Render = mobile ? Mobile : Desktop;
|
|
10
|
+
|
|
11
|
+
return <Render />;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default Header;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SearchBar } from '@lobehub/ui';
|
|
2
|
+
import { ReactNode, memo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
import { useSessionStore } from '@/store/session';
|
|
6
|
+
|
|
7
|
+
const Sessions = memo<{ children: ReactNode }>(({ children }) => {
|
|
8
|
+
const { t } = useTranslation('common');
|
|
9
|
+
const [keywords] = useSessionStore((s) => [s.searchKeywords, s.createSession]);
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<div style={{ padding: '8px 16px' }}>
|
|
13
|
+
<SearchBar
|
|
14
|
+
allowClear
|
|
15
|
+
onChange={(e) => useSessionStore.setState({ searchKeywords: e.target.value })}
|
|
16
|
+
placeholder={t('searchAgentPlaceholder')}
|
|
17
|
+
type={'block'}
|
|
18
|
+
value={keywords}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
{children}
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default Sessions;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { DraggablePanelBody } from '@lobehub/ui';
|
|
2
1
|
import { CollapseProps } from 'antd';
|
|
3
|
-
import {
|
|
2
|
+
import { useResponsive } from 'antd-style';
|
|
4
3
|
import { memo, useMemo } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
|
|
7
|
-
import FolderPanel from '@/features/FolderPanel';
|
|
8
|
-
|
|
9
6
|
import CollapseGroup from './CollapseGroup';
|
|
10
|
-
import
|
|
7
|
+
import Desktop from './Desktop';
|
|
11
8
|
import Inbox from './Inbox';
|
|
12
9
|
import SessionList from './List';
|
|
10
|
+
import Mobile from './Mobile';
|
|
13
11
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
export const Sessions = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
12
|
+
export const Sessions = memo(() => {
|
|
13
|
+
const { mobile } = useResponsive();
|
|
17
14
|
const { t } = useTranslation('common');
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
const Render = mobile ? Mobile : Desktop;
|
|
19
17
|
|
|
20
18
|
const items: CollapseProps['items'] = useMemo(
|
|
21
19
|
() => [
|
|
@@ -28,22 +26,10 @@ export const Sessions = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
|
28
26
|
[],
|
|
29
27
|
);
|
|
30
28
|
|
|
31
|
-
if (mobile)
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<Header mobile={'search'} />
|
|
35
|
-
<Inbox />
|
|
36
|
-
<CollapseGroup defaultActiveKey={['sessionList']} items={items} />
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
29
|
return (
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
<CollapseGroup defaultActiveKey={['sessionList']} items={items} />
|
|
46
|
-
</DraggablePanelBody>
|
|
47
|
-
</FolderPanel>
|
|
30
|
+
<Render>
|
|
31
|
+
<Inbox />
|
|
32
|
+
<CollapseGroup defaultActiveKey={['sessionList']} items={items} />
|
|
33
|
+
</Render>
|
|
48
34
|
);
|
|
49
35
|
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { ReactNode, memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import SafeSpacing from '@/components/SafeSpacing';
|
|
6
|
+
import { CHAT_SIDEBAR_WIDTH } from '@/const/layoutTokens';
|
|
7
|
+
import { useGlobalStore } from '@/store/global';
|
|
8
|
+
import { useSessionStore } from '@/store/session';
|
|
9
|
+
import { sessionSelectors } from '@/store/session/slices/session/selectors';
|
|
10
|
+
|
|
11
|
+
import SystemRole from './SystemRole';
|
|
12
|
+
|
|
13
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
14
|
+
content: css`
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
`,
|
|
18
|
+
drawer: css`
|
|
19
|
+
background: ${token.colorBgLayout};
|
|
20
|
+
`,
|
|
21
|
+
header: css`
|
|
22
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
23
|
+
`,
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
const SideBar = memo<{ children: ReactNode }>(({ children }) => {
|
|
27
|
+
const { styles } = useStyles();
|
|
28
|
+
const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [
|
|
29
|
+
s.preference.showChatSideBar,
|
|
30
|
+
s.toggleChatSideBar,
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const isInbox = useSessionStore(sessionSelectors.isInboxSession);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<DraggablePanel
|
|
37
|
+
className={styles.drawer}
|
|
38
|
+
classNames={{
|
|
39
|
+
content: styles.content,
|
|
40
|
+
}}
|
|
41
|
+
expand={showAgentSettings}
|
|
42
|
+
minWidth={CHAT_SIDEBAR_WIDTH}
|
|
43
|
+
mode={'fixed'}
|
|
44
|
+
onExpandChange={toggleConfig}
|
|
45
|
+
placement={'right'}
|
|
46
|
+
>
|
|
47
|
+
<DraggablePanelContainer
|
|
48
|
+
style={{ flex: 'none', height: '100%', minWidth: CHAT_SIDEBAR_WIDTH }}
|
|
49
|
+
>
|
|
50
|
+
<SafeSpacing />
|
|
51
|
+
{!isInbox && <SystemRole />}
|
|
52
|
+
{children}
|
|
53
|
+
</DraggablePanelContainer>
|
|
54
|
+
</DraggablePanel>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default SideBar;
|
|
@@ -1,51 +1,17 @@
|
|
|
1
1
|
import { ActionIcon, EditableMessage } from '@lobehub/ui';
|
|
2
2
|
import { Skeleton } from 'antd';
|
|
3
|
-
import { createStyles } from 'antd-style';
|
|
4
3
|
import { Edit } from 'lucide-react';
|
|
5
4
|
import { memo, useState } from 'react';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import { Flexbox } from 'react-layout-kit';
|
|
8
7
|
|
|
9
|
-
import Header from '@/pages/chat/features/Sidebar/Header';
|
|
10
8
|
import { useSessionChatInit, useSessionStore } from '@/store/session';
|
|
11
9
|
import { agentSelectors } from '@/store/session/selectors';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
overflow-x: hidden;
|
|
16
|
-
overflow-y: auto;
|
|
11
|
+
import Header from './Header';
|
|
12
|
+
import { useStyles } from './style';
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
opacity: 0.75;
|
|
21
|
-
|
|
22
|
-
transition: opacity 200ms ${token.motionEaseOut};
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
`,
|
|
28
|
-
promptBox: css`
|
|
29
|
-
position: relative;
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
border-bottom: 1px solid ${token.colorBorder};
|
|
32
|
-
`,
|
|
33
|
-
promptMask: css`
|
|
34
|
-
pointer-events: none;
|
|
35
|
-
|
|
36
|
-
position: absolute;
|
|
37
|
-
z-index: 10;
|
|
38
|
-
bottom: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 32px;
|
|
43
|
-
|
|
44
|
-
background: linear-gradient(to bottom, transparent, ${token.colorBgLayout});
|
|
45
|
-
`,
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
const SystemRole = memo<{ mobile?: boolean }>(() => {
|
|
14
|
+
const SystemRole = memo(() => {
|
|
49
15
|
const [openModal, setOpenModal] = useState(false);
|
|
50
16
|
|
|
51
17
|
const { styles } = useStyles();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createStyles } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export const useStyles = createStyles(({ css, token }) => ({
|
|
4
|
+
prompt: css`
|
|
5
|
+
overflow-x: hidden;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
|
|
8
|
+
padding: 0 16px 16px;
|
|
9
|
+
|
|
10
|
+
opacity: 0.75;
|
|
11
|
+
|
|
12
|
+
transition: opacity 200ms ${token.motionEaseOut};
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
promptBox: css`
|
|
19
|
+
position: relative;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
22
|
+
`,
|
|
23
|
+
promptMask: css`
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
|
|
26
|
+
position: absolute;
|
|
27
|
+
z-index: 10;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 32px;
|
|
33
|
+
|
|
34
|
+
background: linear-gradient(to bottom, transparent, ${token.colorBgLayout});
|
|
35
|
+
`,
|
|
36
|
+
}));
|