@lobehub/chat 0.36.1 → 0.38.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/locales/en_US/empty.json +6 -0
- package/locales/en_US/setting.json +4 -1
- package/locales/zh_CN/empty.json +6 -0
- package/locales/zh_CN/setting.json +4 -1
- package/package.json +1 -1
- package/public/images/chatmode_chat_dark.webp +0 -0
- package/public/images/chatmode_chat_light.webp +0 -0
- package/public/images/chatmode_doc_dark.webp +0 -0
- package/public/images/chatmode_doc_light.webp +0 -0
- package/public/images/empty_topic_dark.webp +0 -0
- package/public/images/empty_topic_light.webp +0 -0
- package/public/images/theme_dark.webp +0 -0
- package/public/images/theme_light.webp +0 -0
- package/src/components/Empty/index.tsx +34 -0
- package/src/components/Empty/style.ts +28 -0
- package/src/const/settings.ts +0 -6
- package/src/locales/default/empty.ts +6 -0
- package/src/locales/resources/en_US.ts +13 -1
- package/src/locales/resources/zh_CN.ts +2 -0
- package/src/pages/chat/SessionList/List/SessionItem.tsx +1 -1
- package/src/pages/chat/[id]/Sidebar/Topic/index.tsx +13 -0
- package/src/store/session/slices/session/action.ts +4 -2
- package/src/types/settings.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.38.0](https://github.com/lobehub/lobe-chat/compare/v0.37.0...v0.38.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-08-04**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Add topic empty.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Add topic empty ([b9f267c](https://github.com/lobehub/lobe-chat/commit/b9f267c))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 0.37.0](https://github.com/lobehub/lobe-chat/compare/v0.36.1...v0.37.0)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-08-03**</sup>
|
|
33
|
+
|
|
34
|
+
#### ✨ Features
|
|
35
|
+
|
|
36
|
+
- **misc**: 支持使用全局助手的设置作为默认助手的创建角色.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's improved
|
|
44
|
+
|
|
45
|
+
- **misc**: 支持使用全局助手的设置作为默认助手的创建角色, closes [#44](https://github.com/lobehub/lobe-chat/issues/44) ([f91857d](https://github.com/lobehub/lobe-chat/commit/f91857d))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.36.1](https://github.com/lobehub/lobe-chat/compare/v0.36.0...v0.36.1)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-08-03**</sup>
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
"title": "Enable History Message Length Compression Threshold"
|
|
62
62
|
},
|
|
63
63
|
"enableHistoryCount": {
|
|
64
|
-
"title": "Enable History Message Count Limit"
|
|
64
|
+
"title": "Enable History Message Count Limit",
|
|
65
|
+
"alias": "Unlimited",
|
|
66
|
+
"limited": "Only include {{number}} chat messages",
|
|
67
|
+
"unlimited": "Unlimited chat history"
|
|
65
68
|
},
|
|
66
69
|
"historyCount": {
|
|
67
70
|
"desc": "Number of history messages carried in each request",
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ActionIcon } from '@lobehub/ui';
|
|
2
|
+
import { X } from 'lucide-react';
|
|
3
|
+
import { memo, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useStyles } from './style';
|
|
6
|
+
|
|
7
|
+
interface EmptyProps {
|
|
8
|
+
cover: string;
|
|
9
|
+
desc: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Empty = memo<EmptyProps>(({ cover, title, desc }) => {
|
|
14
|
+
const [visiable, setVisiable] = useState(true);
|
|
15
|
+
const { styles } = useStyles();
|
|
16
|
+
if (!visiable) return null;
|
|
17
|
+
return (
|
|
18
|
+
<div className={styles.container}>
|
|
19
|
+
<ActionIcon
|
|
20
|
+
className={styles.close}
|
|
21
|
+
icon={X}
|
|
22
|
+
onClick={() => setVisiable(false)}
|
|
23
|
+
size={{ blockSize: 24, fontSize: 16 }}
|
|
24
|
+
/>
|
|
25
|
+
{cover && <img alt="empty" src={cover} width="100%" />}
|
|
26
|
+
<div className={styles.content}>
|
|
27
|
+
{title && <h3>{title}</h3>}
|
|
28
|
+
{desc && <p className={styles.desc}>{desc}</p>}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default Empty;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createStyles } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
4
|
+
close: css`
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 8px;
|
|
7
|
+
right: 8px;
|
|
8
|
+
`,
|
|
9
|
+
container: css`
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
background: linear-gradient(
|
|
15
|
+
to bottom,
|
|
16
|
+
${isDarkMode ? token.colorBgElevated : token.colorBgLayout},
|
|
17
|
+
${token.colorBgContainer}
|
|
18
|
+
);
|
|
19
|
+
border: 1px solid ${token.colorBorderSecondary};
|
|
20
|
+
border-radius: ${token.borderRadius}px;
|
|
21
|
+
`,
|
|
22
|
+
content: css`
|
|
23
|
+
padding: 0 16px 16px;
|
|
24
|
+
`,
|
|
25
|
+
desc: css`
|
|
26
|
+
color: ${token.colorTextDescription};
|
|
27
|
+
`,
|
|
28
|
+
}));
|
package/src/const/settings.ts
CHANGED
|
@@ -12,18 +12,12 @@ export const DEFAULT_BASE_SETTINGS: GlobalBaseSettings = {
|
|
|
12
12
|
enableMaxTokens: true,
|
|
13
13
|
endpoint: '',
|
|
14
14
|
fontSize: 14,
|
|
15
|
-
frequencyPenalty: 0,
|
|
16
15
|
historyCount: 24,
|
|
17
16
|
language: 'zh-CN',
|
|
18
|
-
maxTokens: 2000,
|
|
19
|
-
model: LanguageModel.GPT3_5,
|
|
20
17
|
neutralColor: '',
|
|
21
18
|
password: '',
|
|
22
|
-
presencePenalty: 0,
|
|
23
19
|
primaryColor: '',
|
|
24
|
-
temperature: 0.5,
|
|
25
20
|
themeMode: 'auto',
|
|
26
|
-
topP: 1,
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
export const DEFAULT_AGENT_CONFIG: LobeAgentConfig = {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import common from '../../../locales/en_US/common.json';
|
|
2
|
+
import empty from '../../../locales/en_US/empty.json';
|
|
3
|
+
import error from '../../../locales/en_US/error.json';
|
|
4
|
+
import plugin from '../../../locales/en_US/plugin.json';
|
|
5
|
+
import setting from '../../../locales/en_US/setting.json';
|
|
6
|
+
|
|
7
|
+
const resources = {
|
|
8
|
+
common,
|
|
9
|
+
empty,
|
|
10
|
+
error,
|
|
11
|
+
plugin,
|
|
12
|
+
setting,
|
|
13
|
+
} as const;
|
|
2
14
|
|
|
3
15
|
export default resources;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import common from '../default/common';
|
|
2
|
+
import empty from '../default/empty';
|
|
2
3
|
import error from '../default/error';
|
|
3
4
|
import plugin from '../default/plugin';
|
|
4
5
|
import setting from '../default/setting';
|
|
5
6
|
|
|
6
7
|
const resources = {
|
|
7
8
|
common,
|
|
9
|
+
empty,
|
|
8
10
|
error,
|
|
9
11
|
plugin,
|
|
10
12
|
setting,
|
|
@@ -29,7 +29,7 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading })
|
|
|
29
29
|
const { t } = useTranslation('common');
|
|
30
30
|
|
|
31
31
|
const { styles, theme } = useStyles();
|
|
32
|
-
const [defaultModel] = useSettings((s) => [s.settings.model], shallow);
|
|
32
|
+
const [defaultModel] = useSettings((s) => [s.settings.defaultAgent.config?.model], shallow);
|
|
33
33
|
|
|
34
34
|
const [
|
|
35
35
|
pin,
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
import { useThemeMode } from 'antd-style';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
1
3
|
import { Flexbox } from 'react-layout-kit';
|
|
2
4
|
import { shallow } from 'zustand/shallow';
|
|
3
5
|
|
|
6
|
+
import Empty from '@/components/Empty';
|
|
4
7
|
import { topicSelectors, useSessionStore } from '@/store/session';
|
|
5
8
|
|
|
6
9
|
import TopicItem from './TopicItem';
|
|
7
10
|
|
|
8
11
|
export const Topic = () => {
|
|
9
12
|
const topics = useSessionStore(topicSelectors.currentTopics);
|
|
13
|
+
const { isDarkMode } = useThemeMode();
|
|
10
14
|
const [activeTopicId] = useSessionStore((s) => [s.activeTopicId], shallow);
|
|
15
|
+
const { t } = useTranslation('empty');
|
|
11
16
|
return (
|
|
12
17
|
<Flexbox gap={8}>
|
|
18
|
+
{topics?.length === 0 && (
|
|
19
|
+
<Empty
|
|
20
|
+
cover={`/images/empty_topic_${isDarkMode ? 'dark' : 'light'}.webp`}
|
|
21
|
+
desc={t('topic.desc')}
|
|
22
|
+
title={t('topic.title')}
|
|
23
|
+
/>
|
|
24
|
+
)}
|
|
25
|
+
|
|
13
26
|
<TopicItem active={!activeTopicId} fav={false} title={'默认话题'} />
|
|
14
27
|
|
|
15
28
|
{topics.map(({ id, favorite, title }) => (
|
|
@@ -4,6 +4,7 @@ import Router from 'next/router';
|
|
|
4
4
|
import { StateCreator } from 'zustand/vanilla';
|
|
5
5
|
|
|
6
6
|
import { SessionStore, initLobeSession } from '@/store/session';
|
|
7
|
+
import { useSettings } from '@/store/settings';
|
|
7
8
|
import { LobeAgentSession, LobeSessions } from '@/types/session';
|
|
8
9
|
import { setNamespace } from '@/utils/storeDebug';
|
|
9
10
|
import { uuid } from '@/utils/uuid';
|
|
@@ -77,8 +78,9 @@ export const createSessionSlice: StateCreator<
|
|
|
77
78
|
|
|
78
79
|
const timestamp = Date.now();
|
|
79
80
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
81
|
+
// 合并 settings 里的 defaultAgent
|
|
82
|
+
const globalDefaultAgent = useSettings.getState().settings.defaultAgent;
|
|
83
|
+
const newSession: LobeAgentSession = merge({}, initLobeSession, globalDefaultAgent, {
|
|
82
84
|
createAt: timestamp,
|
|
83
85
|
id: uuid(),
|
|
84
86
|
updateAt: timestamp,
|
package/src/types/settings.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { NeutralColors, PrimaryColors } from '@lobehub/ui';
|
|
|
2
2
|
import type { ThemeMode } from 'antd-style';
|
|
3
3
|
|
|
4
4
|
import type { Locales } from '@/locales/resources';
|
|
5
|
-
import type { LanguageModel } from '@/types/llm';
|
|
6
5
|
import type { LobeAgentSession } from '@/types/session';
|
|
7
6
|
|
|
8
7
|
export interface GlobalBaseSettings {
|
|
@@ -14,18 +13,12 @@ export interface GlobalBaseSettings {
|
|
|
14
13
|
enableMaxTokens: boolean;
|
|
15
14
|
endpoint: string;
|
|
16
15
|
fontSize: number;
|
|
17
|
-
frequencyPenalty: number;
|
|
18
16
|
historyCount: number;
|
|
19
17
|
language: Locales;
|
|
20
|
-
maxTokens: number;
|
|
21
|
-
model: LanguageModel;
|
|
22
18
|
neutralColor: NeutralColors | '';
|
|
23
19
|
password: string;
|
|
24
|
-
presencePenalty: number;
|
|
25
20
|
primaryColor: PrimaryColors | '';
|
|
26
|
-
temperature: number;
|
|
27
21
|
themeMode: ThemeMode;
|
|
28
|
-
topP: number;
|
|
29
22
|
}
|
|
30
23
|
|
|
31
24
|
export type GlobalDefaultAgent = Partial<LobeAgentSession>;
|