@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 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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#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
 
@@ -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/chat_lobehub_com_chat.html
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/chat_lobehub_com_chat.html
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/chat_lobehub_com_market.html
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/chat_lobehub_com_market.html
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/chat_lobehub_com_settings.html
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/chat_lobehub_com_settings.html
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/chat_lobehub_com_welcome.html
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/chat_lobehub_com_welcome.html
65
+ [welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/chat_preivew_lobehub_com_welcome.html
@@ -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/chat_lobehub_com_chat.html
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/chat_lobehub_com_chat.html
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/chat_lobehub_com_market.html
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/chat_lobehub_com_market.html
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/chat_lobehub_com_settings.html
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/chat_lobehub_com_settings.html
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/chat_lobehub_com_welcome.html
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/chat_lobehub_com_welcome.html
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.0",
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 { LoadingOutlined } from '@ant-design/icons';
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 { LucideChevronDown, LucideChevronUp, LucideOrbit, LucideToyBrick } from 'lucide-react';
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
- setOpen(!open);
72
+ setShow?.(!showRender);
66
73
  }}
67
74
  >
68
75
  {loading ? (
69
76
  <div>
70
- <LoadingOutlined />
77
+ <Loading3QuartersOutlined spin />
71
78
  </div>
72
79
  ) : (
73
80
  avatar
74
81
  )}
75
82
  {pluginTitle ?? t('plugins.unknown')}
76
- <Icon icon={open ? LucideChevronUp : LucideChevronDown} />
83
+ {showRightAction && <Icon icon={showRender ? LucideChevronUp : LucideChevronDown} />}
77
84
  </Flexbox>
78
- <Flexbox horizontal>
79
- {type === 'standalone' && <ActionIcon icon={LucideOrbit} />}
80
- <Settings id={id} />
81
- {setShow && (
85
+ {
86
+ <Flexbox horizontal>
87
+ {/*{type === 'standalone' && <ActionIcon icon={LucideOrbit} />}*/}
82
88
  <ActionIcon
83
- icon={showRender ? LucideChevronUp : LucideChevronDown}
89
+ icon={open ? LucideBugOff : LucideBug}
84
90
  onClick={() => {
85
- setShow(!showRender);
91
+ setOpen(!open);
86
92
  }}
93
+ title={t(open ? 'debug.off' : 'debug.on')}
87
94
  />
88
- )}
89
- </Flexbox>
95
+ <Settings id={id} />
96
+ </Flexbox>
97
+ }
90
98
  </Flexbox>
91
99
  {open && (
92
100
  <Tabs
@@ -6,6 +6,7 @@ export const useStyles = createStyles(({ css, token }) => ({
6
6
 
7
7
  width: fit-content;
8
8
  padding: 6px 8px;
9
+ padding-inline-end: 12px;
9
10
 
10
11
  color: ${token.colorText};
11
12
 
@@ -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} horizontal>
36
- <div>
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: 300 }} />}>
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
  };