@lobehub/chat 1.1.12 → 1.1.14
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 +6 -6
- package/package.json +1 -1
- package/src/app/(main)/settings/about/features/Version.tsx +3 -7
- package/src/app/metadata.ts +4 -3
- package/src/const/url.ts +2 -0
- package/src/features/Conversation/Messages/Tool/index.tsx +2 -1
- package/src/features/Conversation/Plugins/Render/BuiltinType/index.tsx +3 -2
- package/src/features/Conversation/Plugins/Render/StandaloneType/Iframe.tsx +1 -1
- package/src/features/Conversation/Plugins/Render/index.tsx +11 -2
- package/src/server/metadata.ts +2 -2
- package/src/store/chat/slices/builtinTool/action.ts +1 -1
- package/src/store/chat/slices/plugin/action.test.ts +6 -6
- package/src/store/chat/slices/plugin/action.ts +3 -3
- package/src/store/tool/slices/builtin/action.ts +3 -3
- package/src/types/tool/builtin.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 1.1.14](https://github.com/lobehub/lobe-chat/compare/v1.1.13...v1.1.14)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-06-27**</sup>
|
|
8
|
+
|
|
9
|
+
#### ♻ Code Refactoring
|
|
10
|
+
|
|
11
|
+
- **misc**: Refactor plugin state.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Code refactoring
|
|
19
|
+
|
|
20
|
+
- **misc**: Refactor plugin state, closes [#3059](https://github.com/lobehub/lobe-chat/issues/3059) ([6448570](https://github.com/lobehub/lobe-chat/commit/6448570))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 1.1.13](https://github.com/lobehub/lobe-chat/compare/v1.1.12...v1.1.13)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-06-27**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: -check_updates cannot be set by FEATURE_FLAGS.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: -check_updates cannot be set by FEATURE_FLAGS, closes [#3038](https://github.com/lobehub/lobe-chat/issues/3038) ([bdadfee](https://github.com/lobehub/lobe-chat/commit/bdadfee))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 1.1.12](https://github.com/lobehub/lobe-chat/compare/v1.1.11...v1.1.12)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2024-06-26**</sup>
|
package/README.md
CHANGED
|
@@ -226,12 +226,12 @@ In addition, these plugins are not limited to news aggregation, but can also ext
|
|
|
226
226
|
|
|
227
227
|
<!-- PLUGIN LIST -->
|
|
228
228
|
|
|
229
|
-
| Recent Submits
|
|
230
|
-
|
|
|
231
|
-
| [
|
|
232
|
-
| [
|
|
233
|
-
| [
|
|
234
|
-
| [
|
|
229
|
+
| Recent Submits | Description |
|
|
230
|
+
| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| [Savvy Trader AI](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **savvytrader** on **2024-06-27**</sup> | Realtime stock, crypto and other investment data.<br/>`stock` `analyze` |
|
|
232
|
+
| [Social Search](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-06-02**</sup> | The Social Search provides access to tweets, users, followers, images, media and more.<br/>`social` `twitter` `x` `search` |
|
|
233
|
+
| [Space](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | Space data including NASA.<br/>`space` `nasa` |
|
|
234
|
+
| [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | Search aggregation service, specifically designed for LLMs<br/>`web` `search` |
|
|
235
235
|
|
|
236
236
|
> 📊 Total plugins: [<kbd>**52**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
|
|
237
237
|
|
package/README.zh-CN.md
CHANGED
|
@@ -219,12 +219,12 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
|
219
219
|
|
|
220
220
|
<!-- PLUGIN LIST -->
|
|
221
221
|
|
|
222
|
-
| 最近新增
|
|
223
|
-
|
|
|
224
|
-
| [
|
|
225
|
-
| [
|
|
226
|
-
| [
|
|
227
|
-
| [
|
|
222
|
+
| 最近新增 | 插件描述 |
|
|
223
|
+
| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
224
|
+
| [Savvy Trader AI](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **savvytrader** on **2024-06-27**</sup> | 实时股票、加密货币和其他投资数据。<br/>`股票` `分析` |
|
|
225
|
+
| [社交搜索](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-06-02**</sup> | 社交搜索提供访问推文、用户、关注者、图片、媒体等功能。<br/>`社交` `推特` `x` `搜索` |
|
|
226
|
+
| [空间](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | 包括 NASA 的空间数据。<br/>`空间` `nasa` |
|
|
227
|
+
| [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | 搜索聚合服务,专为 LLMs 设计<br/>`web` `search` |
|
|
228
228
|
|
|
229
229
|
> 📊 Total plugins: [<kbd>**52**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
|
|
230
230
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -8,6 +8,7 @@ import { Center, Flexbox } from 'react-layout-kit';
|
|
|
8
8
|
|
|
9
9
|
import { MANUAL_UPGRADE_URL, OFFICIAL_SITE, RELEASES_URL } from '@/const/url';
|
|
10
10
|
import { CURRENT_VERSION } from '@/const/version';
|
|
11
|
+
import { useNewVersion } from '@/features/User/UserPanel/useNewVersion';
|
|
11
12
|
import { useGlobalStore } from '@/store/global';
|
|
12
13
|
|
|
13
14
|
const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -20,16 +21,11 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
20
21
|
}));
|
|
21
22
|
|
|
22
23
|
const Version = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
s.latestVersion,
|
|
26
|
-
s.useCheckLatestVersion,
|
|
27
|
-
]);
|
|
24
|
+
const hasNewVersion = useNewVersion();
|
|
25
|
+
const [latestVersion] = useGlobalStore((s) => [s.latestVersion]);
|
|
28
26
|
const { t } = useTranslation('common');
|
|
29
27
|
const { styles, theme } = useStyles();
|
|
30
28
|
|
|
31
|
-
useCheckLatestVersion();
|
|
32
|
-
|
|
33
29
|
return (
|
|
34
30
|
<Flexbox
|
|
35
31
|
align={mobile ? 'stretch' : 'center'}
|
package/src/app/metadata.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Metadata } from 'next';
|
|
2
2
|
|
|
3
3
|
import { appEnv, getAppConfig } from '@/config/app';
|
|
4
|
-
import { OFFICIAL_URL } from '@/const/url';
|
|
4
|
+
import { OFFICIAL_URL, OG_URL } from '@/const/url';
|
|
5
5
|
import { translation } from '@/server/translation';
|
|
6
6
|
|
|
7
7
|
const title = 'LobeChat';
|
|
@@ -14,6 +14,7 @@ const noManifest = !!BASE_PATH;
|
|
|
14
14
|
|
|
15
15
|
export const generateMetadata = async (): Promise<Metadata> => {
|
|
16
16
|
const { t } = await translation('metadata');
|
|
17
|
+
|
|
17
18
|
return {
|
|
18
19
|
appleWebApp: {
|
|
19
20
|
statusBarStyle: 'black-translucent',
|
|
@@ -33,7 +34,7 @@ export const generateMetadata = async (): Promise<Metadata> => {
|
|
|
33
34
|
{
|
|
34
35
|
alt: t('chat.title'),
|
|
35
36
|
height: 640,
|
|
36
|
-
url:
|
|
37
|
+
url: OG_URL,
|
|
37
38
|
width: 1200,
|
|
38
39
|
},
|
|
39
40
|
],
|
|
@@ -50,7 +51,7 @@ export const generateMetadata = async (): Promise<Metadata> => {
|
|
|
50
51
|
twitter: {
|
|
51
52
|
card: 'summary_large_image',
|
|
52
53
|
description: t('chat.description'),
|
|
53
|
-
images: [
|
|
54
|
+
images: [OG_URL],
|
|
54
55
|
site: '@lobehub',
|
|
55
56
|
title: t('chat.title'),
|
|
56
57
|
},
|
package/src/const/url.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const OFFICIAL_SITE = 'https://lobehub.com/';
|
|
|
11
11
|
|
|
12
12
|
export const getCanonicalUrl = (path: string) => urlJoin(OFFICIAL_URL, path);
|
|
13
13
|
|
|
14
|
+
export const OG_URL = '/og/cover.png?v=1';
|
|
15
|
+
|
|
14
16
|
export const GITHUB = pkg.homepage;
|
|
15
17
|
export const GITHUB_ISSUES = urlJoin(GITHUB, 'issues/new/choose');
|
|
16
18
|
export const CHANGELOG = urlJoin(GITHUB, 'blob/main/CHANGELOG.md');
|
|
@@ -9,7 +9,7 @@ import PluginRender from '../../Plugins/Render';
|
|
|
9
9
|
import Arguments from '../components/Arguments';
|
|
10
10
|
import Inspector from './Inspector';
|
|
11
11
|
|
|
12
|
-
export const ToolMessage = memo<ChatMessage>(({ id, content, plugin }) => {
|
|
12
|
+
export const ToolMessage = memo<ChatMessage>(({ id, content, pluginState, plugin }) => {
|
|
13
13
|
const loading = useChatStore(chatSelectors.isPluginApiInvoking(id));
|
|
14
14
|
|
|
15
15
|
const [showRender, setShow] = useState(plugin?.type !== 'default');
|
|
@@ -32,6 +32,7 @@ export const ToolMessage = memo<ChatMessage>(({ id, content, plugin }) => {
|
|
|
32
32
|
identifier={plugin?.identifier}
|
|
33
33
|
loading={loading}
|
|
34
34
|
payload={plugin}
|
|
35
|
+
pluginState={pluginState}
|
|
35
36
|
type={plugin?.type}
|
|
36
37
|
/>
|
|
37
38
|
) : (
|
|
@@ -10,9 +10,10 @@ export interface BuiltinTypeProps {
|
|
|
10
10
|
id: string;
|
|
11
11
|
identifier?: string;
|
|
12
12
|
loading?: boolean;
|
|
13
|
+
pluginState?: any;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const BuiltinType = memo<BuiltinTypeProps>(({ content, id, identifier, loading }) => {
|
|
16
|
+
const BuiltinType = memo<BuiltinTypeProps>(({ content, pluginState, id, identifier, loading }) => {
|
|
16
17
|
const { isJSON, data } = useParseContent(content);
|
|
17
18
|
|
|
18
19
|
if (!isJSON) {
|
|
@@ -23,7 +24,7 @@ const BuiltinType = memo<BuiltinTypeProps>(({ content, id, identifier, loading }
|
|
|
23
24
|
|
|
24
25
|
if (!Render) return;
|
|
25
26
|
|
|
26
|
-
return <Render content={data} identifier={identifier} messageId={id} />;
|
|
27
|
+
return <Render content={data} identifier={identifier} messageId={id} pluginState={pluginState} />;
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
export default BuiltinType;
|
|
@@ -96,7 +96,7 @@ const IFrameRender = memo<IFrameRenderProps>(({ url, id, payload, width = 600, h
|
|
|
96
96
|
// when plugin update state, we should update it to the message pluginState key
|
|
97
97
|
const updatePluginState = useChatStore((s) => s.updatePluginState);
|
|
98
98
|
useOnPluginStateUpdate((key, value) => {
|
|
99
|
-
updatePluginState(id, key
|
|
99
|
+
updatePluginState(id, { [key]: value });
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
// when plugin wants to get plugin settings, send it to plugin
|
|
@@ -23,18 +23,27 @@ export interface PluginRenderProps {
|
|
|
23
23
|
identifier?: string;
|
|
24
24
|
loading?: boolean;
|
|
25
25
|
payload?: PluginRequestPayload;
|
|
26
|
+
pluginState?: any;
|
|
26
27
|
type?: LobeToolRenderType;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const PluginRender = memo<PluginRenderProps>(
|
|
30
|
-
({ content, id, payload, identifier, type, loading }) => {
|
|
31
|
+
({ content, id, payload, pluginState, identifier, type, loading }) => {
|
|
31
32
|
switch (type) {
|
|
32
33
|
case 'standalone': {
|
|
33
34
|
return <Standalone id={id} name={identifier} payload={payload} />;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
case 'builtin': {
|
|
37
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
<BuiltinType
|
|
40
|
+
content={content}
|
|
41
|
+
id={id}
|
|
42
|
+
identifier={identifier}
|
|
43
|
+
loading={loading}
|
|
44
|
+
pluginState={pluginState}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
case 'markdown': {
|
package/src/server/metadata.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Metadata } from 'next';
|
|
2
2
|
|
|
3
|
-
import { getCanonicalUrl } from '@/const/url';
|
|
3
|
+
import { OG_URL, getCanonicalUrl } from '@/const/url';
|
|
4
4
|
import { formatDescLength, formatTitleLength } from '@/utils/genOG';
|
|
5
5
|
|
|
6
6
|
export class Meta {
|
|
7
7
|
public generate({
|
|
8
8
|
description = 'LobeChat offers you the best ChatGPT, OLLaMA, Gemini, Claude WebUI user experience',
|
|
9
9
|
title,
|
|
10
|
-
image =
|
|
10
|
+
image = OG_URL,
|
|
11
11
|
url,
|
|
12
12
|
type = 'website',
|
|
13
13
|
tags,
|
|
@@ -50,7 +50,7 @@ export const chatToolSlice: StateCreator<
|
|
|
50
50
|
toggleDallEImageLoading(messageId + params.prompt, false);
|
|
51
51
|
errorArray[index] = e;
|
|
52
52
|
|
|
53
|
-
await get().updatePluginState(messageId,
|
|
53
|
+
await get().updatePluginState(messageId, { error: errorArray });
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (!url) return;
|
|
@@ -358,8 +358,7 @@ describe('ChatPluginAction', () => {
|
|
|
358
358
|
describe('updatePluginState', () => {
|
|
359
359
|
it('should update the plugin state for a message', async () => {
|
|
360
360
|
const messageId = 'message-id';
|
|
361
|
-
const
|
|
362
|
-
const pluginStateValue = 'value';
|
|
361
|
+
const pluginStateValue = { key: 'value' };
|
|
363
362
|
|
|
364
363
|
const initialState = {
|
|
365
364
|
refreshMessages: vi.fn(),
|
|
@@ -369,12 +368,13 @@ describe('ChatPluginAction', () => {
|
|
|
369
368
|
const { result } = renderHook(() => useChatStore());
|
|
370
369
|
|
|
371
370
|
await act(async () => {
|
|
372
|
-
await result.current.updatePluginState(messageId,
|
|
371
|
+
await result.current.updatePluginState(messageId, pluginStateValue);
|
|
373
372
|
});
|
|
374
373
|
|
|
375
|
-
expect(messageService.updateMessagePluginState).toHaveBeenCalledWith(
|
|
376
|
-
|
|
377
|
-
|
|
374
|
+
expect(messageService.updateMessagePluginState).toHaveBeenCalledWith(
|
|
375
|
+
messageId,
|
|
376
|
+
pluginStateValue,
|
|
377
|
+
);
|
|
378
378
|
expect(initialState.refreshMessages).toHaveBeenCalled();
|
|
379
379
|
});
|
|
380
380
|
});
|
|
@@ -36,7 +36,7 @@ export interface ChatPluginAction {
|
|
|
36
36
|
triggerAIMessage: (params: { parentId?: string; traceId?: string }) => Promise<void>;
|
|
37
37
|
|
|
38
38
|
triggerToolCalls: (id: string) => Promise<void>;
|
|
39
|
-
updatePluginState: (id: string,
|
|
39
|
+
updatePluginState: (id: string, value: any) => Promise<void>;
|
|
40
40
|
|
|
41
41
|
internal_callPluginApi: (id: string, payload: ChatToolPayload) => Promise<string | undefined>;
|
|
42
42
|
internal_invokeDifferentTypePlugin: (id: string, payload: ChatToolPayload) => Promise<any>;
|
|
@@ -200,10 +200,10 @@ export const chatPlugin: StateCreator<
|
|
|
200
200
|
|
|
201
201
|
await get().triggerAIMessage({ traceId });
|
|
202
202
|
},
|
|
203
|
-
updatePluginState: async (id,
|
|
203
|
+
updatePluginState: async (id, value) => {
|
|
204
204
|
const { refreshMessages } = get();
|
|
205
205
|
|
|
206
|
-
await messageService.updateMessagePluginState(id,
|
|
206
|
+
await messageService.updateMessagePluginState(id, value);
|
|
207
207
|
await refreshMessages();
|
|
208
208
|
},
|
|
209
209
|
|
|
@@ -38,11 +38,11 @@ export const createBuiltinToolSlice: StateCreator<
|
|
|
38
38
|
|
|
39
39
|
if (builtinToolLoading[key]) return;
|
|
40
40
|
|
|
41
|
-
toggleBuiltinToolLoading(key, true);
|
|
42
|
-
|
|
43
41
|
const { [key as keyof BuiltinToolAction]: action } = get();
|
|
44
42
|
|
|
45
|
-
if (!action) return;
|
|
43
|
+
if (!action) return JSON.stringify(params);
|
|
44
|
+
|
|
45
|
+
toggleBuiltinToolLoading(key, true);
|
|
46
46
|
|
|
47
47
|
// @ts-ignore
|
|
48
48
|
const result = await action(params);
|
|
@@ -27,10 +27,11 @@ export interface LobeBuiltinTool {
|
|
|
27
27
|
type: 'builtin';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export interface BuiltinRenderProps<
|
|
31
|
-
content:
|
|
30
|
+
export interface BuiltinRenderProps<Content = any, State = any> {
|
|
31
|
+
content: Content;
|
|
32
32
|
identifier?: string;
|
|
33
33
|
messageId: string;
|
|
34
|
+
pluginState?: State;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export type BuiltinRender = <T = any>(props: BuiltinRenderProps<T>) => ReactNode;
|