diff --git a/locales/en_US/empty.json b/locales/en_US/empty.json new file mode 100644 index 0000000000..318e0910a9 --- /dev/null +++ b/locales/en_US/empty.json @@ -0,0 +1,6 @@ +{ + "topic": { + "desc": "Click the button on the left to save the current conversation as a historical topic and start a new conversation", + "title": "Topic List" + } +} diff --git a/locales/en_US/setting.json b/locales/en_US/setting.json index 662f63df43..941880d75c 100644 --- a/locales/en_US/setting.json +++ b/locales/en_US/setting.json @@ -61,7 +61,10 @@ "title": "Enable History Message Length Compression Threshold" }, "enableHistoryCount": { - "title": "Enable History Message Count Limit" + "title": "Enable History Message Count Limit", + "alias": "Unlimited", + "limited": "Only include {{number}} chat messages", + "unlimited": "Unlimited chat history" }, "historyCount": { "desc": "Number of history messages carried in each request", diff --git a/locales/zh_CN/empty.json b/locales/zh_CN/empty.json new file mode 100644 index 0000000000..2ef04cf085 --- /dev/null +++ b/locales/zh_CN/empty.json @@ -0,0 +1,6 @@ +{ + "topic": { + "desc": "点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话", + "title": "话题列表" + } +} diff --git a/locales/zh_CN/setting.json b/locales/zh_CN/setting.json index c4e190ef84..a137b011a6 100644 --- a/locales/zh_CN/setting.json +++ b/locales/zh_CN/setting.json @@ -61,7 +61,10 @@ "title": "是否开启历史消息长度压缩阈值" }, "enableHistoryCount": { - "title": "是否开启携带的历史消息数限制" + "alias": "不限制", + "limited": "只包含 {{number}} 条会话消息", + "title": "限制历史消息数", + "unlimited": "不限历史消息数" }, "historyCount": { "desc": "每次请求携带的历史消息数", diff --git a/public/images/chatmode_chat_dark.webp b/public/images/chatmode_chat_dark.webp new file mode 100644 index 0000000000..394f095ab8 Binary files /dev/null and b/public/images/chatmode_chat_dark.webp differ diff --git a/public/images/chatmode_chat_light.webp b/public/images/chatmode_chat_light.webp new file mode 100644 index 0000000000..3e4726edbb Binary files /dev/null and b/public/images/chatmode_chat_light.webp differ diff --git a/public/images/chatmode_doc_dark.webp b/public/images/chatmode_doc_dark.webp new file mode 100644 index 0000000000..301f97db47 Binary files /dev/null and b/public/images/chatmode_doc_dark.webp differ diff --git a/public/images/chatmode_doc_light.webp b/public/images/chatmode_doc_light.webp new file mode 100644 index 0000000000..be67b3e606 Binary files /dev/null and b/public/images/chatmode_doc_light.webp differ diff --git a/public/images/empty_topic_dark.webp b/public/images/empty_topic_dark.webp new file mode 100644 index 0000000000..064fa13045 Binary files /dev/null and b/public/images/empty_topic_dark.webp differ diff --git a/public/images/empty_topic_light.webp b/public/images/empty_topic_light.webp new file mode 100644 index 0000000000..846c64dfd0 Binary files /dev/null and b/public/images/empty_topic_light.webp differ diff --git a/public/images/theme_dark.webp b/public/images/theme_dark.webp new file mode 100644 index 0000000000..c02dd0b562 Binary files /dev/null and b/public/images/theme_dark.webp differ diff --git a/public/images/theme_light.webp b/public/images/theme_light.webp new file mode 100644 index 0000000000..054518566f Binary files /dev/null and b/public/images/theme_light.webp differ diff --git a/src/components/Empty/index.tsx b/src/components/Empty/index.tsx new file mode 100644 index 0000000000..32ad1207ef --- /dev/null +++ b/src/components/Empty/index.tsx @@ -0,0 +1,34 @@ +import { ActionIcon } from '@lobehub/ui'; +import { X } from 'lucide-react'; +import { memo, useState } from 'react'; + +import { useStyles } from './style'; + +interface EmptyProps { + cover: string; + desc: string; + title: string; +} + +const Empty = memo(({ cover, title, desc }) => { + const [visiable, setVisiable] = useState(true); + const { styles } = useStyles(); + if (!visiable) return null; + return ( +
+ setVisiable(false)} + size={{ blockSize: 24, fontSize: 16 }} + /> + {cover && empty} +
+ {title &&

{title}

} + {desc &&

{desc}

} +
+
+ ); +}); + +export default Empty; diff --git a/src/components/Empty/style.ts b/src/components/Empty/style.ts new file mode 100644 index 0000000000..c84e49fd74 --- /dev/null +++ b/src/components/Empty/style.ts @@ -0,0 +1,28 @@ +import { createStyles } from 'antd-style'; + +export const useStyles = createStyles(({ css, token, isDarkMode }) => ({ + close: css` + position: absolute; + top: 8px; + right: 8px; + `, + container: css` + position: relative; + + overflow: hidden; + + background: linear-gradient( + to bottom, + ${isDarkMode ? token.colorBgElevated : token.colorBgLayout}, + ${token.colorBgContainer} + ); + border: 1px solid ${token.colorBorderSecondary}; + border-radius: ${token.borderRadius}px; + `, + content: css` + padding: 0 16px 16px; + `, + desc: css` + color: ${token.colorTextDescription}; + `, +})); diff --git a/src/locales/default/empty.ts b/src/locales/default/empty.ts new file mode 100644 index 0000000000..61bfa508e4 --- /dev/null +++ b/src/locales/default/empty.ts @@ -0,0 +1,6 @@ +export default { + topic: { + desc: '点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话', + title: '话题列表', + }, +}; diff --git a/src/locales/resources/en_US.ts b/src/locales/resources/en_US.ts index 90fba18ef8..9b371de4be 100644 --- a/src/locales/resources/en_US.ts +++ b/src/locales/resources/en_US.ts @@ -1,3 +1,15 @@ -const resources = {} as const; +import common from '../../../locales/en_US/common.json'; +import empty from '../../../locales/en_US/empty.json'; +import error from '../../../locales/en_US/error.json'; +import plugin from '../../../locales/en_US/plugin.json'; +import setting from '../../../locales/en_US/setting.json'; + +const resources = { + common, + empty, + error, + plugin, + setting, +} as const; export default resources; diff --git a/src/locales/resources/zh_CN.ts b/src/locales/resources/zh_CN.ts index 7600ad697b..9e76083c6c 100644 --- a/src/locales/resources/zh_CN.ts +++ b/src/locales/resources/zh_CN.ts @@ -1,10 +1,12 @@ import common from '../default/common'; +import empty from '../default/empty'; import error from '../default/error'; import plugin from '../default/plugin'; import setting from '../default/setting'; const resources = { common, + empty, error, plugin, setting, diff --git a/src/pages/chat/[id]/Sidebar/Topic/index.tsx b/src/pages/chat/[id]/Sidebar/Topic/index.tsx index 989ee05ecd..a688f9f212 100644 --- a/src/pages/chat/[id]/Sidebar/Topic/index.tsx +++ b/src/pages/chat/[id]/Sidebar/Topic/index.tsx @@ -1,15 +1,28 @@ +import { useThemeMode } from 'antd-style'; +import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; import { shallow } from 'zustand/shallow'; +import Empty from '@/components/Empty'; import { topicSelectors, useSessionStore } from '@/store/session'; import TopicItem from './TopicItem'; export const Topic = () => { const topics = useSessionStore(topicSelectors.currentTopics); + const { isDarkMode } = useThemeMode(); const [activeTopicId] = useSessionStore((s) => [s.activeTopicId], shallow); + const { t } = useTranslation('empty'); return ( + {topics?.length === 0 && ( + + )} + {topics.map(({ id, favorite, title }) => (