@lobehub/chat 0.1.6 → 0.3.0
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 +50 -0
- package/package.json +1 -1
- package/src/const/layoutTokens.ts +3 -0
- package/src/features/AvatarWithUpload/index.tsx +22 -2
- package/src/features/FolderPanel/index.tsx +3 -1
- package/src/features/HeaderSpacing/index.tsx +7 -0
- package/src/pages/chat/[id]/Config/index.tsx +13 -9
- package/src/pages/chat/[id]/Conversation/Input.tsx +5 -2
- package/src/pages/chat/[id]/Conversation/index.tsx +3 -15
- package/src/pages/chat/[id]/edit/index.page.tsx +3 -0
- package/src/pages/chat/[id]/index.page.tsx +3 -9
- package/src/pages/chat/layout.tsx +1 -1
- package/src/pages/setting/SettingForm.tsx +1 -1
- package/src/pages/setting/index.page.tsx +2 -0
- /package/src/{pages/setting → features}/SliderWithInput/index.tsx +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.3.0](https://github.com/lobehub/lobe-chat/compare/v0.2.0...v0.3.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-07-18**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Add new files, modify components, and adjust layout and styling.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Add new files, modify components, and adjust layout and styling ([b8c3b38](https://github.com/lobehub/lobe-chat/commit/b8c3b38))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 0.2.0](https://github.com/lobehub/lobe-chat/compare/v0.1.6...v0.2.0)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-07-18**</sup>
|
|
33
|
+
|
|
34
|
+
#### ✨ Features
|
|
35
|
+
|
|
36
|
+
- **misc**: Add import statement and define CSS styles for Avatar component.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's improved
|
|
44
|
+
|
|
45
|
+
- **misc**: Add import statement and define CSS styles for Avatar component ([8c23a8d](https://github.com/lobehub/lobe-chat/commit/8c23a8d))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.1.6](https://github.com/lobehub/lobe-chat/compare/v0.1.5...v0.1.6)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-07-18**</sup>
|
package/package.json
CHANGED
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
import { Avatar, Logo } from '@lobehub/ui';
|
|
2
2
|
import { Upload } from 'antd';
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
3
4
|
import { memo } from 'react';
|
|
4
5
|
import { shallow } from 'zustand/shallow';
|
|
5
6
|
|
|
6
7
|
import { useSettings } from '@/store/settings';
|
|
7
8
|
import { createUploadImageHandler } from '@/utils/uploadFIle';
|
|
8
9
|
|
|
10
|
+
const useStyle = createStyles(
|
|
11
|
+
({ css, token }) => css`
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
transition: scale 400ms ${token.motionEaseOut}, box-shadow 100ms ${token.motionEaseOut};
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
box-shadow: 0 0 0 3px ${token.colorText};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:active {
|
|
21
|
+
scale: 0.8;
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
);
|
|
25
|
+
|
|
9
26
|
interface AvatarWithUploadProps {
|
|
10
27
|
size?: number;
|
|
11
28
|
}
|
|
12
29
|
|
|
13
|
-
|
|
30
|
+
const AvatarWithUpload = memo<AvatarWithUploadProps>(({ size = 40 }) => {
|
|
14
31
|
const [avatar, setSettings] = useSettings((st) => [st.settings.avatar, st.setSettings], shallow);
|
|
32
|
+
const { styles } = useStyle();
|
|
15
33
|
|
|
16
34
|
const handleUploadAvatar = createUploadImageHandler((avatar) => {
|
|
17
35
|
setSettings({ avatar });
|
|
18
36
|
});
|
|
19
37
|
|
|
20
38
|
return (
|
|
21
|
-
<div style={{ maxHeight: size, maxWidth: size }}>
|
|
39
|
+
<div className={styles} style={{ maxHeight: size, maxWidth: size }}>
|
|
22
40
|
<Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>
|
|
23
41
|
{avatar ? <Avatar avatar={avatar} size={size} /> : <Logo size={size} />}
|
|
24
42
|
</Upload>
|
|
25
43
|
</div>
|
|
26
44
|
);
|
|
27
45
|
});
|
|
46
|
+
|
|
47
|
+
export default AvatarWithUpload;
|
|
@@ -14,7 +14,7 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
14
14
|
`,
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const FolderPanel = memo<PropsWithChildren>(({ children }) => {
|
|
18
18
|
const { styles } = useStyles();
|
|
19
19
|
const [sessionsWidth, sessionExpandable] = useSettings(
|
|
20
20
|
(s) => [s.sessionsWidth, s.sessionExpandable],
|
|
@@ -53,3 +53,5 @@ export default memo<PropsWithChildren>(({ children }) => {
|
|
|
53
53
|
</DraggablePanel>
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
|
+
|
|
57
|
+
export default FolderPanel;
|
|
@@ -2,20 +2,23 @@ import { ActionIcon, DraggablePanel, DraggablePanelContainer } from '@lobehub/ui
|
|
|
2
2
|
import { createStyles } from 'antd-style';
|
|
3
3
|
import { LucideEdit, LucideX } from 'lucide-react';
|
|
4
4
|
import Router from 'next/router';
|
|
5
|
+
import { rgba } from 'polished';
|
|
5
6
|
import { useTranslation } from 'react-i18next';
|
|
6
7
|
import { Flexbox } from 'react-layout-kit';
|
|
7
8
|
import { shallow } from 'zustand/shallow';
|
|
8
9
|
|
|
10
|
+
import { CHAT_SIDEBAR_WIDTH, HEADER_HEIGHT } from '@/const/layoutTokens';
|
|
9
11
|
import { useSessionStore } from '@/store/session';
|
|
10
12
|
|
|
11
13
|
import ReadMode from './ReadMode';
|
|
12
14
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const useStyles = createStyles(({ cx, css, token, stylish }) => ({
|
|
16
|
+
drawer: cx(
|
|
17
|
+
stylish.blurStrong,
|
|
18
|
+
css`
|
|
19
|
+
background: ${rgba(token.colorBgLayout, 0.4)};
|
|
20
|
+
`,
|
|
21
|
+
),
|
|
19
22
|
header: css`
|
|
20
23
|
border-bottom: 1px solid ${token.colorBorder};
|
|
21
24
|
`,
|
|
@@ -34,14 +37,15 @@ const Config = () => {
|
|
|
34
37
|
className={styles.drawer}
|
|
35
38
|
expand={showAgentSettings}
|
|
36
39
|
expandable={false}
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
headerHeight={HEADER_HEIGHT}
|
|
41
|
+
maxWidth={CHAT_SIDEBAR_WIDTH}
|
|
42
|
+
minWidth={CHAT_SIDEBAR_WIDTH}
|
|
39
43
|
mode={'float'}
|
|
40
44
|
pin
|
|
41
45
|
placement={'right'}
|
|
42
46
|
resize={{ left: false }}
|
|
43
47
|
>
|
|
44
|
-
<DraggablePanelContainer style={{ flex: 'none', minWidth:
|
|
48
|
+
<DraggablePanelContainer style={{ flex: 'none', minWidth: CHAT_SIDEBAR_WIDTH }}>
|
|
45
49
|
<Flexbox
|
|
46
50
|
align={'center'}
|
|
47
51
|
className={styles.header}
|
|
@@ -5,6 +5,7 @@ import { Archive, Eraser, Languages } from 'lucide-react';
|
|
|
5
5
|
import { memo, useMemo, useState } from 'react';
|
|
6
6
|
import { shallow } from 'zustand/shallow';
|
|
7
7
|
|
|
8
|
+
import { CHAT_TEXTAREA_HEIGHT, HEADER_HEIGHT } from '@/const/layoutTokens';
|
|
8
9
|
import { ModelTokens } from '@/const/modelTokens';
|
|
9
10
|
import { agentSelectors, chatSelectors, useSessionStore } from '@/store/session';
|
|
10
11
|
import { useSettings } from '@/store/settings';
|
|
@@ -29,7 +30,8 @@ const ChatInput = () => {
|
|
|
29
30
|
<DraggablePanel
|
|
30
31
|
expandable={false}
|
|
31
32
|
fullscreen={expand}
|
|
32
|
-
|
|
33
|
+
headerHeight={HEADER_HEIGHT}
|
|
34
|
+
minHeight={CHAT_TEXTAREA_HEIGHT}
|
|
33
35
|
onSizeChange={(_, size) => {
|
|
34
36
|
if (!size) return;
|
|
35
37
|
useSettings.setState({
|
|
@@ -38,6 +40,7 @@ const ChatInput = () => {
|
|
|
38
40
|
}}
|
|
39
41
|
placement="bottom"
|
|
40
42
|
size={{ height: inputHeight, width: '100%' }}
|
|
43
|
+
style={{ zIndex: 10 }}
|
|
41
44
|
>
|
|
42
45
|
<ChatInputArea
|
|
43
46
|
actions={
|
|
@@ -49,7 +52,7 @@ const ChatInput = () => {
|
|
|
49
52
|
}
|
|
50
53
|
expand={expand}
|
|
51
54
|
footer={<Button icon={<Icon icon={Archive} />} />}
|
|
52
|
-
minHeight={
|
|
55
|
+
minHeight={CHAT_TEXTAREA_HEIGHT}
|
|
53
56
|
onExpandChange={setExpand}
|
|
54
57
|
onInputChange={setText}
|
|
55
58
|
onSend={sendMessage}
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import { createStyles } from 'antd-style';
|
|
2
1
|
import { memo } from 'react';
|
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
|
4
2
|
|
|
3
|
+
import HeaderSpacing from '@/features/HeaderSpacing';
|
|
5
4
|
import ChatInput from '@/pages/chat/[id]/Conversation/Input';
|
|
6
5
|
|
|
7
6
|
import ChatList from './ChatList';
|
|
8
7
|
|
|
9
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
10
|
-
input: css`
|
|
11
|
-
position: sticky;
|
|
12
|
-
z-index: 10;
|
|
13
|
-
bottom: 0;
|
|
14
|
-
background: ${token.colorBgLayout};
|
|
15
|
-
`,
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
8
|
const Conversation = () => {
|
|
19
|
-
const { styles } = useStyles();
|
|
20
9
|
return (
|
|
21
10
|
<>
|
|
22
11
|
<div style={{ flex: 1, overflowY: 'scroll' }}>
|
|
12
|
+
<HeaderSpacing />
|
|
23
13
|
<ChatList />
|
|
24
14
|
</div>
|
|
25
|
-
<
|
|
26
|
-
<ChatInput />
|
|
27
|
-
</Flexbox>
|
|
15
|
+
<ChatInput />
|
|
28
16
|
</>
|
|
29
17
|
);
|
|
30
18
|
};
|
|
@@ -6,6 +6,8 @@ import { memo } from 'react';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
|
8
8
|
|
|
9
|
+
import HeaderSpacing from '@/features/HeaderSpacing';
|
|
10
|
+
|
|
9
11
|
import ChatLayout from '../../layout';
|
|
10
12
|
import AgentConfig from './AgentConfig';
|
|
11
13
|
import AgentMeta from './AgentMeta';
|
|
@@ -51,6 +53,7 @@ const EditPage = memo(() => {
|
|
|
51
53
|
/>
|
|
52
54
|
{/*form*/}
|
|
53
55
|
<Flexbox className={styles.form} flex={1} gap={10} padding={24}>
|
|
56
|
+
<HeaderSpacing />
|
|
54
57
|
<AgentMeta />
|
|
55
58
|
<AgentConfig />
|
|
56
59
|
</Flexbox>
|
|
@@ -23,16 +23,10 @@ const Chat = memo(() => {
|
|
|
23
23
|
<Head>
|
|
24
24
|
<title>{pageTitle}</title>
|
|
25
25
|
</Head>
|
|
26
|
-
|
|
27
|
-
<Flexbox flex={1}>
|
|
26
|
+
<Flexbox id={'lobe-conversion-container'} style={{ height: '100vh', position: 'relative' }}>
|
|
28
27
|
<Header />
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
style={{ height: 'calc(100vh - 64px)', position: 'relative' }}
|
|
32
|
-
>
|
|
33
|
-
<Conversation />
|
|
34
|
-
<Config />
|
|
35
|
-
</Flexbox>
|
|
28
|
+
<Conversation />
|
|
29
|
+
<Config />
|
|
36
30
|
</Flexbox>
|
|
37
31
|
</Layout>
|
|
38
32
|
);
|
|
@@ -8,8 +8,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
8
8
|
import { shallow } from 'zustand/shallow';
|
|
9
9
|
|
|
10
10
|
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
11
|
+
import SliderWithInput from '@/features/SliderWithInput';
|
|
11
12
|
import { options } from '@/locales/options';
|
|
12
|
-
import SliderWithInput from '@/pages/setting/SliderWithInput';
|
|
13
13
|
import { settingsSelectors, useSettings } from '@/store/settings';
|
|
14
14
|
import { DEFAULT_SETTINGS } from '@/store/settings/initialState';
|
|
15
15
|
import { ConfigKeys } from '@/types/exportConfig';
|
|
@@ -3,6 +3,7 @@ import { memo, useEffect } from 'react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
|
+
import HeaderSpacing from '@/features/HeaderSpacing';
|
|
6
7
|
import SideBar from '@/features/SideBar';
|
|
7
8
|
import { createI18nNext } from '@/locales/create';
|
|
8
9
|
import { Sessions } from '@/pages/chat/SessionList';
|
|
@@ -30,6 +31,7 @@ const SettingLayout = memo(() => {
|
|
|
30
31
|
<Flexbox flex={1}>
|
|
31
32
|
<Header />
|
|
32
33
|
<Flexbox align={'center'} flex={1} padding={24} style={{ overflow: 'auto' }}>
|
|
34
|
+
<HeaderSpacing />
|
|
33
35
|
<SettingForm />
|
|
34
36
|
</Flexbox>
|
|
35
37
|
</Flexbox>
|
|
File without changes
|