@lobehub/chat 0.147.0 → 0.147.2
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 +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/self-hosting/advanced/analytics.mdx +1 -0
- package/docs/self-hosting/advanced/analytics.zh-CN.mdx +1 -0
- package/docs/self-hosting/advanced/authentication.mdx +7 -6
- package/docs/self-hosting/advanced/authentication.zh-CN.mdx +7 -6
- package/docs/self-hosting/advanced/sso-providers/auth0.mdx +58 -32
- package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +60 -32
- package/docs/self-hosting/advanced/sso-providers/authentik.mdx +33 -29
- package/docs/self-hosting/advanced/sso-providers/authentik.zh-CN.mdx +30 -27
- package/docs/self-hosting/advanced/sso-providers/github.mdx +49 -20
- package/docs/self-hosting/advanced/sso-providers/github.zh-CN.mdx +57 -31
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.mdx +53 -35
- package/docs/self-hosting/advanced/sso-providers/microsoft-entra-id.zh-CN.mdx +43 -31
- package/docs/self-hosting/advanced/sso-providers/zitadel.mdx +64 -34
- package/docs/self-hosting/advanced/sso-providers/zitadel.zh-CN.mdx +62 -36
- package/docs/self-hosting/advanced/upstream-sync.mdx +32 -23
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +32 -23
- package/docs/self-hosting/environment-variables/analytics.mdx +1 -0
- package/docs/self-hosting/environment-variables/analytics.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/auth.mdx +1 -0
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/basic.mdx +1 -0
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables/model-provider.mdx +1 -0
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +1 -0
- package/docs/self-hosting/environment-variables.mdx +1 -0
- package/docs/self-hosting/environment-variables.zh-CN.mdx +1 -0
- package/docs/self-hosting/examples/azure-openai.mdx +12 -8
- package/docs/self-hosting/examples/azure-openai.zh-CN.mdx +12 -8
- package/docs/self-hosting/examples/ollama.mdx +1 -0
- package/docs/self-hosting/examples/ollama.zh-CN.mdx +1 -0
- package/docs/self-hosting/faq/no-v1-suffix.mdx +1 -0
- package/docs/self-hosting/faq/no-v1-suffix.zh-CN.mdx +1 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.mdx +1 -0
- package/docs/self-hosting/faq/proxy-with-unable-to-verify-leaf-signature.zh-CN.mdx +1 -0
- package/docs/self-hosting/platform/docker-compose.mdx +80 -73
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +79 -73
- package/docs/self-hosting/platform/docker.mdx +85 -85
- package/docs/self-hosting/platform/docker.zh-CN.mdx +84 -85
- package/docs/self-hosting/platform/netlify.mdx +91 -42
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +88 -38
- package/docs/self-hosting/platform/railway.mdx +8 -6
- package/docs/self-hosting/platform/railway.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/repocloud.mdx +8 -6
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/sealos.mdx +8 -6
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +8 -6
- package/docs/self-hosting/platform/vercel.mdx +9 -7
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +9 -7
- package/docs/self-hosting/platform/zeabur.mdx +8 -6
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +8 -6
- package/docs/self-hosting/start.mdx +11 -1
- package/docs/self-hosting/start.zh-CN.mdx +2 -1
- package/docs/usage/agents/concepts.mdx +13 -2
- package/docs/usage/agents/concepts.zh-CN.mdx +13 -2
- package/docs/usage/agents/custom-agent.mdx +9 -2
- package/docs/usage/agents/custom-agent.zh-CN.mdx +8 -4
- package/docs/usage/agents/model.mdx +3 -3
- package/docs/usage/agents/model.zh-CN.mdx +6 -5
- package/docs/usage/agents/prompt.mdx +7 -5
- package/docs/usage/agents/prompt.zh-CN.mdx +7 -5
- package/docs/usage/agents/topics.mdx +9 -1
- package/docs/usage/agents/topics.zh-CN.mdx +9 -1
- package/docs/usage/features/agent-market.mdx +5 -5
- package/docs/usage/features/agent-market.zh-CN.mdx +1 -0
- package/docs/usage/features/local-llm.mdx +6 -1
- package/docs/usage/features/local-llm.zh-CN.mdx +6 -1
- package/docs/usage/features/mobile.mdx +5 -1
- package/docs/usage/features/mobile.zh-CN.mdx +6 -1
- package/docs/usage/features/more.mdx +1 -0
- package/docs/usage/features/more.zh-CN.mdx +1 -0
- package/docs/usage/features/multi-ai-providers.mdx +11 -2
- package/docs/usage/features/multi-ai-providers.zh-CN.mdx +12 -2
- package/docs/usage/features/plugin-system.mdx +8 -7
- package/docs/usage/features/plugin-system.zh-CN.mdx +9 -7
- package/docs/usage/features/pwa.mdx +10 -4
- package/docs/usage/features/pwa.zh-CN.mdx +11 -4
- package/docs/usage/features/text-to-image.zh-CN.mdx +1 -0
- package/docs/usage/features/theme.mdx +6 -1
- package/docs/usage/features/theme.zh-CN.mdx +7 -1
- package/docs/usage/features/tts.zh-CN.mdx +1 -0
- package/docs/usage/features/vision.zh-CN.mdx +1 -0
- package/docs/usage/plugins/basic-usage.mdx +31 -7
- package/docs/usage/plugins/basic-usage.zh-CN.mdx +31 -7
- package/docs/usage/plugins/custom-plugin.mdx +1 -0
- package/docs/usage/plugins/custom-plugin.zh-CN.mdx +1 -0
- package/docs/usage/plugins/development.mdx +79 -30
- package/docs/usage/plugins/development.zh-CN.mdx +80 -31
- package/docs/usage/plugins/store.mdx +11 -2
- package/docs/usage/plugins/store.zh-CN.mdx +11 -2
- package/docs/usage/providers/groq.mdx +32 -12
- package/docs/usage/providers/groq.zh-CN.mdx +30 -12
- package/docs/usage/providers/ollama/gemma.mdx +27 -11
- package/docs/usage/providers/ollama/gemma.zh-CN.mdx +28 -11
- package/docs/usage/providers/ollama/qwen.mdx +30 -16
- package/docs/usage/providers/ollama/qwen.zh-CN.mdx +25 -11
- package/docs/usage/providers/ollama.mdx +27 -14
- package/docs/usage/providers/ollama.zh-CN.mdx +27 -14
- package/package.json +1 -1
- package/src/app/settings/llm/Azure/index.tsx +1 -1
- package/src/app/settings/llm/components/ProviderConfig/index.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/CustomModelOption.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/ModelConfigModal.tsx +1 -1
- package/src/app/settings/llm/components/ProviderModelList/ModelFetcher.tsx +3 -3
- package/src/app/settings/llm/components/ProviderModelList/index.tsx +2 -2
- package/src/features/AgentSetting/AgentConfig/ModelSelect.tsx +1 -1
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +2 -2
- package/src/features/ModelSwitchPanel/index.tsx +1 -1
- package/src/locales/resources.test.ts +49 -0
- package/src/locales/resources.ts +7 -20
- package/src/services/_auth.ts +5 -3
- package/src/services/_header.ts +3 -4
- package/src/services/chat.ts +1 -1
- package/src/services/ollama.ts +3 -2
- package/src/store/global/slices/settings/actions/llm.test.ts +1 -1
- package/src/store/global/slices/settings/actions/llm.ts +2 -2
- package/src/store/global/slices/settings/selectors/modelConfig.test.ts +35 -14
- package/src/store/global/slices/settings/selectors/modelConfig.ts +55 -118
|
@@ -10,29 +10,45 @@ tags:
|
|
|
10
10
|
- Using Plugins
|
|
11
11
|
- Plugin Configuration
|
|
12
12
|
---
|
|
13
|
+
|
|
13
14
|
# Plugin Usage
|
|
14
15
|
|
|
15
16
|
The plugin system is a key element in expanding the capabilities of assistants in LobeChat. You can enhance the assistant's abilities by enabling a variety of plugins.
|
|
16
17
|
|
|
17
18
|
Watch the following video to quickly get started with using LobeChat plugins:
|
|
18
19
|
|
|
19
|
-
<Video
|
|
20
|
+
<Video
|
|
21
|
+
height={840}
|
|
22
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/94d4c312-1699-4e24-8782-138883678c9e"
|
|
23
|
+
/>
|
|
20
24
|
|
|
21
25
|
## Plugin Store
|
|
22
26
|
|
|
23
27
|
You can access the Plugin Store by navigating to "Extension Tools" -> "Plugin Store" in the session toolbar.
|
|
24
28
|
|
|
25
|
-
<Image
|
|
29
|
+
<Image
|
|
30
|
+
alt="Plugin Store S1"
|
|
31
|
+
height={472}
|
|
32
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab4e60d0-1293-49ac-8798-cb29b3b789e6"
|
|
33
|
+
/>
|
|
26
34
|
|
|
27
35
|
The Plugin Store allows you to directly install and use plugins within LobeChat.
|
|
28
36
|
|
|
29
|
-
<Image
|
|
37
|
+
<Image
|
|
38
|
+
alt="Plugin Store S2"
|
|
39
|
+
height={612}
|
|
40
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/d7a5d821-116f-4be6-8a1a-38d81a5ea0ea"
|
|
41
|
+
/>
|
|
30
42
|
|
|
31
43
|
## Using Plugins
|
|
32
44
|
|
|
33
45
|
After installing a plugin, simply enable it under the current assistant to use it.
|
|
34
46
|
|
|
35
|
-
<Image
|
|
47
|
+
<Image
|
|
48
|
+
alt="Using Plugins"
|
|
49
|
+
height={472}
|
|
50
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/76ab1ae7-a4f9-4285-8ebd-45b90251aba1"
|
|
51
|
+
/>
|
|
36
52
|
|
|
37
53
|
## Plugin Configuration
|
|
38
54
|
|
|
@@ -40,6 +56,14 @@ Some plugins may require specific configurations, such as API keys.
|
|
|
40
56
|
|
|
41
57
|
After installing a plugin, you can click on "Settings" to enter the plugin's settings and fill in the required configurations:
|
|
42
58
|
|
|
43
|
-
<Image
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
<Image
|
|
60
|
+
alt="Plugin Configuration S1"
|
|
61
|
+
height={472}
|
|
62
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/10eb3023-4528-4b06-8092-062e7b3865cc"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<Image
|
|
66
|
+
alt="Plugin Configuration S2"
|
|
67
|
+
height={472}
|
|
68
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab2e4c25-4b11-431b-9266-442d8b14cb41"
|
|
69
|
+
/>
|
|
@@ -8,29 +8,45 @@ tags:
|
|
|
8
8
|
- 插件商店
|
|
9
9
|
- 插件配置
|
|
10
10
|
---
|
|
11
|
+
|
|
11
12
|
# 插件使用
|
|
12
13
|
|
|
13
14
|
插件体系是 LobeChat 中扩展助理的能力的关键要素,你可以通过为助手启用各式各样的插件来增强助手的各项能力。
|
|
14
15
|
|
|
15
16
|
查看以下视频,快速上手使用 LobeChat 插件:
|
|
16
17
|
|
|
17
|
-
<Video
|
|
18
|
+
<Video
|
|
19
|
+
height={840}
|
|
20
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/94d4c312-1699-4e24-8782-138883678c9e"
|
|
21
|
+
/>
|
|
18
22
|
|
|
19
23
|
## 插件商店
|
|
20
24
|
|
|
21
25
|
你可以在会话工具条中的 「扩展工具」 -> 「插件商店」,进入插件商店。
|
|
22
26
|
|
|
23
|
-
<Image
|
|
27
|
+
<Image
|
|
28
|
+
alt="插件商店 S1"
|
|
29
|
+
height={472}
|
|
30
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab4e60d0-1293-49ac-8798-cb29b3b789e6"
|
|
31
|
+
/>
|
|
24
32
|
|
|
25
33
|
插件商店中会在 LobeChat 中可以直接安装并使用的插件。
|
|
26
34
|
|
|
27
|
-
<Image
|
|
35
|
+
<Image
|
|
36
|
+
alt="插件商店 S2"
|
|
37
|
+
height={612}
|
|
38
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/d7a5d821-116f-4be6-8a1a-38d81a5ea0ea"
|
|
39
|
+
/>
|
|
28
40
|
|
|
29
41
|
## 使用插件
|
|
30
42
|
|
|
31
43
|
安装完毕插件后,只需在当前助手下开启插件即可使用。
|
|
32
44
|
|
|
33
|
-
<Image
|
|
45
|
+
<Image
|
|
46
|
+
alt="使用插件"
|
|
47
|
+
height={472}
|
|
48
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/76ab1ae7-a4f9-4285-8ebd-45b90251aba1"
|
|
49
|
+
/>
|
|
34
50
|
|
|
35
51
|
## 插件配置
|
|
36
52
|
|
|
@@ -38,6 +54,14 @@ tags:
|
|
|
38
54
|
|
|
39
55
|
你可以在安装插件后,点击设置进入插件的设置填写配置:
|
|
40
56
|
|
|
41
|
-
<Image
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
<Image
|
|
58
|
+
alt="插件配置 S1"
|
|
59
|
+
height={472}
|
|
60
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/10eb3023-4528-4b06-8092-062e7b3865cc"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<Image
|
|
64
|
+
alt="插件配置 S2"
|
|
65
|
+
height={472}
|
|
66
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab2e4c25-4b11-431b-9266-442d8b14cb41"
|
|
67
|
+
/>
|
|
@@ -16,6 +16,7 @@ tags:
|
|
|
16
16
|
- Deployment
|
|
17
17
|
- Release
|
|
18
18
|
---
|
|
19
|
+
|
|
19
20
|
# Plugin Development Guide
|
|
20
21
|
|
|
21
22
|
## Plugin Composition
|
|
@@ -35,52 +36,88 @@ This section will introduce how to add and use a custom plugin in LobeChat.
|
|
|
35
36
|
<Steps>
|
|
36
37
|
### Create and Launch Plugin Project
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
You need to first create a plugin project locally, you can use the template we have prepared [lobe-chat-plugin-template][lobe-chat-plugin-template-url]
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
43
|
+
$ cd chat-plugin-template
|
|
44
|
+
$ npm i
|
|
45
|
+
$ npm run dev
|
|
46
|
+
```
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
42
|
-
$ cd chat-plugin-template
|
|
43
|
-
$ npm i
|
|
44
|
-
$ npm run dev
|
|
45
|
-
```
|
|
48
|
+
When you see `ready started server on 0.0.0.0:3400, url: http://localhost:3400`, it means the plugin service has been successfully launched locally.
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
<Image
|
|
51
|
+
alt="Create and Launch Plugin Project"
|
|
52
|
+
height={483}
|
|
53
|
+
inStep
|
|
54
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259526-9ef25272-4312-429b-93bc-a95515727ed3.png"
|
|
55
|
+
/>
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
### Add Local Plugin in LobeChat Role Settings
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
Next, go to LobeChat, create a new assistant, and go to its session settings page:
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
<Image
|
|
62
|
+
alt="Add Local Plugin in LobeChat Role Settings S1"
|
|
63
|
+
height={483}
|
|
64
|
+
inStep
|
|
65
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259643-1a9cc34a-76f3-4ccf-928b-129654670efd.png"
|
|
66
|
+
/>
|
|
54
67
|
|
|
55
|
-
|
|
68
|
+
Click the <kbd>Add</kbd> button on the right of the plugin list to open the custom plugin adding popup:
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
<Image
|
|
71
|
+
alt="Add Local Plugin in LobeChat Role Settings S2"
|
|
72
|
+
height={483}
|
|
73
|
+
inStep
|
|
74
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259748-2ef6a244-39bb-483c-b359-f156ffcbe1a4.png"
|
|
75
|
+
/>
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
Fill in the **Plugin Description File Url** with `http://localhost:3400/manifest-dev.json`, which is the manifest address of the plugin we started locally.
|
|
60
78
|
|
|
61
|
-
|
|
79
|
+
At this point, you should see that the identifier of the plugin has been automatically recognized as `chat-plugin-template`. Next, you need to fill in the remaining form fields (only the title is required), and then click the <kbd>Save</kbd> button to complete the custom plugin addition.
|
|
62
80
|
|
|
63
|
-
|
|
81
|
+
<Image
|
|
82
|
+
alt="Add Local Plugin in LobeChat Role Settings S3"
|
|
83
|
+
height={483}
|
|
84
|
+
inStep
|
|
85
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259964-59f4906d-ae2e-4ec0-8b43-db36871d0869.png"
|
|
86
|
+
/>
|
|
64
87
|
|
|
65
|
-
|
|
88
|
+
After adding, you can see the newly added plugin in the plugin list. If you need to modify the plugin configuration, you can click the <kbd>Settings</kbd> button on the far right to make changes.
|
|
66
89
|
|
|
67
|
-
|
|
90
|
+
<Image
|
|
91
|
+
alt="Add Local Plugin in LobeChat Role Settings S4"
|
|
92
|
+
height={483}
|
|
93
|
+
inStep
|
|
94
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260093-a0363c74-0b5b-48dd-b103-2db6b4a8262e.png"
|
|
95
|
+
/>
|
|
68
96
|
|
|
69
|
-
|
|
97
|
+
### Test Plugin Function in Session
|
|
70
98
|
|
|
71
|
-
|
|
99
|
+
Next, we need to test whether the plugin's function is working properly.
|
|
72
100
|
|
|
73
|
-
|
|
101
|
+
Click the <kbd>Back</kbd> button to return to the session area, and then send a message to the assistant: "What should I wear?" At this point, the assistant will try to ask you about your gender and current mood.
|
|
74
102
|
|
|
75
|
-
|
|
103
|
+
<Image
|
|
104
|
+
alt="Test Plugin Function in Session S1"
|
|
105
|
+
height={483}
|
|
106
|
+
inStep
|
|
107
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260291-f0aa0e7c-0ffb-486c-a834-08e73d49896f.png"
|
|
108
|
+
/>
|
|
76
109
|
|
|
77
|
-
|
|
110
|
+
After answering, the assistant will initiate the plugin call, retrieve recommended clothing data from the server based on your gender and mood, and push it to you. Finally, it will provide a text summary based on this information.
|
|
78
111
|
|
|
79
|
-
|
|
112
|
+
<Image
|
|
113
|
+
alt="Test Plugin Function in Session S2"
|
|
114
|
+
height={483}
|
|
115
|
+
inStep
|
|
116
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260461-c22ae797-2809-464b-96fc-d0c020f4807b.png"
|
|
117
|
+
/>
|
|
80
118
|
|
|
81
|
-
|
|
119
|
+
After completing these operations, you have understood the basic process of adding custom plugins and using them in LobeChat.
|
|
82
120
|
|
|
83
|
-
After completing these operations, you have understood the basic process of adding custom plugins and using them in LobeChat.
|
|
84
121
|
</Steps>
|
|
85
122
|
|
|
86
123
|
## Local Plugin Development
|
|
@@ -210,17 +247,29 @@ export default createLobeChatPluginGateway();
|
|
|
210
247
|
|
|
211
248
|
The custom UI interface for plugins is optional. For example, the official plugin [Web Content Extraction](https://github.com/lobehub/chat-plugin-web-crawler) does not have a corresponding user interface.
|
|
212
249
|
|
|
213
|
-
<Image
|
|
250
|
+
<Image
|
|
251
|
+
alt="Plugin UI Interface S1"
|
|
252
|
+
height={483}
|
|
253
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263241-0e765fdc-3463-4c36-a398-aef177a30df9.png"
|
|
254
|
+
/>
|
|
214
255
|
|
|
215
256
|
If you want to display richer information in plugin messages or include some interactive operations, you can customize a user interface for the plugin. For example, the following image shows the user interface for the [Search Engine](https://github.com/lobehub/chat-plugin-search-engine) plugin.
|
|
216
257
|
|
|
217
|
-
<Image
|
|
258
|
+
<Image
|
|
259
|
+
alt="Plugin UI Interface S2"
|
|
260
|
+
height={483}
|
|
261
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263427-9bdc03d5-aa61-4f62-a2ce-88683f3308d8.png"
|
|
262
|
+
/>
|
|
218
263
|
|
|
219
264
|
#### Implementation of Plugin UI Interface
|
|
220
265
|
|
|
221
266
|
LobeChat implements the loading of plugin UI through `iframe` and uses `postMessage` to communicate with the plugin. Therefore, the implementation of the plugin UI is consistent with regular web development. You can use any frontend framework and development language you are familiar with.
|
|
222
267
|
|
|
223
|
-
<Image
|
|
268
|
+
<Image
|
|
269
|
+
alt="Implementation of Plugin UI Interface"
|
|
270
|
+
height={483}
|
|
271
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263653-4ea87abc-249a-49f3-a241-7ed93ddb1ddf.png"
|
|
272
|
+
/>
|
|
224
273
|
|
|
225
274
|
In the template we provide, we use React + Next.js + [antd](https://ant.design/) as the frontend interface framework. You can find the implementation of the user interface in [`src/pages/index.tsx`](https://github.com/lobehub/chat-plugin-template/blob/main/src/pages/index.tsx).
|
|
226
275
|
|
|
@@ -258,7 +307,7 @@ If you want more people to use your plugin, feel free to [submit it for listing]
|
|
|
258
307
|
|
|
259
308
|
### Plugin Shield
|
|
260
309
|
|
|
261
|
-
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
262
311
|
|
|
263
312
|
```md
|
|
264
313
|
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
@@ -10,6 +10,7 @@ tags:
|
|
|
10
10
|
- 插件UI
|
|
11
11
|
- 插件SDK
|
|
12
12
|
---
|
|
13
|
+
|
|
13
14
|
# 插件开发指南
|
|
14
15
|
|
|
15
16
|
## 插件构成
|
|
@@ -29,52 +30,88 @@ tags:
|
|
|
29
30
|
<Steps>
|
|
30
31
|
### 创建并启动插件项目
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
你需要先在本地创建一个插件项目,可以使用我们准备好的模板 [lobe-chat-plugin-template][lobe-chat-plugin-template-url]
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
37
|
+
$ cd chat-plugin-template
|
|
38
|
+
$ npm i
|
|
39
|
+
$ npm run dev
|
|
40
|
+
```
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
$ git clone https://github.com/lobehub/chat-plugin-template.git
|
|
36
|
-
$ cd chat-plugin-template
|
|
37
|
-
$ npm i
|
|
38
|
-
$ npm run dev
|
|
39
|
-
```
|
|
42
|
+
当出现`ready started server on 0.0.0.0:3400, url: http://localhost:3400` 时,说明插件服务已经在本地启动成功。
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
<Image
|
|
45
|
+
alt="创建并启动插件项目"
|
|
46
|
+
height={483}
|
|
47
|
+
inStep
|
|
48
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259526-9ef25272-4312-429b-93bc-a95515727ed3.png"
|
|
49
|
+
/>
|
|
42
50
|
|
|
43
|
-
|
|
51
|
+
### 在 LobeChat 角色设置中添加本地插件
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
接下来进入到 LobeChat 中,创建一个新的助手,并进入它的会话设置页:
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
<Image
|
|
56
|
+
alt="在 LobeChat 角色设置中添加本地插件 S1"
|
|
57
|
+
height={483}
|
|
58
|
+
inStep
|
|
59
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259643-1a9cc34a-76f3-4ccf-928b-129654670efd.png"
|
|
60
|
+
/>
|
|
48
61
|
|
|
49
|
-
|
|
62
|
+
点击插件列表右侧的 <kbd>添加</kbd> 按钮,打开自定义插件添加弹窗:
|
|
50
63
|
|
|
51
|
-
|
|
64
|
+
<Image
|
|
65
|
+
alt="在 LobeChat 角色设置中添加本地插件 S2"
|
|
66
|
+
height={483}
|
|
67
|
+
inStep
|
|
68
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259748-2ef6a244-39bb-483c-b359-f156ffcbe1a4.png"
|
|
69
|
+
/>
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
在 **插件描述文件 Url** 地址 中填入 `http://localhost:3400/manifest-dev.json` ,这是我们本地启动的插件描述清单地址。
|
|
54
72
|
|
|
55
|
-
|
|
73
|
+
此时,你应该可以看到看到插件的标识符一栏已经被自动识别为 `chat-plugin-template`。接下来你需要填写剩下的表单字段(只有标题必填),然后点击 <kbd>保存</kbd> 按钮,即可完成自定义插件添加。
|
|
56
74
|
|
|
57
|
-
|
|
75
|
+
<Image
|
|
76
|
+
alt="在 LobeChat 角色设置中添加本地插件 S3"
|
|
77
|
+
height={483}
|
|
78
|
+
inStep
|
|
79
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265259964-59f4906d-ae2e-4ec0-8b43-db36871d0869.png"
|
|
80
|
+
/>
|
|
58
81
|
|
|
59
|
-
|
|
82
|
+
完成添加后,在插件列表中就能看到刚刚添加的插件,如果需要修改插件的配置,可以点击最右侧的 <kbd>设置</kbd> 按钮进行修改。
|
|
60
83
|
|
|
61
|
-
|
|
84
|
+
<Image
|
|
85
|
+
alt="在 LobeChat 角色设置中添加本地插件 S4"
|
|
86
|
+
height={483}
|
|
87
|
+
inStep
|
|
88
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260093-a0363c74-0b5b-48dd-b103-2db6b4a8262e.png"
|
|
89
|
+
/>
|
|
62
90
|
|
|
63
|
-
|
|
91
|
+
### 会话测试插件功能
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
接来下我们需要测试这个插件的功能是否正常。
|
|
66
94
|
|
|
67
|
-
|
|
95
|
+
点击 <kbd>返回</kbd> 按钮回到会话区,然后向助手发送消息:「我应该穿什么? 」此时助手将会尝试向你询问,了解你的性别与当前的心情。
|
|
68
96
|
|
|
69
|
-
|
|
97
|
+
<Image
|
|
98
|
+
alt="会话测试插件功能 S1"
|
|
99
|
+
height={483}
|
|
100
|
+
inStep
|
|
101
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260291-f0aa0e7c-0ffb-486c-a834-08e73d49896f.png"
|
|
102
|
+
/>
|
|
70
103
|
|
|
71
|
-
|
|
104
|
+
当回答完毕后,助手将会发起插件的调用,根据你的性别、心情,从服务端获取推荐的衣服数据,并推送给你。最后基于这些信息做一轮文本总结。
|
|
72
105
|
|
|
73
|
-
|
|
106
|
+
<Image
|
|
107
|
+
alt="会话测试插件功能 S2"
|
|
108
|
+
height={483}
|
|
109
|
+
inStep
|
|
110
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265260461-c22ae797-2809-464b-96fc-d0c020f4807b.png"
|
|
111
|
+
/>
|
|
74
112
|
|
|
75
|
-
|
|
113
|
+
当完成这些操作后,你已经了解了添加自定义插件,并在 LobeChat 中使用的基础流程。
|
|
76
114
|
|
|
77
|
-
当完成这些操作后,你已经了解了添加自定义插件,并在 LobeChat 中使用的基础流程。
|
|
78
115
|
</Steps>
|
|
79
116
|
|
|
80
117
|
## 本地插件开发
|
|
@@ -186,7 +223,7 @@ export default async (req: Request) => {
|
|
|
186
223
|
|
|
187
224
|
由于 LobeChat 默认的插件网关是云端服务 `/api/plugins`,云端服务通过 manifest 上的 `api.url` 地址发送请求,以解决跨域问题。
|
|
188
225
|
|
|
189
|
-
针对自定义插件,插件请求需要发送给本地服务, 因此通过在 manifest 中指定网关 ([http://localhost:3400/api/gateway),LobeChat](http://localhost:3400/api/gateway
|
|
226
|
+
针对自定义插件,插件请求需要发送给本地服务, 因此通过在 manifest 中指定网关 ([http://localhost:3400/api/gateway),LobeChat](<http://localhost:3400/api/gateway),LobeChat>) 将会直接请求该地址,然后只需要在该地址下创建对应的网关即可。
|
|
190
227
|
|
|
191
228
|
```ts
|
|
192
229
|
import { createLobeChatPluginGateway } from '@lobehub/chat-plugins-gateway';
|
|
@@ -204,17 +241,29 @@ export default createLobeChatPluginGateway();
|
|
|
204
241
|
|
|
205
242
|
自定义插件的 UI 界面是一个可选项。例如 官方插件 [「🧩 / 🕸 网页内容提取」](https://github.com/lobehub/chat-plugin-web-crawler),没有实现相应的用户界面。
|
|
206
243
|
|
|
207
|
-
<Image
|
|
244
|
+
<Image
|
|
245
|
+
alt="插件 UI 界面 S1"
|
|
246
|
+
height={483}
|
|
247
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263241-0e765fdc-3463-4c36-a398-aef177a30df9.png"
|
|
248
|
+
/>
|
|
208
249
|
|
|
209
250
|
如果你希望在插件消息中展示更加丰富的信息,或者包含一些富交互操作,你可以为插件定制一个用户界面。例如下图则为[「搜索引擎」](https://github.com/lobehub/chat-plugin-search-engine)插件的用户界面。
|
|
210
251
|
|
|
211
|
-
<Image
|
|
252
|
+
<Image
|
|
253
|
+
alt="插件 UI 界面 S2"
|
|
254
|
+
height={483}
|
|
255
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263427-9bdc03d5-aa61-4f62-a2ce-88683f3308d8.png"
|
|
256
|
+
/>
|
|
212
257
|
|
|
213
258
|
#### 插件 UI 界面实现
|
|
214
259
|
|
|
215
260
|
LobeChat 通过 `iframe` 实现插件 ui 的加载,使用 `postMessage` 实现主体与插件的通信。因此, 插件 UI 的实现方式与普通的网页开发一致,你可以使用任何你熟悉的前端框架与开发语言。
|
|
216
261
|
|
|
217
|
-
<Image
|
|
262
|
+
<Image
|
|
263
|
+
alt="插件 UI 界面实现"
|
|
264
|
+
height={483}
|
|
265
|
+
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/265263653-4ea87abc-249a-49f3-a241-7ed93ddb1ddf.png"
|
|
266
|
+
/>
|
|
218
267
|
|
|
219
268
|
在我们提供的模板中使用了 React + Next.js + [antd](https://ant.design/) 作为前端界面框架,你可以在 [`src/pages/index.tsx`](https://github.com/lobehub/chat-plugin-template/blob/main/src/pages/index.tsx) 中找到用户界面的实现。
|
|
220
269
|
|
|
@@ -252,7 +301,7 @@ export default Render;
|
|
|
252
301
|
|
|
253
302
|
### 插件 Shield
|
|
254
303
|
|
|
255
|
-
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
256
305
|
|
|
257
306
|
```markdown
|
|
258
307
|
[](https://github.com/lobehub/lobe-chat-plugins)
|
|
@@ -10,12 +10,21 @@ tags:
|
|
|
10
10
|
- Extension Tools
|
|
11
11
|
- Enhanced Functionality
|
|
12
12
|
---
|
|
13
|
+
|
|
13
14
|
# Plugin Store
|
|
14
15
|
|
|
15
16
|
You can access the plugin store by going to `Extension Tools` -> `Plugin Store` in the session toolbar.
|
|
16
17
|
|
|
17
|
-
<Image
|
|
18
|
+
<Image
|
|
19
|
+
alt="Plugin Store S1"
|
|
20
|
+
height={472}
|
|
21
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab4e60d0-1293-49ac-8798-cb29b3b789e6"
|
|
22
|
+
/>
|
|
18
23
|
|
|
19
24
|
In the plugin store, you can directly install and use plugins in LobeChat.
|
|
20
25
|
|
|
21
|
-
<Image
|
|
26
|
+
<Image
|
|
27
|
+
alt="Plugin Store S2"
|
|
28
|
+
height={472}
|
|
29
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/d7a5d821-116f-4be6-8a1a-38d81a5ea0ea"
|
|
30
|
+
/>
|
|
@@ -7,12 +7,21 @@ tags:
|
|
|
7
7
|
- 扩展工具
|
|
8
8
|
- 会话工具条
|
|
9
9
|
---
|
|
10
|
+
|
|
10
11
|
# 插件商店
|
|
11
12
|
|
|
12
13
|
你可以在会话工具条中的 `扩展工具` -> `插件商店`,进入插件商店。
|
|
13
14
|
|
|
14
|
-
<Image
|
|
15
|
+
<Image
|
|
16
|
+
alt="插件商店 S1"
|
|
17
|
+
height={472}
|
|
18
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/ab4e60d0-1293-49ac-8798-cb29b3b789e6"
|
|
19
|
+
/>
|
|
15
20
|
|
|
16
21
|
插件商店中会在 LobeChat 中可以直接安装并使用的插件。
|
|
17
22
|
|
|
18
|
-
<Image
|
|
23
|
+
<Image
|
|
24
|
+
alt="插件商店 S2"
|
|
25
|
+
height={472}
|
|
26
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/d7a5d821-116f-4be6-8a1a-38d81a5ea0ea"
|
|
27
|
+
/>
|
|
@@ -18,12 +18,19 @@ import { Callout, Steps } from 'nextra/components';
|
|
|
18
18
|
|
|
19
19
|
# Using Groq in LobeChat
|
|
20
20
|
|
|
21
|
-
<Image
|
|
21
|
+
<Image
|
|
22
|
+
alt={'Using Groq in LobeChat'}
|
|
23
|
+
cover
|
|
24
|
+
src={'https://github.com/lobehub/lobe-chat/assets/34400653/d0d08d98-a8d2-4b97-97c0-24a4f01d7eac'}
|
|
25
|
+
/>
|
|
22
26
|
|
|
23
27
|
Groq's [LPU Inference Engine](https://wow.groq.com/news_press/groq-lpu-inference-engine-leads-in-first-independent-llm-benchmark/) has excelled in the latest independent Large Language Model (LLM) benchmark, redefining the standard for AI solutions with its remarkable speed and efficiency. By integrating LobeChat with Groq Cloud, you can now easily leverage Groq's technology to accelerate the operation of large language models in LobeChat.
|
|
24
28
|
|
|
25
29
|
<Callout type={'info'}>
|
|
26
|
-
Groq's LPU Inference Engine achieved a sustained speed of 300 tokens per second in internal
|
|
30
|
+
Groq's LPU Inference Engine achieved a sustained speed of 300 tokens per second in internal
|
|
31
|
+
benchmark tests, and according to benchmark tests by ArtificialAnalysis.ai, Groq outperformed
|
|
32
|
+
other providers in terms of throughput (241 tokens per second) and total time to receive 100
|
|
33
|
+
output tokens (0.8 seconds).
|
|
27
34
|
</Callout>
|
|
28
35
|
|
|
29
36
|
This document will guide you on how to use Groq in LobeChat:
|
|
@@ -31,26 +38,39 @@ This document will guide you on how to use Groq in LobeChat:
|
|
|
31
38
|
<Steps>
|
|
32
39
|
### Obtaining GroqCloud API Keys
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
First, you need to obtain an API Key from the [GroqCloud Console](https://console.groq.com/).
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
<Image
|
|
44
|
+
alt={'Get GroqCloud API Key'}
|
|
45
|
+
height={274}
|
|
46
|
+
inStep
|
|
47
|
+
src={'https://github.com/lobehub/lobe-chat/assets/34400653/6942287e-fbb1-4a10-a1ce-caaa6663da1e'}
|
|
48
|
+
/>
|
|
37
49
|
|
|
38
|
-
|
|
50
|
+
Create an API Key in the `API Keys` menu of the console.
|
|
39
51
|
|
|
40
|
-
|
|
52
|
+
<Image
|
|
53
|
+
alt={'Save GroqCloud API Key'}
|
|
54
|
+
height={274}
|
|
55
|
+
inStep
|
|
56
|
+
src={'https://github.com/lobehub/lobe-chat/assets/34400653/eb57ca57-4f45-4409-91ce-9fa9c7c626d6'}
|
|
57
|
+
/>
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
<Callout type={'warning'}>
|
|
60
|
+
Safely store the key from the pop-up as it will only appear once. If you accidentally lose it, you
|
|
61
|
+
will need to create a new key.
|
|
45
62
|
</Callout>
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
### Configure Groq in LobeChat
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
You can find the Groq configuration option in `Settings` -> `Language Model`, where you can input the API Key you just obtained.
|
|
50
67
|
|
|
51
68
|
<Image alt={'Groq service provider settings'} height={274} inStep src={'https://github.com/lobehub/lobe-chat/assets/34400653/88948a3a-6681-4a8d-9734-a464e09e4957'} />
|
|
52
69
|
</Steps>
|
|
53
70
|
|
|
54
71
|
Next, select a Groq-supported model in the assistant's model options, and you can experience the powerful performance of Groq in LobeChat.
|
|
55
72
|
|
|
56
|
-
<Video
|
|
73
|
+
<Video
|
|
74
|
+
alt={'Select and use Groq model'}
|
|
75
|
+
src="https://github.com/lobehub/lobe-chat/assets/28616219/b6b8226b-183f-4249-8255-663a5e9f5af4"
|
|
76
|
+
/>
|