@lobehub/chat 0.95.0 → 0.96.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/README.md +6 -6
- package/README.zh-CN.md +12 -12
- package/docs/Lighthouse.md +8 -8
- package/docs/Lighthouse.zh-CN.md +8 -8
- package/package.json +1 -1
- package/src/app/chat/(desktop)/features/SessionList.tsx +12 -2
- package/src/app/chat/features/Conversation/ChatList/Plugins/Inspector/index.tsx +24 -16
- package/src/app/chat/features/Conversation/ChatList/Plugins/Inspector/style.ts +1 -0
- package/src/app/chat/features/Conversation/ChatList/Plugins/Render/DefaultType/index.tsx +59 -10
- package/src/app/chat/features/SessionListContent/CollapseGroup/index.tsx +1 -1
- package/src/app/chat/features/SessionListContent/Inbox/index.tsx +1 -1
- package/src/app/chat/features/SessionListContent/List/Item/index.tsx +18 -15
- package/src/app/chat/features/SessionListContent/List/index.tsx +7 -6
- package/src/app/chat/features/SessionListContent/index.tsx +37 -13
- package/src/locales/default/chat.ts +3 -1
- package/src/locales/default/common.ts +1 -2
- package/src/locales/default/plugin.ts +3 -2
- package/src/store/global/initialState.ts +2 -0
- package/src/store/global/selectors/preference.ts +10 -0
- package/src/store/global/selectors.ts +1 -0
- package/src/store/plugin/selectors.ts +7 -0
- package/src/store/session/slices/session/selectors/index.ts +6 -0
- package/src/store/session/slices/session/selectors/list.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.96.0](https://github.com/lobehub/lobe-chat/compare/v0.95.1...v0.96.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-27**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Improve pin mode about session group.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Improve pin mode about session group, closes [#369](https://github.com/lobehub/lobe-chat/issues/369) ([75c5883](https://github.com/lobehub/lobe-chat/commit/75c5883))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.95.1](https://github.com/lobehub/lobe-chat/compare/v0.95.0...v0.95.1)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-10-25**</sup>
|
|
33
|
+
|
|
34
|
+
#### 💄 Styles
|
|
35
|
+
|
|
36
|
+
- **misc**: Improve plugin message ui.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### Styles
|
|
44
|
+
|
|
45
|
+
- **misc**: Improve plugin message ui ([6edd25b](https://github.com/lobehub/lobe-chat/commit/6edd25b))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 0.95.0](https://github.com/lobehub/lobe-chat/compare/v0.94.5...v0.95.0)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-10-24**</sup>
|
package/README.md
CHANGED
|
@@ -109,8 +109,8 @@ Please be aware that LobeChat is currently under active development, and feedbac
|
|
|
109
109
|

|
|
110
110
|
|
|
111
111
|
#### `1` Function Calling Plugin System
|
|
112
|
+
By establishing a versatile plugin system, ChatGPT becomes capable of delivering real-time news updates and enhancing your ability to interact with documents and e-commerce data more effectively. This extended functionality positions ChatGPT as a valuable resource across diverse domains. If you have an interest in creating plugins, we offer comprehensive component development documentation, software development kits (SDKs), and pre-made templates in the [🧩 Plugin System](#-Plugin-System) section below. Join us in our collective efforts to empower ChatGPT, making it both more potent and user-friendly.
|
|
112
113
|
|
|
113
|
-
By building a robust plugin ecosystem, ChatGPT cannot only provide real-time news updates but can also assist you in efficiently querying documents and accessing various e-commerce data. This allows ChatGPT to play a vital role in a wider range of fields. If you are interested in writing plugins, we provide detailed component development documentation, SDKs, and template files in the [🧩 Plugin System](#-Plugin-System) section below. Let's work together to make ChatGPT more powerful and easier to use.
|
|
114
114
|
|
|
115
115
|
<br/>
|
|
116
116
|
|
|
@@ -118,7 +118,7 @@ By building a robust plugin ecosystem, ChatGPT cannot only provide real-time new
|
|
|
118
118
|
|
|
119
119
|
#### `2` Prompt Agent Market
|
|
120
120
|
|
|
121
|
-
In our agent market
|
|
121
|
+
In our agent market. We have accumulated a large number of practical, prompt agents that have been used in daily work and study. You can also share your agents here and iterate and optimize your prompt agents with more people. You can submit your agents through [🤖/🏪 Submit Agents][submit-agents-link], and our automated i18n workflow will automatically translate your agents into multiple languages, allowing users worldwide to enjoy your wisdom.
|
|
122
122
|
|
|
123
123
|
<br/>
|
|
124
124
|
|
|
@@ -131,10 +131,10 @@ Utilize the Progressive Web Application ([PWA](https://support.google.com/chrome
|
|
|
131
131
|
> **Note**\
|
|
132
132
|
> If you are unfamiliar with the installation process of PWA, you can add LobeChat as your desktop application (also applicable to mobile devices) by following these steps:
|
|
133
133
|
>
|
|
134
|
-
> - Launch the Chrome or Edge browser on your computer
|
|
135
|
-
> - Visit the LobeChat webpage
|
|
136
|
-
> - In the upper right corner of the address bar, click on the <kbd>Install</kbd> icon
|
|
137
|
-
> - Follow the instructions on the screen to complete the PWA
|
|
134
|
+
> - Launch the Chrome or Edge browser on your computer.
|
|
135
|
+
> - Visit the LobeChat webpage.
|
|
136
|
+
> - In the upper right corner of the address bar, click on the <kbd>Install</kbd> icon.
|
|
137
|
+
> - Follow the instructions on the screen to complete the PWA Installation.
|
|
138
138
|
|
|
139
139
|
<br/>
|
|
140
140
|
|
package/README.zh-CN.md
CHANGED
|
@@ -86,14 +86,14 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
|
|
|
86
86
|
|
|
87
87
|
## ✨ 功能特性
|
|
88
88
|
|
|
89
|
-
- [x] 💨 **快速部署**:使用 Vercel 平台,只需点击一键部署按钮,即可在 1
|
|
90
|
-
- [x] 💎 **精致 UI 设计**:经过精心设计的界面,具有优雅的外观和流畅的交互效果,支持亮暗色主题,适配移动端。支持 PWA
|
|
91
|
-
- [x] 🗣️ **流畅的对话体验**:流式响应带来流畅的对话体验,并且支持完整的 Markdown 渲染,包括代码高亮、LaTex 公式、Mermaid
|
|
92
|
-
- [x] 🧩
|
|
93
|
-
- [x] 🔒
|
|
94
|
-
- [x] 🤖
|
|
95
|
-
- [x] 🌐
|
|
96
|
-
- [x] 🏬
|
|
89
|
+
- [x] 💨 **快速部署**:使用 Vercel 平台,只需点击一键部署按钮,即可在 1 分钟内完成部署,无需复杂的配置过程 .
|
|
90
|
+
- [x] 💎 **精致 UI 设计**:经过精心设计的界面,具有优雅的外观和流畅的交互效果,支持亮暗色主题,适配移动端。支持 PWA,提供更加接近原生应用的体验 .
|
|
91
|
+
- [x] 🗣️ **流畅的对话体验**:流式响应带来流畅的对话体验,并且支持完整的 Markdown 渲染,包括代码高亮、LaTex 公式、Mermaid 流程图等 .
|
|
92
|
+
- [x] 🧩 **支持插件与自定义插件开发**:会话支持插件扩展,用户可以安装和使用各种插件,例如搜索引擎、网页提取等,同时也支持自定义插件的开发,满足自定义需求 .
|
|
93
|
+
- [x] 🔒 **隐私安全**:所有数据保存在用户浏览器本地,保证用户的隐私安全 .
|
|
94
|
+
- [x] 🤖 **自定义助手角色**:用户可以根据自己的需求创建、分享和调试个性化的对话助手角色,提供更加灵活和个性化的对话功能 .
|
|
95
|
+
- [x] 🌐 **自定义域名**:如果用户拥有自己的域名,可以将其绑定到平台上,方便在任何地方快速访问对话助手 .
|
|
96
|
+
- [x] 🏬 **角色市场**:提供角色市场,用户可以在市场上选择自己喜欢的对话助手角色,丰富对话的内容和风格 .
|
|
97
97
|
|
|
98
98
|
> **Note**\
|
|
99
99
|
> 你可以在 Projects 中找到我们后续的 [Roadmap][github-project-link] 计划
|
|
@@ -131,10 +131,10 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
|
|
|
131
131
|
> **Note**\
|
|
132
132
|
> 若您未熟悉 PWA 的安装过程,您可以按照以下步骤将 LobeChat 添加为您的桌面应用(也适用于移动设备):
|
|
133
133
|
>
|
|
134
|
-
> - 在电脑上运行 Chrome 或 Edge 浏览器
|
|
135
|
-
> - 访问 LobeChat 网页
|
|
136
|
-
> - 在地址栏的右上角,单击 <kbd>安装</kbd> 图标
|
|
137
|
-
> - 根据屏幕上的指示完成 PWA 的安装
|
|
134
|
+
> - 在电脑上运行 Chrome 或 Edge 浏览器 .
|
|
135
|
+
> - 访问 LobeChat 网页 .
|
|
136
|
+
> - 在地址栏的右上角,单击 <kbd>安装</kbd> 图标 .
|
|
137
|
+
> - 根据屏幕上的指示完成 PWA 的安装 .
|
|
138
138
|
|
|
139
139
|
<br/>
|
|
140
140
|
|
package/docs/Lighthouse.md
CHANGED
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
| [⚡️ Lighthouse Report][settings-desktop-report] | [⚡️ Lighthouse Report][settings-mobile-report] |
|
|
49
49
|
|
|
50
50
|
[chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
|
|
51
|
-
[chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/
|
|
51
|
+
[chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preivew_lobehub_com_chat.html
|
|
52
52
|
[chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
|
|
53
|
-
[chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/
|
|
53
|
+
[chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preivew_lobehub_com_chat.html
|
|
54
54
|
[market-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/desktop/pagespeed.svg
|
|
55
|
-
[market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/
|
|
55
|
+
[market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/chat_preivew_lobehub_com_market.html
|
|
56
56
|
[market-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/mobile/pagespeed.svg
|
|
57
|
-
[market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/
|
|
57
|
+
[market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/chat_preivew_lobehub_com_market.html
|
|
58
58
|
[settings-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/desktop/pagespeed.svg
|
|
59
|
-
[settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/
|
|
59
|
+
[settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/chat_preivew_lobehub_com_settings.html
|
|
60
60
|
[settings-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/mobile/pagespeed.svg
|
|
61
|
-
[settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/
|
|
61
|
+
[settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/chat_preivew_lobehub_com_settings.html
|
|
62
62
|
[welcome-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/desktop/pagespeed.svg
|
|
63
|
-
[welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/
|
|
63
|
+
[welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/chat_preivew_lobehub_com_welcome.html
|
|
64
64
|
[welcome-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/mobile/pagespeed.svg
|
|
65
|
-
[welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/
|
|
65
|
+
[welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/chat_preivew_lobehub_com_welcome.html
|
package/docs/Lighthouse.zh-CN.md
CHANGED
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
| [⚡️ Lighthouse Report][settings-desktop-report] | [⚡️ Lighthouse Report][settings-mobile-report] |
|
|
49
49
|
|
|
50
50
|
[chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
|
|
51
|
-
[chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/
|
|
51
|
+
[chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
|
|
52
52
|
[chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
|
|
53
|
-
[chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/
|
|
53
|
+
[chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
|
|
54
54
|
[market-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/desktop/pagespeed.svg
|
|
55
|
-
[market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/
|
|
55
|
+
[market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/chat_preview_lobehub_com_market.html
|
|
56
56
|
[market-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/mobile/pagespeed.svg
|
|
57
|
-
[market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/
|
|
57
|
+
[market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/chat_preview_lobehub_com_market.html
|
|
58
58
|
[settings-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/desktop/pagespeed.svg
|
|
59
|
-
[settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/
|
|
59
|
+
[settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/chat_preview_lobehub_com_settings.html
|
|
60
60
|
[settings-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/mobile/pagespeed.svg
|
|
61
|
-
[settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/
|
|
61
|
+
[settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/chat_preview_lobehub_com_settings.html
|
|
62
62
|
[welcome-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/desktop/pagespeed.svg
|
|
63
|
-
[welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/
|
|
63
|
+
[welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/chat_preview_lobehub_com_welcome.html
|
|
64
64
|
[welcome-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/mobile/pagespeed.svg
|
|
65
|
-
[welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/
|
|
65
|
+
[welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/chat_preview_lobehub_com_welcome.html
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatbot",
|
|
@@ -7,7 +7,17 @@ import FolderPanel from '@/features/FolderPanel';
|
|
|
7
7
|
import SessionListContent from '../../features/SessionListContent';
|
|
8
8
|
import Header from './SessionHeader';
|
|
9
9
|
|
|
10
|
-
const useStyles = createStyles(({ stylish }) =>
|
|
10
|
+
const useStyles = createStyles(({ stylish, css, cx }) =>
|
|
11
|
+
cx(
|
|
12
|
+
stylish.noScrollbar,
|
|
13
|
+
css`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 2px;
|
|
17
|
+
padding: 0 6px;
|
|
18
|
+
`,
|
|
19
|
+
),
|
|
20
|
+
);
|
|
11
21
|
|
|
12
22
|
const Sessions = memo(() => {
|
|
13
23
|
const { styles } = useStyles();
|
|
@@ -15,7 +25,7 @@ const Sessions = memo(() => {
|
|
|
15
25
|
return (
|
|
16
26
|
<FolderPanel>
|
|
17
27
|
<Header />
|
|
18
|
-
<DraggablePanelBody className={styles}
|
|
28
|
+
<DraggablePanelBody className={styles}>
|
|
19
29
|
<SessionListContent />
|
|
20
30
|
</DraggablePanelBody>
|
|
21
31
|
</FolderPanel>
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Loading3QuartersOutlined } from '@ant-design/icons';
|
|
2
2
|
import { LobePluginType } from '@lobehub/chat-plugin-sdk';
|
|
3
3
|
import { ActionIcon, Avatar, Highlighter, Icon } from '@lobehub/ui';
|
|
4
4
|
import { Tabs } from 'antd';
|
|
5
|
-
import
|
|
5
|
+
import isEqual from 'fast-deep-equal';
|
|
6
|
+
import {
|
|
7
|
+
LucideBug,
|
|
8
|
+
LucideBugOff,
|
|
9
|
+
LucideChevronDown,
|
|
10
|
+
LucideChevronUp,
|
|
11
|
+
LucideToyBrick,
|
|
12
|
+
} from 'lucide-react';
|
|
6
13
|
import { memo, useState } from 'react';
|
|
7
14
|
import { useTranslation } from 'react-i18next';
|
|
8
15
|
import { Flexbox } from 'react-layout-kit';
|
|
@@ -33,14 +40,14 @@ const Inspector = memo<InspectorProps>(
|
|
|
33
40
|
setShow,
|
|
34
41
|
content,
|
|
35
42
|
id = 'unknown',
|
|
36
|
-
type,
|
|
43
|
+
// type,
|
|
37
44
|
}) => {
|
|
38
45
|
const { t } = useTranslation('plugin');
|
|
39
46
|
const { styles } = useStyles();
|
|
40
47
|
const [open, setOpen] = useState(false);
|
|
41
48
|
|
|
42
|
-
const item = usePluginStore(pluginSelectors.getPluginMetaById(id));
|
|
43
|
-
|
|
49
|
+
const item = usePluginStore(pluginSelectors.getPluginMetaById(id), isEqual);
|
|
50
|
+
const showRightAction = usePluginStore(pluginSelectors.hasPluginUI(id));
|
|
44
51
|
const pluginAvatar = pluginHelpers.getPluginAvatar(item?.meta);
|
|
45
52
|
const pluginTitle = pluginHelpers.getPluginTitle(item?.meta);
|
|
46
53
|
|
|
@@ -62,31 +69,32 @@ const Inspector = memo<InspectorProps>(
|
|
|
62
69
|
gap={8}
|
|
63
70
|
horizontal
|
|
64
71
|
onClick={() => {
|
|
65
|
-
|
|
72
|
+
setShow?.(!showRender);
|
|
66
73
|
}}
|
|
67
74
|
>
|
|
68
75
|
{loading ? (
|
|
69
76
|
<div>
|
|
70
|
-
<
|
|
77
|
+
<Loading3QuartersOutlined spin />
|
|
71
78
|
</div>
|
|
72
79
|
) : (
|
|
73
80
|
avatar
|
|
74
81
|
)}
|
|
75
82
|
{pluginTitle ?? t('plugins.unknown')}
|
|
76
|
-
<Icon icon={
|
|
83
|
+
{showRightAction && <Icon icon={showRender ? LucideChevronUp : LucideChevronDown} />}
|
|
77
84
|
</Flexbox>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{setShow && (
|
|
85
|
+
{
|
|
86
|
+
<Flexbox horizontal>
|
|
87
|
+
{/*{type === 'standalone' && <ActionIcon icon={LucideOrbit} />}*/}
|
|
82
88
|
<ActionIcon
|
|
83
|
-
icon={
|
|
89
|
+
icon={open ? LucideBugOff : LucideBug}
|
|
84
90
|
onClick={() => {
|
|
85
|
-
|
|
91
|
+
setOpen(!open);
|
|
86
92
|
}}
|
|
93
|
+
title={t(open ? 'debug.off' : 'debug.on')}
|
|
87
94
|
/>
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
<Settings id={id} />
|
|
96
|
+
</Flexbox>
|
|
97
|
+
}
|
|
90
98
|
</Flexbox>
|
|
91
99
|
{open && (
|
|
92
100
|
<Tabs
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Loading3QuartersOutlined } from '@ant-design/icons';
|
|
2
1
|
import { Skeleton } from 'antd';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
3
|
import dynamic from 'next/dynamic';
|
|
4
4
|
import { Suspense, memo, useMemo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -11,6 +11,60 @@ import IFrameRender from './IFrameRender';
|
|
|
11
11
|
|
|
12
12
|
const SystemJsRender = dynamic(() => import('./SystemJsRender'), { ssr: false });
|
|
13
13
|
|
|
14
|
+
const useStyles = createStyles(
|
|
15
|
+
({ css, token }) => css`
|
|
16
|
+
position: relative;
|
|
17
|
+
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: block;
|
|
20
|
+
|
|
21
|
+
width: 300px;
|
|
22
|
+
height: 12px;
|
|
23
|
+
|
|
24
|
+
border: 1px solid ${token.colorBorder};
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
|
|
27
|
+
&::after {
|
|
28
|
+
content: '';
|
|
29
|
+
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
width: 40%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
|
|
38
|
+
background: ${token.colorPrimary};
|
|
39
|
+
|
|
40
|
+
animation: animloader 2s linear infinite;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes animloader {
|
|
44
|
+
0% {
|
|
45
|
+
left: 0;
|
|
46
|
+
transform: translateX(-100%);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
100% {
|
|
50
|
+
left: 100%;
|
|
51
|
+
transform: translateX(0%);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
);
|
|
56
|
+
const Loading = () => {
|
|
57
|
+
const { t } = useTranslation('plugin');
|
|
58
|
+
const { styles } = useStyles();
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Flexbox align={'center'} gap={8} padding={16}>
|
|
62
|
+
<span className={styles} />
|
|
63
|
+
{t('loading.content')}
|
|
64
|
+
</Flexbox>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
14
68
|
export interface PluginDefaultTypeProps {
|
|
15
69
|
content: string;
|
|
16
70
|
loading?: boolean;
|
|
@@ -18,8 +72,6 @@ export interface PluginDefaultTypeProps {
|
|
|
18
72
|
}
|
|
19
73
|
|
|
20
74
|
const PluginDefaultType = memo<PluginDefaultTypeProps>(({ content, name }) => {
|
|
21
|
-
const { t } = useTranslation('plugin');
|
|
22
|
-
|
|
23
75
|
const manifest = usePluginStore((s) => s.pluginManifestMap[name || '']);
|
|
24
76
|
let isJSON = true;
|
|
25
77
|
try {
|
|
@@ -28,15 +80,12 @@ const PluginDefaultType = memo<PluginDefaultTypeProps>(({ content, name }) => {
|
|
|
28
80
|
isJSON = false;
|
|
29
81
|
}
|
|
30
82
|
|
|
31
|
-
const contentObj = useMemo(() => (isJSON ? JSON.parse(content) : content), [content]);
|
|
83
|
+
const contentObj = useMemo<object>(() => (isJSON ? JSON.parse(content) : content), [content]);
|
|
32
84
|
|
|
33
85
|
if (!isJSON) {
|
|
34
86
|
return (
|
|
35
|
-
<Flexbox gap={8}
|
|
36
|
-
<
|
|
37
|
-
<Loading3QuartersOutlined spin />
|
|
38
|
-
</div>
|
|
39
|
-
{t('loading.content')}
|
|
87
|
+
<Flexbox gap={8}>
|
|
88
|
+
<Loading />
|
|
40
89
|
</Flexbox>
|
|
41
90
|
);
|
|
42
91
|
}
|
|
@@ -49,7 +98,7 @@ const PluginDefaultType = memo<PluginDefaultTypeProps>(({ content, name }) => {
|
|
|
49
98
|
|
|
50
99
|
if (ui.mode === 'module')
|
|
51
100
|
return (
|
|
52
|
-
<Suspense fallback={<Skeleton active style={{ width:
|
|
101
|
+
<Suspense fallback={<Skeleton active style={{ width: 400 }} />}>
|
|
53
102
|
<SystemJsRender content={contentObj} name={name || 'unknown'} url={ui.url} />
|
|
54
103
|
</Suspense>
|
|
55
104
|
);
|
|
@@ -6,10 +6,10 @@ import { memo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
const useStyles = createStyles(({ css, prefixCls, token }) => ({
|
|
8
8
|
container: css`
|
|
9
|
-
border-radius: 0;
|
|
10
9
|
.${prefixCls}-collapse-header {
|
|
11
10
|
padding-inline: 16px !important;
|
|
12
11
|
color: ${token.colorTextDescription} !important;
|
|
12
|
+
border-radius: 8px !important;
|
|
13
13
|
|
|
14
14
|
&:hover {
|
|
15
15
|
color: ${token.colorText} !important;
|
|
@@ -18,6 +18,7 @@ const useStyles = createStyles(({ css }) => {
|
|
|
18
18
|
return {
|
|
19
19
|
container: css`
|
|
20
20
|
position: relative;
|
|
21
|
+
border-radius: 8px;
|
|
21
22
|
`,
|
|
22
23
|
|
|
23
24
|
modalRoot: css`
|
|
@@ -96,21 +97,23 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
|
|
|
96
97
|
);
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
<Flexbox paddingBlock={1}>
|
|
101
|
+
<Item
|
|
102
|
+
actions={actions}
|
|
103
|
+
// needn't active state in mobile
|
|
104
|
+
active={mobile ? false : active}
|
|
105
|
+
addon={addon}
|
|
106
|
+
avatar={avatarRender}
|
|
107
|
+
className={styles.container}
|
|
108
|
+
date={updateAt}
|
|
109
|
+
description={description || systemRole}
|
|
110
|
+
loading={loading}
|
|
111
|
+
pin={pin}
|
|
112
|
+
ref={ref}
|
|
113
|
+
showAction={open || isHovering}
|
|
114
|
+
title={title}
|
|
115
|
+
/>
|
|
116
|
+
</Flexbox>
|
|
114
117
|
);
|
|
115
118
|
}, shallow);
|
|
116
119
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { createStyles, useResponsive } from 'antd-style';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
2
|
import Link from 'next/link';
|
|
4
3
|
import { memo } from 'react';
|
|
5
4
|
import LazyLoad from 'react-lazy-load';
|
|
6
5
|
|
|
7
6
|
import { SESSION_CHAT_URL } from '@/const/url';
|
|
8
7
|
import { useSessionHydrated, useSessionStore } from '@/store/session';
|
|
9
|
-
import {
|
|
8
|
+
import { LobeAgentSession } from '@/types/session';
|
|
10
9
|
|
|
11
10
|
import AddButton from './AddButton';
|
|
12
11
|
import SessionItem from './Item';
|
|
@@ -18,8 +17,10 @@ const useStyles = createStyles(
|
|
|
18
17
|
`,
|
|
19
18
|
);
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
interface SessionListProps {
|
|
21
|
+
dataSource: LobeAgentSession[];
|
|
22
|
+
}
|
|
23
|
+
const SessionList = memo<SessionListProps>(({ dataSource }) => {
|
|
23
24
|
const [activeSession, switchSession] = useSessionStore((s) => [s.activeSession, s.switchSession]);
|
|
24
25
|
const { styles } = useStyles();
|
|
25
26
|
const isInit = useSessionHydrated();
|
|
@@ -28,8 +29,8 @@ const SessionList = memo(() => {
|
|
|
28
29
|
|
|
29
30
|
return !isInit ? (
|
|
30
31
|
<SkeletonList />
|
|
31
|
-
) :
|
|
32
|
-
|
|
32
|
+
) : dataSource.length > 0 ? (
|
|
33
|
+
dataSource.map(({ id }) => (
|
|
33
34
|
<LazyLoad className={styles} key={id}>
|
|
34
35
|
<Link
|
|
35
36
|
aria-label={id}
|
|
@@ -1,28 +1,52 @@
|
|
|
1
1
|
import { CollapseProps } from 'antd';
|
|
2
|
-
import
|
|
2
|
+
import isEqual from 'fast-deep-equal';
|
|
3
|
+
import { memo } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
6
|
+
import { preferenceSelectors, useGlobalStore } from '@/store/global';
|
|
7
|
+
import { useSessionStore } from '@/store/session';
|
|
8
|
+
import { sessionSelectors } from '@/store/session/selectors';
|
|
9
|
+
|
|
5
10
|
import CollapseGroup from './CollapseGroup';
|
|
6
11
|
import Inbox from './Inbox';
|
|
7
12
|
import SessionList from './List';
|
|
8
13
|
|
|
9
14
|
const SessionListContent = memo(() => {
|
|
10
|
-
const { t } = useTranslation('
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const { t } = useTranslation('chat');
|
|
16
|
+
const unpinnedSessionList = useSessionStore(sessionSelectors.unpinnedSessionList, isEqual);
|
|
17
|
+
const pinnedList = useSessionStore(sessionSelectors.pinnedSessionList, isEqual);
|
|
18
|
+
const hasPinnedSessionList = useSessionStore(sessionSelectors.hasPinnedSessionList);
|
|
19
|
+
|
|
20
|
+
const [sessionGroupKeys, updatePreference] = useGlobalStore((s) => [
|
|
21
|
+
preferenceSelectors.sessionGroupKeys(s),
|
|
22
|
+
s.updatePreference,
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
const items = [
|
|
26
|
+
hasPinnedSessionList && {
|
|
27
|
+
children: <SessionList dataSource={pinnedList} />,
|
|
28
|
+
key: 'pinned',
|
|
29
|
+
label: t('pin'),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
children: <SessionList dataSource={unpinnedSessionList} />,
|
|
33
|
+
key: 'sessionList',
|
|
34
|
+
label: t('sessionList'),
|
|
35
|
+
},
|
|
36
|
+
].filter(Boolean) as CollapseProps['items'];
|
|
21
37
|
|
|
22
38
|
return (
|
|
23
39
|
<>
|
|
24
40
|
<Inbox />
|
|
25
|
-
<CollapseGroup
|
|
41
|
+
<CollapseGroup
|
|
42
|
+
activeKey={sessionGroupKeys}
|
|
43
|
+
items={items}
|
|
44
|
+
onChange={(keys) => {
|
|
45
|
+
const sessionGroupKeys = typeof keys === 'string' ? [keys] : keys;
|
|
46
|
+
|
|
47
|
+
updatePreference({ sessionGroupKeys });
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
26
50
|
</>
|
|
27
51
|
);
|
|
28
52
|
});
|
|
@@ -18,12 +18,14 @@ export default {
|
|
|
18
18
|
newAgent: '新建助手',
|
|
19
19
|
noDescription: '暂无描述',
|
|
20
20
|
|
|
21
|
+
pin: '置顶',
|
|
22
|
+
pinOff: '取消置顶',
|
|
21
23
|
regenerate: '重新生成',
|
|
22
|
-
|
|
23
24
|
roleAndArchive: '角色与记录',
|
|
24
25
|
searchAgentPlaceholder: '搜索助手和对话...',
|
|
25
26
|
send: '发送',
|
|
26
27
|
sendPlaceholder: '输入聊天内容...',
|
|
28
|
+
sessionList: '助手列表',
|
|
27
29
|
shareModal: {
|
|
28
30
|
download: '下载截图',
|
|
29
31
|
imageType: '图片格式',
|
|
@@ -45,6 +45,7 @@ export default {
|
|
|
45
45
|
noDescription: '暂无描述',
|
|
46
46
|
ok: '确定',
|
|
47
47
|
password: '密码',
|
|
48
|
+
|
|
48
49
|
pin: '置顶',
|
|
49
50
|
pinOff: '取消置顶',
|
|
50
51
|
regenerate: '重新生成',
|
|
@@ -52,7 +53,6 @@ export default {
|
|
|
52
53
|
reset: '重置',
|
|
53
54
|
retry: '重试',
|
|
54
55
|
send: '发送',
|
|
55
|
-
sessionList: '助手列表',
|
|
56
56
|
setting: '设置',
|
|
57
57
|
share: '分享',
|
|
58
58
|
stop: '停止',
|
|
@@ -62,7 +62,6 @@ export default {
|
|
|
62
62
|
setting: '设置',
|
|
63
63
|
},
|
|
64
64
|
temp: '临时',
|
|
65
|
-
|
|
66
65
|
updateAgent: '更新助理信息',
|
|
67
66
|
upgradeVersion: {
|
|
68
67
|
action: '立即升级',
|
|
@@ -2,6 +2,8 @@ export default {
|
|
|
2
2
|
debug: {
|
|
3
3
|
arguments: '调用参数',
|
|
4
4
|
function_call: '函数调用',
|
|
5
|
+
off: '关闭调试',
|
|
6
|
+
on: '查看插件调用信息',
|
|
5
7
|
response: '返回结果',
|
|
6
8
|
},
|
|
7
9
|
dev: {
|
|
@@ -88,10 +90,9 @@ export default {
|
|
|
88
90
|
},
|
|
89
91
|
},
|
|
90
92
|
loading: {
|
|
91
|
-
content: '
|
|
93
|
+
content: '调用插件中...',
|
|
92
94
|
plugin: '插件运行中...',
|
|
93
95
|
},
|
|
94
|
-
|
|
95
96
|
pluginList: '插件列表',
|
|
96
97
|
plugins: {
|
|
97
98
|
unknown: '插件检测中...',
|
|
@@ -22,6 +22,7 @@ export interface GlobalPreference {
|
|
|
22
22
|
guide?: Guide;
|
|
23
23
|
inputHeight: number;
|
|
24
24
|
mobileShowTopic?: boolean;
|
|
25
|
+
sessionGroupKeys: string[];
|
|
25
26
|
sessionsWidth: number;
|
|
26
27
|
showChatSideBar?: boolean;
|
|
27
28
|
showSessionPanel?: boolean;
|
|
@@ -49,6 +50,7 @@ export const initialState: GlobalState = {
|
|
|
49
50
|
guide: {},
|
|
50
51
|
inputHeight: 200,
|
|
51
52
|
mobileShowTopic: false,
|
|
53
|
+
sessionGroupKeys: ['pinned', 'sessionList'],
|
|
52
54
|
sessionsWidth: 320,
|
|
53
55
|
showChatSideBar: true,
|
|
54
56
|
showSessionPanel: true,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GlobalStore } from '@/store/global';
|
|
2
|
+
|
|
3
|
+
import { initialState } from '../initialState';
|
|
4
|
+
|
|
5
|
+
const sessionGroupKeys = (s: GlobalStore): string[] =>
|
|
6
|
+
s.preference.sessionGroupKeys || initialState.preference.sessionGroupKeys;
|
|
7
|
+
|
|
8
|
+
export const preferenceSelectors = {
|
|
9
|
+
sessionGroupKeys: sessionGroupKeys,
|
|
10
|
+
};
|
|
@@ -70,6 +70,12 @@ const displayPluginList = (s: PluginStoreState) =>
|
|
|
70
70
|
title: pluginHelpers.getPluginTitle(p.meta),
|
|
71
71
|
}));
|
|
72
72
|
|
|
73
|
+
const hasPluginUI = (id: string) => (s: PluginStoreState) => {
|
|
74
|
+
const manifest = getPluginManifestById(id)(s);
|
|
75
|
+
|
|
76
|
+
return !!manifest?.ui;
|
|
77
|
+
};
|
|
78
|
+
|
|
73
79
|
export const pluginSelectors = {
|
|
74
80
|
displayPluginList,
|
|
75
81
|
enabledSchema,
|
|
@@ -78,6 +84,7 @@ export const pluginSelectors = {
|
|
|
78
84
|
getPluginManifestLoadingStatus,
|
|
79
85
|
getPluginMetaById,
|
|
80
86
|
getPluginSettingsById,
|
|
87
|
+
hasPluginUI,
|
|
81
88
|
isCustomPlugin,
|
|
82
89
|
pluginList,
|
|
83
90
|
};
|
|
@@ -7,8 +7,11 @@ import {
|
|
|
7
7
|
currentSessionSafe,
|
|
8
8
|
getSessionById,
|
|
9
9
|
getSessionMetaById,
|
|
10
|
+
hasPinnedSessionList,
|
|
10
11
|
hasSessionList,
|
|
12
|
+
pinnedSessionList,
|
|
11
13
|
sessionList,
|
|
14
|
+
unpinnedSessionList,
|
|
12
15
|
} from './list';
|
|
13
16
|
|
|
14
17
|
const isInboxSession = (s: SessionStore) => s.activeId === INBOX_SESSION_ID;
|
|
@@ -21,7 +24,10 @@ export const sessionSelectors = {
|
|
|
21
24
|
getExportAgent,
|
|
22
25
|
getSessionById,
|
|
23
26
|
getSessionMetaById,
|
|
27
|
+
hasPinnedSessionList,
|
|
24
28
|
hasSessionList,
|
|
25
29
|
isInboxSession,
|
|
30
|
+
pinnedSessionList,
|
|
26
31
|
sessionList,
|
|
32
|
+
unpinnedSessionList,
|
|
27
33
|
};
|
|
@@ -39,10 +39,17 @@ export const sessionList = (s: SessionStore) => {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
export const pinnedSessionList = (s: SessionStore) => sessionList(s).filter((s) => s.pinned);
|
|
43
|
+
export const unpinnedSessionList = (s: SessionStore) => sessionList(s).filter((s) => !s.pinned);
|
|
44
|
+
|
|
42
45
|
export const hasSessionList = (s: SessionStore) => {
|
|
43
46
|
const list = sessionList(s);
|
|
44
47
|
return list?.length > 0;
|
|
45
48
|
};
|
|
49
|
+
export const hasPinnedSessionList = (s: SessionStore) => {
|
|
50
|
+
const list = pinnedSessionList(s);
|
|
51
|
+
return list?.length > 0;
|
|
52
|
+
};
|
|
46
53
|
|
|
47
54
|
export const getSessionById =
|
|
48
55
|
(id: string) =>
|