@lobehub/chat 0.105.1 → 0.106.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 CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 0.106.0](https://github.com/lobehub/lobe-chat/compare/v0.105.2...v0.106.0)
6
+
7
+ <sup>Released on **2023-11-29**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Support custom deletion, addition, and renaming of models.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Support custom deletion, addition, and renaming of models, closes [#521](https://github.com/lobehub/lobe-chat/issues/521) [#518](https://github.com/lobehub/lobe-chat/issues/518) [#518](https://github.com/lobehub/lobe-chat/issues/518) ([65e0824](https://github.com/lobehub/lobe-chat/commit/65e0824))
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
+
30
+ ### [Version 0.105.2](https://github.com/lobehub/lobe-chat/compare/v0.105.1...v0.105.2)
31
+
32
+ <sup>Released on **2023-11-27**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Add some env to Dockerfile.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Add some env to Dockerfile, closes [#514](https://github.com/lobehub/lobe-chat/issues/514) ([ed148db](https://github.com/lobehub/lobe-chat/commit/ed148db))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 0.105.1](https://github.com/lobehub/lobe-chat/compare/v0.105.0...v0.105.1)
6
56
 
7
57
  <sup>Released on **2023-11-27**</sup>
package/Dockerfile CHANGED
@@ -45,8 +45,17 @@ EXPOSE 3210
45
45
  ENV HOSTNAME "0.0.0.0"
46
46
  ENV PORT=3210
47
47
 
48
+ # General Variables
48
49
  ENV ACCESS_CODE "lobe66"
50
+ ENV NEXT_PUBLIC_CUSTOM_MODELS ""
51
+
52
+ # OpenAI
49
53
  ENV OPENAI_API_KEY ""
50
54
  ENV OPENAI_PROXY_URL ""
51
55
 
56
+ # Azure OpenAI
57
+ ENV USE_AZURE_OPENAI ""
58
+ ENV AZURE_API_KEY ""
59
+ ENV AZURE_API_VERSION ""
60
+
52
61
  CMD ["node", "server.js"]
package/README.md CHANGED
@@ -47,11 +47,11 @@ Supports one-click free deployment of your private ChatGPT/LLM web application.
47
47
 
48
48
  - [👋🏻 Getting Started & Join Our Community](#-getting-started--join-our-community)
49
49
  - [✨ Features](#-features)
50
- - [📸 Snapshot](#-snapshot)
51
50
  - [⚡️ Performance](#️-performance)
52
51
  - [🛳 Self Hosting](#-self-hosting)
53
52
  - [`A` Deploying with Vercel](#a-deploying-with-vercel)
54
53
  - [`B` Deploying with Docker](#b-deploying-with-docker)
54
+ - [`C` Deploying with Zeabur](#c-deploying-with-zeabur)
55
55
  - [Environment Variable](#environment-variable)
56
56
  - [📦 Ecosystem](#-ecosystem)
57
57
  - [🧩 Plugins](#-plugins)
@@ -89,34 +89,6 @@ Please be aware that LobeChat is currently under active development, and feedbac
89
89
 
90
90
  ## ✨ Features
91
91
 
92
- - [x] 💎 **Exquisite UI Design**: With a carefully designed interface, it offers an elegant appearance and smooth interaction. It supports light and dark themes and is mobile-friendly. PWA support provides a more native-like experience.
93
- - [x] 🗣️ **Smooth Conversation Experience**: Fluid responses ensure a smooth conversation experience. It fully supports Markdown rendering, including code highlighting, LaTex formulas, Mermaid flowcharts, and more.
94
- - [x] 🤖 **Customizable Agent Roles**: Users can create, share, and debug personalized dialogue agent roles according to their needs, providing more flexible and customized dialogue functions.
95
- - [x] 🧩 **Plugin Support & Custom Plugin Development**: Conversations are extendable with plugins. Users can install and use various plugins, such as search engines, web extraction, etc. It also supports the development of custom plugins to meet custom needs.
96
- - [x] 🏬 **Agent Market**: A Agent Market is provided where users can select their preferred dialogue agent roles, enriching the content and style of the dialogue.
97
- - [x] 👁️ **Visual Recognition**: With the integration of visual recognition capabilities, your agent can now analyze and understand images provided during the conversation. This allows for more interactive and context-aware conversations, enabling the dialogue agent to provide relevant and accurate responses based on visual content.
98
- - [x] 📢 **TTS & STT Conversation**: LobeChat are supporting Text-to-Speech and Speech-to-Text technology, allowing users to have voice-based conversations with the dialogue agent. This feature enhances the user experience by providing a more natural and immersive conversation environment. Users can choose from a variety of voices and adjust the speech rate to suit their preferences.
99
-
100
- ---
101
-
102
- Beside these features, LobeChat also have much better basic technique underground:
103
-
104
- - [x] 💨 **Quick Deployment**: Using the Vercel platform or docker image, you can deploy with just one click and complete the process within 1 minute without any complex configuration.
105
- - [x] 🌐 **Custom Domain**: If users have their own domain, they can bind it to the platform for quick access to the dialogue agent from anywhere.
106
- - [x] 🔒 **Privacy Protection**: All data is stored locally in the user's browser, ensuring user privacy.
107
-
108
- > \[!NOTE]
109
- >
110
- > You can find our upcoming [Roadmap][github-project-link] plans in the Projects section.
111
-
112
- <div align="right">
113
-
114
- [![][back-to-top]](#readme-top)
115
-
116
- </div>
117
-
118
- ## 📸 Snapshot
119
-
120
92
  ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/284072129-382bdf30-e3d6-4411-b5a0-249710b8ba08.png)
121
93
 
122
94
  #### `1` Visual Model Support
@@ -175,6 +147,8 @@ such as automatically fetching the latest news headlines to provide users with i
175
147
  Moreover, these plugins are not limited to news aggregation but can also extend to other practical functions, such as quick document retrieval,
176
148
  e-commerce platform data access, and various third-party services.
177
149
 
150
+ <video controls src="https://github.com/lobehub/lobe-chat/assets/28616219/f29475a3-f346-4196-a435-41a6373ab9e2" muted="false"></video>
151
+
178
152
  > \[!TIP]
179
153
  >
180
154
  > To aid developers in joining this ecosystem, we provide comprehensive development resources in the [🧩 Plugin System](#-plugins) section.
@@ -186,8 +160,6 @@ e-commerce platform data access, and various third-party services.
186
160
  > We welcome developers to use these resources to unleash their creativity and write feature-rich, user-friendly plugins.
187
161
  > With collective efforts, we can continuously expand the boundaries of chat applications and explore a more intelligent and efficient creativity platform.
188
162
 
189
- <video controls src="https://github.com/lobehub/lobe-chat/assets/28616219/f29475a3-f346-4196-a435-41a6373ab9e2" muted="false"></video>
190
-
191
163
  <!-- PLUGIN LIST -->
192
164
 
193
165
  | Official Plugin | Repository | Description |
@@ -209,7 +181,7 @@ e-commerce platform data access, and various third-party services.
209
181
 
210
182
  ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/268670869-f1ffbf66-42b6-42cf-a937-9ce1f8328514.png)
211
183
 
212
- #### `4` Prompt Agent Market
184
+ #### `4` Agent Market
213
185
 
214
186
  In the LobeChat Agent Marketplace, creators can discover a vibrant and innovative community that brings together a multitude of well-designed agents,
215
187
  which not only play an important role in work scenarios but also offer great convenience in learning processes.
@@ -273,9 +245,21 @@ providing smooth animations, responsive layouts, and adapting to different devic
273
245
 
274
246
  </div>
275
247
 
248
+ ![](https://gw.alipayobjects.com/zos/kitchen/R441AuFS4W/mobile.webp)
249
+
250
+ #### `6` Mobile Device Adaptation
251
+
252
+ We have carried out a series of optimization designs for mobile devices to enhance the user's mobile experience. Currently, we are iterating on the mobile user experience to achieve smoother and more intuitive interactions. If you have any suggestions or ideas, we welcome you to provide feedback through GitHub Issues or Pull Requests.
253
+
254
+ <div align="right">
255
+
256
+ [![][back-to-top]](#readme-top)
257
+
258
+ </div>
259
+
276
260
  ![](https://gw.alipayobjects.com/zos/kitchen/pvus1lo%26Z7/darkmode.webp)
277
261
 
278
- #### `6` Theme Mode Selection
262
+ #### `7` Theme Mode Selection
279
263
 
280
264
  As a design-engineering-oriented application, LobeChat places great emphasis on users' personalized experiences,
281
265
  hence introducing flexible and diverse theme modes, including a light mode for daytime and a dark mode for nighttime.
@@ -293,13 +277,23 @@ Whether it's a desire for a sober dark blue, a lively peach pink, or a professio
293
277
 
294
278
  </div>
295
279
 
296
- ![](https://gw.alipayobjects.com/zos/kitchen/R441AuFS4W/mobile.webp)
280
+ #### What's more
297
281
 
298
- #### `7` Mobile Device Adaptation
282
+ Beside these features, LobeChat also have much better basic technique underground:
299
283
 
300
- We have carried out a series of optimization designs for mobile devices to enhance the user's mobile experience. Currently, we are iterating on the mobile user experience to achieve smoother and more intuitive interactions. If you have any suggestions or ideas, we welcome you to provide feedback through GitHub Issues or Pull Requests.
284
+ - [x] 💨 **Quick Deployment**: Using the Vercel platform or docker image, you can deploy with just one click and complete the process within 1 minute without any complex configuration.
285
+ - [x] 🌐 **Custom Domain**: If users have their own domain, they can bind it to the platform for quick access to the dialogue agent from anywhere.
286
+ - [x] 🔒 **Privacy Protection**: All data is stored locally in the user's browser, ensuring user privacy.
287
+ - [x] 💎 **Exquisite UI Design**: With a carefully designed interface, it offers an elegant appearance and smooth interaction. It supports light and dark themes and is mobile-friendly. PWA support provides a more native-like experience.
288
+ - [x] 🗣️ **Smooth Conversation Experience**: Fluid responses ensure a smooth conversation experience. It fully supports Markdown rendering, including code highlighting, LaTex formulas, Mermaid flowcharts, and more.
301
289
 
302
- > 🚧 Additional snapshots and demonstrations are being progressively added...
290
+ > ✨ more features will be added when LobeChat evolve.
291
+
292
+ ---
293
+
294
+ > \[!NOTE]
295
+ >
296
+ > You can find our upcoming [Roadmap][github-project-link] plans in the Projects section.
303
297
 
304
298
  <div align="right">
305
299
 
@@ -386,6 +380,21 @@ $ docker run -d -p 3210:3210 \
386
380
 
387
381
  <br/>
388
382
 
383
+ ### `C` Deploying with Zeabur
384
+
385
+ If you want to deploy this service yourself on Zeabur, you can follow these steps:
386
+
387
+ - Prepare your [OpenAI API Key](https://platform.openai.com/account/api-keys).
388
+ - Click the button below to start deployment: Deploy with Zeabur.
389
+ - You can start using it after the deployment.
390
+ - You can bind a custom domain or use the subdomain provided by Zeabur.
391
+
392
+ <div align="center">
393
+
394
+ [![][deploy-on-zeabur-button-image]][deploy-on-zeabur-link]
395
+
396
+ </div>
397
+
389
398
  ### Environment Variable
390
399
 
391
400
  This project provides some additional configuration items set with environment variables:
@@ -525,6 +534,8 @@ This project is [MIT](./LICENSE) licensed.
525
534
  [contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
526
535
  [deploy-button-image]: https://vercel.com/button
527
536
  [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
537
+ [deploy-on-zeabur-button-image]: https://zeabur.com/button.svg
538
+ [deploy-on-zeabur-link]: https://zeabur.com/templates/VZGGTI
528
539
  [discord-link]: https://discord.gg/AYFPHvv2jT
529
540
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
530
541
  [discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
package/README.zh-CN.md CHANGED
@@ -45,12 +45,12 @@ LobeChat 是开源的高性能聊天机器人框架,支持语音合成、多
45
45
  #### TOC
46
46
 
47
47
  - [👋🏻 开始使用 & 交流](#-开始使用--交流)
48
- - [✨ 功能特性](#-功能特性)
49
- - [📸 快照预览](#-快照预览)
48
+ - [✨ 特性一览](#-特性一览)
50
49
  - [⚡️ 性能测试](#️-性能测试)
51
50
  - [🛳 开箱即用](#-开箱即用)
52
51
  - [`A` 使用 Vercel 部署](#a-使用-vercel-部署)
53
52
  - [`B` 使用 Docker 部署](#b-使用-docker-部署)
53
+ - [`C` 使用 Zeabur 部署](#c-使用-zeabur-部署)
54
54
  - [环境变量](#环境变量)
55
55
  - [📦 生态系统](#-生态系统)
56
56
  - [🧩 插件体系](#-插件体系)
@@ -85,35 +85,7 @@ LobeChat 是开源的高性能聊天机器人框架,支持语音合成、多
85
85
  </picture>
86
86
  </details>
87
87
 
88
- ## ✨ 功能特性
89
-
90
- - [x] 💎 **精致 UI 设计**:经过精心设计的界面,具有优雅的外观和流畅的交互效果,支持亮暗色主题,适配移动端。支持 PWA,提供更加接近原生应用的体验。
91
- - [x] 🗣️ **流畅的对话体验**:流式响应带来流畅的对话体验,并且支持完整的 Markdown 渲染,包括代码高亮、LaTex 公式、Mermaid 流程图等。
92
- - [x] 🧩 **支持插件与自定义插件开发**:会话支持插件扩展,用户可以安装和使用各种插件,例如搜索引擎、网页提取等,同时也支持自定义插件的开发,满足自定义需求。
93
- - [x] 🤖 **自定义助手角色**:用户可以根据自己的需求创建、分享和调试个性化的对话助手角色,提供更加灵活和个性化的对话功能 .
94
- - [x] 🏬 **角色市场**:提供角色市场,用户可以在市场上选择自己喜欢的对话助手角色,丰富对话的内容和风格。
95
- - [x] 👁️ **视觉识别**: 通过集成视觉识别能力,AI 助手现在可以分析和理解对话过程中提供的图像。这使得对话代理能够进行更具交互性和上下文感知的对话,根据视觉内容提供相关和准确的回答。
96
- - [ ] 📢 **语音会话**: 我们支持文本转语音技术,允许用户与对话代理进行语音对话。这个功能通过提供更自然和沉浸式的对话环境来增强用户体验。用户可以选择多种声音并调整语速以适应自己的偏好。
97
-
98
- ---
99
-
100
- 除了上述功能特性以外,我们的底层技术方案为你带来了更多使用保障:
101
-
102
- - [x] 💨 **快速部署**:使用 Vercel 平台或者我们的 Docker 镜像,只需点击一键部署按钮,即可在 1 分钟内完成部署,无需复杂的配置过程。
103
- - [x] 🔒 **隐私安全**:所有数据保存在用户浏览器本地,保证用户的隐私安全。
104
- - [x] 🌐 **自定义域名**:如果用户拥有自己的域名,可以将其绑定到平台上,方便在任何地方快速访问对话助手。
105
-
106
- > \[!NOTE]
107
- >
108
- > 你可以在 Projects 中找到我们后续的 [Roadmap][github-project-link] 计划
109
-
110
- <div align="right">
111
-
112
- [![][back-to-top]](#readme-top)
113
-
114
- </div>
115
-
116
- ## 📸 快照预览
88
+ ## ✨ 特性一览
117
89
 
118
90
  #### `1` GPT 视觉认知
119
91
 
@@ -160,6 +132,8 @@ LobeChat 支持文字转语音(Text-to-Speech,TTS)和语音转文字(Spe
160
132
  LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地增强了 ChatGPT 的实用性和灵活性。通过利用插件,ChatGPT 能够实现实时信息的获取和处理,例如自动获取最新新闻头条,为用户提供即时且相关的资讯。
161
133
  此外,这些插件不仅局限于新闻聚合,还可以扩展到其他实用的功能,如快速检索文档、获取电商平台数据、以及其他各式各样的第三方服务。
162
134
 
135
+ <https://github.com/lobehub/lobe-chat/assets/28616219/f29475a3-f346-4196-a435-41a6373ab9e2>
136
+
163
137
  > \[!TIP]
164
138
  >
165
139
  > 为了帮助开发者更好地参与到这个生态中来,我们在 [🧩 插件体系](#-插件体系) 部分提供了全面的开发资源。
@@ -169,8 +143,6 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
169
143
  >
170
144
  > 我们欢迎开发者利用这些资源,发挥创造力,编写出功能丰富、用户友好的插件。通过共同的努力,我们可以不断扩展聊天应用的功能界限,探索一个更加智能、高效的创造力平台。
171
145
 
172
- <https://github.com/lobehub/lobe-chat/assets/28616219/f29475a3-f346-4196-a435-41a6373ab9e2>
173
-
174
146
  <!-- PLUGIN LIST -->
175
147
 
176
148
  | 官方插件 | 仓库 | 插件描述 |
@@ -248,9 +220,21 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
248
220
 
249
221
  </div>
250
222
 
223
+ ![](https://gw.alipayobjects.com/zos/kitchen/R441AuFS4W/mobile.webp)
224
+
225
+ #### `6` 移动设备适配
226
+
227
+ 针对移动设备进行了一系列的优化设计,以提升用户的移动体验。目前,我们正在对移动端的用户体验进行版本迭代,以实现更加流畅和直观的交互。如果您有任何建议或想法,我们非常欢迎您通过 GitHub Issues 或者 Pull Requests 提供反馈。
228
+
229
+ <div align="right">
230
+
231
+ [![][back-to-top]](#readme-top)
232
+
233
+ </div>
234
+
251
235
  ![](https://gw.alipayobjects.com/zos/kitchen/pvus1lo%26Z7/darkmode.webp)
252
236
 
253
- #### `6` 主题模式选择
237
+ #### `7` 主题模式选择
254
238
 
255
239
  作为设计工程师出身 LobeChat 在界面设计上十分考虑用户的个性化体验,因此引入了灵活多变的主题模式,其中包括日间的亮色模式和夜间的深色模式。
256
240
  除了主题模式的切换,提供了一系列的颜色定制选项,允许用户根据自己的喜好来调整应用的主题色彩。无论是想要沉稳的深蓝,还是希望活泼的桃粉,或者是专业的灰白,用户都能够在 LobeChat 中找到匹配自己风格的颜色选择。
@@ -265,13 +249,23 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
265
249
 
266
250
  </div>
267
251
 
268
- ![](https://gw.alipayobjects.com/zos/kitchen/R441AuFS4W/mobile.webp)
252
+ #### 更多特性
269
253
 
270
- #### `7` 移动设备适配
254
+ 除了上述功能特性以外,我们的所具有的设计和技术能力将为你带来了更多使用保障:
271
255
 
272
- 针对移动设备进行了一系列的优化设计,以提升用户的移动体验。目前,我们正在对移动端的用户体验进行版本迭代,以实现更加流畅和直观的交互。如果您有任何建议或想法,我们非常欢迎您通过 GitHub Issues 或者 Pull Requests 提供反馈。
256
+ - [x] 💎 **精致 UI 设计**:经过精心设计的界面,具有优雅的外观和流畅的交互效果,支持亮暗色主题,适配移动端。支持 PWA,提供更加接近原生应用的体验。
257
+ - [x] 🗣️ **流畅的对话体验**:流式响应带来流畅的对话体验,并且支持完整的 Markdown 渲染,包括代码高亮、LaTex 公式、Mermaid 流程图等。
258
+ - [x] 💨 **快速部署**:使用 Vercel 平台或者我们的 Docker 镜像,只需点击一键部署按钮,即可在 1 分钟内完成部署,无需复杂的配置过程。
259
+ - [x] 🔒 **隐私安全**:所有数据保存在用户浏览器本地,保证用户的隐私安全。
260
+ - [x] 🌐 **自定义域名**:如果用户拥有自己的域名,可以将其绑定到平台上,方便在任何地方快速访问对话助手。
261
+
262
+ > ✨ 随着产品迭代持续更新,我们将会带来更多更多令人激动的功能!
273
263
 
274
- > 🚧 更多快照和演示正在陆续添加中...
264
+ ---
265
+
266
+ > \[!NOTE]
267
+ >
268
+ > 你可以在 Projects 中找到我们后续的 [Roadmap][github-project-link] 计划
275
269
 
276
270
  <div align="right">
277
271
 
@@ -360,6 +354,21 @@ $ docker run -d -p 3210:3210 \
360
354
 
361
355
  <br/>
362
356
 
357
+ ### `C` 使用 Zeabur 部署
358
+
359
+ 如果想在 Zeabur 上部署该服务,可以按照以下步骤进行操作:
360
+
361
+ - 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys) 。
362
+ - 点击下方按钮开始部署: Deploy to Zeabur
363
+ - 部署完毕后,即可开始使用;
364
+ - 绑定自定义域名(可选):你可以使用 Zeabur 提供的子域名,也可以选择绑定自定义域名。目前 Zeabur 提供的域名还未被污染,大多数地区都可以直连。
365
+
366
+ <div align="center">
367
+
368
+ [![][deploy-on-zeabur-button-image]][deploy-on-zeabur-link]
369
+
370
+ </div>
371
+
363
372
  ### 环境变量
364
373
 
365
374
  本项目提供了一些额外的配置项,使用环境变量进行设置:
@@ -499,6 +508,8 @@ This project is [MIT](./LICENSE) licensed.
499
508
  [contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
500
509
  [deploy-button-image]: https://vercel.com/button
501
510
  [deploy-link]: https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
511
+ [deploy-on-zeabur-button-image]: https://zeabur.com/button.svg
512
+ [deploy-on-zeabur-link]: https://zeabur.com/templates/VZGGTI
502
513
  [discord-link]: https://discord.gg/AYFPHvv2jT
503
514
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
504
515
  [discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
@@ -34,9 +34,11 @@ LobeChat provides additional configuration options during deployment, which can
34
34
  ### `NEXT_PUBLIC_CUSTOM_MODELS`
35
35
 
36
36
  - Type: Optional
37
- - Description: add your custom model name, multi model seperate by comma. for example: `gpt-3.5-1106,gpt-4-1106`
37
+ - Description: Used to control the model list. Use `+` to add a model, `-` to hide a model, and `model_name=display_name` to customize the display name of a model, separated by commas.
38
38
  - Default: `-`
39
- - Example: `model1,model2,model3`
39
+ - Example: `+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo`
40
+
41
+ The above example adds `qwen-7b-chat` and `glm-6b` to the model list, removes `gpt-3.5-turbo` from the list, and displays the model name `gpt-4-1106-preview` as `gpt-4-turbo`. If you want to disable all models first and then enable specific models, you can use `-all,+gpt-3.5-turbo`, which means only `gpt-3.5-turbo` will be enabled.
40
42
 
41
43
  ## OpenAI
42
44
 
@@ -34,9 +34,11 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
34
34
  ### `NEXT_PUBLIC_CUSTOM_MODELS`
35
35
 
36
36
  - 类型:可选
37
- - 描述:添加自定义模型名称,多个模型需要使用逗号 `,` 隔开。 比如: `gpt-3.5-1106,gpt-4-1106`
37
+ - 描述:用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。
38
38
  - 默认值:`-`
39
- - 示例:`model1,model2,model3`
39
+ - 示例:`+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo`
40
+
41
+ 上面示例表示增加 `qwen-7b-chat` 和 `glm-6b` 到模型列表,而从列表中删除 `gpt-3.5-turbo`,并将 `gpt-4-1106-preview` 模型名字展示为 `gpt-4-turbo`。如果你想先禁用所有模型,再启用指定模型,可以使用 `-all,+gpt-3.5-turbo`,则表示仅启用 `gpt-3.5-turbo`。
40
42
 
41
43
  ## OpenAI
42
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.105.1",
3
+ "version": "0.106.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",
@@ -22,7 +22,7 @@ const ModelSwitch = memo(() => {
22
22
  <Dropdown
23
23
  menu={{
24
24
  activeKey: model,
25
- items: modelList.map((i) => ({ key: i, label: i })),
25
+ items: modelList.map(({ name, displayName }) => ({ key: name, label: displayName })),
26
26
  onClick: (e) => {
27
27
  updateAgentConfig({ model: e.key as LanguageModel });
28
28
  },
@@ -114,7 +114,14 @@ const AgentConfig = memo(() => {
114
114
  const model: ItemGroup = {
115
115
  children: [
116
116
  {
117
- children: <Select options={modelList.map((value) => ({ label: value, value }))} />,
117
+ children: (
118
+ <Select
119
+ options={modelList.map(({ name, displayName }) => ({
120
+ label: displayName,
121
+ value: name,
122
+ }))}
123
+ />
124
+ ),
118
125
  desc: t('settingModel.model.desc'),
119
126
  label: t('settingModel.model.title'),
120
127
  name: 'model',
@@ -1,5 +1,104 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`settingsSelectors > CUSTOM_MODELS > custom deletion, addition, and renaming of models 1`] = `
4
+ [
5
+ {
6
+ "displayName": "llama",
7
+ "name": "llama",
8
+ },
9
+ {
10
+ "displayName": "claude-2",
11
+ "name": "claude-2",
12
+ },
13
+ {
14
+ "displayName": "gpt-4-32k",
15
+ "name": "gpt-4-1106-preview",
16
+ },
17
+ ]
18
+ `;
19
+
20
+ exports[`settingsSelectors > CUSTOM_MODELS > duplicate naming model 1`] = `
21
+ [
22
+ {
23
+ "displayName": "gpt-3.5-turbo",
24
+ "name": "gpt-3.5-turbo",
25
+ },
26
+ {
27
+ "displayName": "gpt-3.5-turbo-1106",
28
+ "name": "gpt-3.5-turbo-1106",
29
+ },
30
+ {
31
+ "displayName": "gpt-3.5-turbo-16k",
32
+ "name": "gpt-3.5-turbo-16k",
33
+ },
34
+ {
35
+ "displayName": "gpt-4",
36
+ "name": "gpt-4",
37
+ },
38
+ {
39
+ "displayName": "gpt-4-32k",
40
+ "name": "gpt-4-32k",
41
+ },
42
+ {
43
+ "displayName": "gpt-4-vision-preview",
44
+ "name": "gpt-4-vision-preview",
45
+ },
46
+ {
47
+ "displayName": "gpt-4-32k",
48
+ "name": "gpt-4-1106-preview",
49
+ },
50
+ ]
51
+ `;
52
+
53
+ exports[`settingsSelectors > CUSTOM_MODELS > only add the model 1`] = `
54
+ [
55
+ {
56
+ "displayName": "gpt-3.5-turbo",
57
+ "name": "gpt-3.5-turbo",
58
+ },
59
+ {
60
+ "displayName": "gpt-3.5-turbo-1106",
61
+ "name": "gpt-3.5-turbo-1106",
62
+ },
63
+ {
64
+ "displayName": "gpt-3.5-turbo-16k",
65
+ "name": "gpt-3.5-turbo-16k",
66
+ },
67
+ {
68
+ "displayName": "gpt-4",
69
+ "name": "gpt-4",
70
+ },
71
+ {
72
+ "displayName": "gpt-4-32k",
73
+ "name": "gpt-4-32k",
74
+ },
75
+ {
76
+ "displayName": "gpt-4-1106-preview",
77
+ "name": "gpt-4-1106-preview",
78
+ },
79
+ {
80
+ "displayName": "gpt-4-vision-preview",
81
+ "name": "gpt-4-vision-preview",
82
+ },
83
+ {
84
+ "displayName": "model1",
85
+ "name": "model1",
86
+ },
87
+ {
88
+ "displayName": "model2",
89
+ "name": "model2",
90
+ },
91
+ {
92
+ "displayName": "model3",
93
+ "name": "model3",
94
+ },
95
+ {
96
+ "displayName": "model4",
97
+ "name": "model4",
98
+ },
99
+ ]
100
+ `;
101
+
3
102
  exports[`settingsSelectors > currentSettings > should merge DEFAULT_SETTINGS and s.settings correctly 1`] = `
4
103
  {
5
104
  "avatar": "avatar.jpg",
@@ -58,6 +58,57 @@ describe('settingsSelectors', () => {
58
58
  });
59
59
  });
60
60
 
61
+ describe('CUSTOM_MODELS', () => {
62
+ it('custom deletion, addition, and renaming of models', () => {
63
+ const s = {
64
+ settings: {
65
+ languageModel: {
66
+ openAI: {
67
+ customModelName:
68
+ '-all,+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo,gpt-4-1106-preview=gpt-4-32k',
69
+ },
70
+ },
71
+ },
72
+ } as unknown as GlobalStore;
73
+
74
+ const result = settingsSelectors.modelList(s);
75
+
76
+ expect(result).toMatchSnapshot();
77
+ });
78
+
79
+ it('duplicate naming model', () => {
80
+ const s = {
81
+ settings: {
82
+ languageModel: {
83
+ openAI: {
84
+ customModelName: 'gpt-4-1106-preview=gpt-4-turbo,gpt-4-1106-preview=gpt-4-32k',
85
+ },
86
+ },
87
+ },
88
+ } as unknown as GlobalStore;
89
+
90
+ const result = settingsSelectors.modelList(s);
91
+
92
+ expect(result).toMatchSnapshot();
93
+ });
94
+
95
+ it('only add the model', () => {
96
+ const s = {
97
+ settings: {
98
+ languageModel: {
99
+ openAI: {
100
+ customModelName: 'model1,model2,model3,model4',
101
+ },
102
+ },
103
+ },
104
+ } as unknown as GlobalStore;
105
+
106
+ const result = settingsSelectors.modelList(s);
107
+
108
+ expect(result).toMatchSnapshot();
109
+ });
110
+ });
111
+
61
112
  // describe('defaultAgent', () => {
62
113
  // it('should merge DEFAULT_AGENT and s.settings.defaultAgent correctly', () => {
63
114
  // const s: GlobalStore = {
@@ -8,7 +8,7 @@ import {
8
8
  DEFAULT_TTS_CONFIG,
9
9
  } from '@/const/settings';
10
10
  import { Locales } from '@/locales/resources';
11
- import { GlobalSettings } from '@/types/settings';
11
+ import { CustomModels, GlobalSettings } from '@/types/settings';
12
12
  import { isOnServerSide } from '@/utils/env';
13
13
  import { merge } from '@/utils/merge';
14
14
 
@@ -29,10 +29,41 @@ const openAIAPIKeySelectors = (s: GlobalStore) =>
29
29
 
30
30
  const openAIProxyUrlSelectors = (s: GlobalStore) => s.settings.languageModel.openAI.endpoint;
31
31
 
32
- const modelListSelectors = (s: GlobalStore) => [
33
- ...DEFAULT_OPENAI_MODEL_LIST,
34
- ...(s.settings.languageModel.openAI.customModelName || '').split(',').filter(Boolean),
35
- ];
32
+ const modelListSelectors = (s: GlobalStore) => {
33
+ let models: CustomModels = [];
34
+
35
+ const modelNames = [
36
+ ...DEFAULT_OPENAI_MODEL_LIST,
37
+ ...(s.settings.languageModel.openAI.customModelName || '').split(/[,,]/).filter(Boolean),
38
+ ];
39
+
40
+ for (const item of modelNames) {
41
+ const disable = item.startsWith('-');
42
+ const nameConfig = item.startsWith('+') || item.startsWith('-') ? item.slice(1) : item;
43
+ const [name, displayName] = nameConfig.split('=');
44
+
45
+ if (disable) {
46
+ // Disable all models.
47
+ if (name === 'all') {
48
+ models = [];
49
+ }
50
+ continue;
51
+ }
52
+
53
+ // Remove duplicate model entries.
54
+ const existingIndex = models.findIndex(({ name: n }) => n === name);
55
+ if (existingIndex !== -1) {
56
+ models.splice(existingIndex, 1);
57
+ }
58
+
59
+ models.push({
60
+ displayName: displayName || name,
61
+ name,
62
+ });
63
+ }
64
+
65
+ return models;
66
+ };
36
67
 
37
68
  export const exportSettings = (s: GlobalStore) => {
38
69
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -45,6 +45,8 @@ export interface GlobalBaseSettings {
45
45
 
46
46
  export type GlobalDefaultAgent = Pick<LobeAgentSession, 'config' | 'meta'>;
47
47
 
48
+ export type CustomModels = { displayName: string; name: string }[];
49
+
48
50
  export interface OpenAIConfig {
49
51
  OPENAI_API_KEY: string;
50
52
  azureApiVersion?: string;