@lobehub/chat 0.37.0 → 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 +25 -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/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/[id]/Sidebar/Topic/index.tsx +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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
|
+
|
|
5
30
|
## [Version 0.37.0](https://github.com/lobehub/lobe-chat/compare/v0.36.1...v0.37.0)
|
|
6
31
|
|
|
7
32
|
<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
|
+
}));
|
|
@@ -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,
|
|
@@ -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 }) => (
|