@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 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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#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>
@@ -0,0 +1,6 @@
1
+ {
2
+ "topic": {
3
+ "desc": "Click the button on the left to save the current conversation as a historical topic and start a new conversation",
4
+ "title": "Topic List"
5
+ }
6
+ }
@@ -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",
@@ -0,0 +1,6 @@
1
+ {
2
+ "topic": {
3
+ "desc": "点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话",
4
+ "title": "话题列表"
5
+ }
6
+ }
@@ -61,7 +61,10 @@
61
61
  "title": "是否开启历史消息长度压缩阈值"
62
62
  },
63
63
  "enableHistoryCount": {
64
- "title": "是否开启携带的历史消息数限制"
64
+ "alias": "不限制",
65
+ "limited": "只包含 {{number}} 条会话消息",
66
+ "title": "限制历史消息数",
67
+ "unlimited": "不限历史消息数"
65
68
  },
66
69
  "historyCount": {
67
70
  "desc": "每次请求携带的历史消息数",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
5
5
  "keywords": [
6
6
  "chatbot",
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
+ }));
@@ -0,0 +1,6 @@
1
+ export default {
2
+ topic: {
3
+ desc: '点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话',
4
+ title: '话题列表',
5
+ },
6
+ };
@@ -1,3 +1,15 @@
1
- const resources = {} as const;
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 }) => (