@lobehub/chat 0.95.0 → 0.95.1
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/README.md +4 -4
- package/docs/Lighthouse.md +8 -8
- package/docs/Lighthouse.zh-CN.md +8 -8
- package/package.json +1 -1
- 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/locales/default/plugin.ts +3 -2
- package/src/store/plugin/selectors.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.95.1](https://github.com/lobehub/lobe-chat/compare/v0.95.0...v0.95.1)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-25**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Improve plugin message ui.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Improve plugin message ui ([6edd25b](https://github.com/lobehub/lobe-chat/commit/6edd25b))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 0.95.0](https://github.com/lobehub/lobe-chat/compare/v0.94.5...v0.95.0)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-10-24**</sup>
|
package/README.md
CHANGED
|
@@ -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 installation
|
|
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/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.95.
|
|
3
|
+
"version": "0.95.1",
|
|
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",
|
|
@@ -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
|
);
|
|
@@ -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: '插件检测中...',
|
|
@@ -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
|
};
|