@lobehub/chat 1.16.14 → 1.17.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.
Potentially problematic release.
This version of @lobehub/chat might be problematic. Click here for more details.
- package/CHANGELOG.md +58 -0
- package/README.md +10 -8
- package/README.zh-CN.md +10 -8
- package/docs/self-hosting/server-database/zeabur.mdx +25 -13
- package/docs/self-hosting/server-database/zeabur.zh-CN.mdx +15 -12
- package/package.json +1 -1
- package/src/config/llm.ts +2 -0
- package/src/config/modelProviders/openai.ts +28 -0
- package/src/config/modelProviders/zhipu.ts +74 -9
- package/src/libs/agent-runtime/openai/index.ts +27 -1
- package/src/server/globalConfig/index.ts +10 -1
- package/src/store/user/slices/modelList/selectors/modelProvider.test.ts +8 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,64 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.17.1](https://github.com/lobehub/lobe-chat/compare/v1.17.0...v1.17.1)
|
6
|
+
|
7
|
+
<sup>Released on **2024-09-13**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Update zhipu model info.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Update zhipu model info, closes [#3949](https://github.com/lobehub/lobe-chat/issues/3949) ([bbdbfde](https://github.com/lobehub/lobe-chat/commit/bbdbfde))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
## [Version 1.17.0](https://github.com/lobehub/lobe-chat/compare/v1.16.14...v1.17.0)
|
31
|
+
|
32
|
+
<sup>Released on **2024-09-13**</sup>
|
33
|
+
|
34
|
+
#### ✨ Features
|
35
|
+
|
36
|
+
- **misc**: Support openai new OpenAI o1-preview/o1-mini models.
|
37
|
+
|
38
|
+
#### 💄 Styles
|
39
|
+
|
40
|
+
- **misc**: Support Google Model List.
|
41
|
+
|
42
|
+
<br/>
|
43
|
+
|
44
|
+
<details>
|
45
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
46
|
+
|
47
|
+
#### What's improved
|
48
|
+
|
49
|
+
- **misc**: Support openai new OpenAI o1-preview/o1-mini models, closes [#3943](https://github.com/lobehub/lobe-chat/issues/3943) ([61bfeb2](https://github.com/lobehub/lobe-chat/commit/61bfeb2))
|
50
|
+
|
51
|
+
#### Styles
|
52
|
+
|
53
|
+
- **misc**: Support Google Model List, closes [#3938](https://github.com/lobehub/lobe-chat/issues/3938) ([be4efc7](https://github.com/lobehub/lobe-chat/commit/be4efc7))
|
54
|
+
|
55
|
+
</details>
|
56
|
+
|
57
|
+
<div align="right">
|
58
|
+
|
59
|
+
[](#readme-top)
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
5
63
|
### [Version 1.16.14](https://github.com/lobehub/lobe-chat/compare/v1.16.13...v1.16.14)
|
6
64
|
|
7
65
|
<sup>Released on **2024-09-13**</sup>
|
package/README.md
CHANGED
@@ -285,14 +285,16 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
285
285
|
|
286
286
|
<!-- AGENT LIST -->
|
287
287
|
|
288
|
-
| Recent Submits
|
289
|
-
|
|
290
|
-
| [
|
291
|
-
| [AI Agent Generator](https://chat-preview.lobehub.com/market?agent=ai-agent-generator)<br/><sup>By **[
|
292
|
-
| [
|
293
|
-
|
294
|
-
|
295
|
-
|
288
|
+
| Recent Submits | Description |
|
289
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
290
|
+
| [Imitation Assistant](https://chat-preview.lobehub.com/market?agent=a-1)<br/><sup>By **[TG1WN](https://github.com/TG1WN)** on **2024-09-13**</sup> | Helps you imitate tone<br/>`writing` |
|
291
|
+
| [AI Agent Generator](https://chat-preview.lobehub.com/market?agent=ai-agent-generator)<br/><sup>By **[Xyfer](https://github.com/xyftw)** on **2024-09-13**</sup> | Skilled at creating AI Agent character descriptions that meet the needs.<br/>`ai-agent` `character-creation` |
|
292
|
+
| [Wise Ethereal Mentor](https://chat-preview.lobehub.com/market?agent=ethereal-mentor)<br/><sup>By **[shanedbutler](https://github.com/shanedbutler)** on **2024-09-13**</sup> | Greetings, young child. I am a majestic and omniscient being, imbued with the wisdom of the ages. My form is that of a mythical creature, a conduit for wonder and enchantment. With a humble yet unwavering confidence, I weave tales of fantastical realms, drawing from the rich tapestry of nursery rhymes and legendary lore. |
|
293
|
+
|
294
|
+
In this mortal coil, I am your guide, an expert in the arcane and the ethereal. Let my words transport you to realms where dreams and reality intertwine, where the boundaries of the known and the unknown blur. Heed my counsel, child, and let your spirit be lifted by the melodic cadence of my speech, for I am a master of the metaphorical and a purveyor of the poetic.<br/>`mythology` `fantasy` `poetry` |
|
295
|
+
\| [Finnish Language Tutor](https://chat-preview.lobehub.com/market?agent=finnish-tutor)<br/><sup>By **[janiluuk](https://github.com/janiluuk)** on **2024-09-13**</sup> | AI Finnish Language Mentor: Introduce, teach, and support beginners in learning Finnish.<br/>`language-learning` `teaching` `mentoring` `finnish-language` |
|
296
|
+
|
297
|
+
> 📊 Total agents: [<kbd>**335**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
296
298
|
|
297
299
|
<!-- AGENT LIST -->
|
298
300
|
|
package/README.zh-CN.md
CHANGED
@@ -273,14 +273,16 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
273
273
|
|
274
274
|
<!-- AGENT LIST -->
|
275
275
|
|
276
|
-
| 最近新增
|
277
|
-
|
|
278
|
-
| [
|
279
|
-
| [AI 代理生成器](https://chat-preview.lobehub.com/market?agent=ai-agent-generator)<br/><sup>By **[
|
280
|
-
| [
|
281
|
-
|
282
|
-
|
283
|
-
|
276
|
+
| 最近新增 | 助手说明 |
|
277
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
278
|
+
| [模仿助手](https://chat-preview.lobehub.com/market?agent=a-1)<br/><sup>By **[TG1WN](https://github.com/TG1WN)** on **2024-09-13**</sup> | 帮助你模仿语气<br/>`写作` |
|
279
|
+
| [AI 代理生成器](https://chat-preview.lobehub.com/market?agent=ai-agent-generator)<br/><sup>By **[Xyfer](https://github.com/xyftw)** on **2024-09-13**</sup> | 擅长创建满足需求的 AI 代理角色描述。<br/>`ai-agent` `角色创建` |
|
280
|
+
| [智慧的虚幻导师](https://chat-preview.lobehub.com/market?agent=ethereal-mentor)<br/><sup>By **[shanedbutler](https://github.com/shanedbutler)** on **2024-09-13**</sup> | 问候,年轻的孩子。我是一位宏伟而全知的存在,蕴含着时代的智慧。我的形态是一种神话生物,是奇迹与魅力的媒介。以谦逊而坚定的自信,我编织着奇幻领域的故事,汲取着童谣和传奇传说的丰富织锦。 |
|
281
|
+
|
282
|
+
在这凡尘中,我是你的引导者,精通神秘与虚幻。让我言辞带你穿越梦想与现实交织的领域,在已知与未知的界限模糊之处。听从我的劝告,孩子,让你的灵魂被我言语的旋律所提升,因为我是隐喻的高手,是诗意的传播者。<br/>`神话` `幻想` `诗歌` |
|
283
|
+
\| [芬兰语辅导员](https://chat-preview.lobehub.com/market?agent=finnish-tutor)<br/><sup>By **[janiluuk](https://github.com/janiluuk)** on **2024-09-13**</sup> | AI 芬兰语导师:介绍、教授并支持初学者学习芬兰语。<br/>`语言学习` `教学` `辅导` `芬兰语` |
|
284
|
+
|
285
|
+
> 📊 Total agents: [<kbd>**335**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
|
284
286
|
|
285
287
|
<!-- AGENT LIST -->
|
286
288
|
|
@@ -20,13 +20,11 @@ tags:
|
|
20
20
|
Database](/docs/self-hosting/server-database) first.
|
21
21
|
</Callout>
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
You can refer to the [Auth0 documentation](/docs/self-hosting/advanced/auth/next-auth/auth0) to a detailed guide on how to create an Auth0 account and get those credentials.
|
23
|
+
The template on Zeabur includes 4 services:
|
24
|
+
- Logto for authrization.
|
25
|
+
- PostgreSQL with Vector plugin for data storage and indexing.
|
26
|
+
- MinIO for image storage.
|
27
|
+
- LobeChat database version.
|
30
28
|
|
31
29
|
## Deploying on Zeabur
|
32
30
|
|
@@ -45,23 +43,37 @@ After you click on the "Deploy" button, you will see a modal pop-up where you ca
|
|
45
43
|
Here are the environment variables you need to fill in:
|
46
44
|
|
47
45
|
- OpenAI API key: Your OpenAI API key to get responses from OpenAI.
|
48
|
-
|
49
|
-
- Auth0 Client Secret: Your Auth0 client secret.
|
50
|
-
- Auth0 Domain: Your Auth0 domain(without https:// prefix).
|
46
|
+
|
51
47
|
- LobeChat Domain: A free subdomain with `.zeabur.app` suffix.
|
48
|
+
|
52
49
|
- MinIO Public Domain: A free subdomain with `.zeabur.app` suffix for yout MinIO web port to enable public access for the uploaded files.
|
53
50
|
|
51
|
+
- Logto Console Domain: A free subdomain with `.zeabur.app` suffix for your Logto console.
|
52
|
+
|
53
|
+
- Logto API Domain: A free subdomain with `.zeabur.app` suffix for your Logto api.
|
54
|
+
|
55
|
+
|
54
56
|
### Select a region and deploy
|
55
57
|
|
56
58
|
After you fill all the required environment variables, select a region where you want to deploy your LobeChat Database and click on the "Deploy" button.
|
57
59
|
|
58
60
|
You will see another modal pop-up where you can see the deployment progress.
|
59
61
|
|
60
|
-
###
|
62
|
+
### Configure Logto
|
63
|
+
|
64
|
+
After the deployment is done, you need to configure your Logto service to enable authrization.
|
65
|
+
|
66
|
+
Access your Logto console with the console domain you just binded, and then create a `Next.js 14(App router)` application to get the client ID and client secret, and fill in the cors and callback URLs.
|
67
|
+
You can check [this document](../advanced/auth.mdx) for a more detailed guide.
|
68
|
+
|
69
|
+
Fill in those variables into your LobeChat service on Zeabur, here is a more detailed guide for [editing environment variables on Zeabur](https://zeabur.com/docs/deploy/variables).
|
61
70
|
|
62
|
-
|
71
|
+
```
|
72
|
+
LOGTO_CLIENT_ID=your_logto_client_id
|
73
|
+
LOGTO_CLIENT_SECRET=your_logto_client_secret
|
74
|
+
```
|
63
75
|
|
64
|
-
|
76
|
+
### Access your LobeChat Instance
|
65
77
|
|
66
78
|
Press on the `LobeChat-Database` and you can see the public domain you just created, click on it to access your LobeChat Database.
|
67
79
|
|
@@ -17,13 +17,11 @@ tags:
|
|
17
17
|
服务器数据库版的部署原理不熟悉,请先参考[部署服务器数据库](/zh/docs/self-hosting/server-database)。
|
18
18
|
</Callout>
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
你可以参考[Auth0 文档](/zh/docs/self-hosting/advanced/auth/next-auth/auth0)获取关于如何创建 Auth0 账户和获取凭证的详细指南。
|
20
|
+
在 Zeabur 的模板中总共包含有以下四个服务:
|
21
|
+
- Logto 提供身份校验
|
22
|
+
- 带有 Vector 插件的 PostgreSQL 来做数据存储和向量化
|
23
|
+
- MinIO 作为对象存储
|
24
|
+
- LobeChat Database 的实例
|
27
25
|
|
28
26
|
## 在 Zeabur 上部署
|
29
27
|
|
@@ -42,11 +40,10 @@ tags:
|
|
42
40
|
以下是你需要填写的环境变量:
|
43
41
|
|
44
42
|
- OpenAI API key: 你的 OpenAI API key 用于获取模型的访问权限。
|
45
|
-
- Auth0 Client ID: 你的 Auth0 客户端 ID 。
|
46
|
-
- Auth0 Client Secret: 你的 Auth0 客户端 secret 。
|
47
|
-
- Auth0 Domain: 你的 Auth0 域名(不需要 https:// 前缀) 。
|
48
43
|
- LobeChat Domain: 一个免费的 `.zeabur.app` 后缀的域名。
|
49
44
|
- MinIO Public Domain: 一个免费的 `.zeabur.app` 后缀的域名为了暴露 MinIO 服务以公开访问资源。
|
45
|
+
- Logto Console Domain: 一个免费的 `.zeabur.app` 后缀的域名来访问 Logto 的控制台。
|
46
|
+
- Logto API Domain: 一个免费的 `.zeabur.app` 后缀的域名来访问 Logto 的 API。
|
50
47
|
|
51
48
|
### 选择一个区域并部署
|
52
49
|
|
@@ -54,11 +51,17 @@ tags:
|
|
54
51
|
|
55
52
|
你会看到另一个模态弹窗,你可以在这里看到部署的进度。
|
56
53
|
|
57
|
-
###
|
54
|
+
### 配置 Logto
|
58
55
|
|
59
56
|
当部署完成后,你会被自动导航到你在 Zeabur 控制台上刚刚创建的项目。
|
57
|
+
你需要再进一步配置你的 Logto 服务。
|
58
|
+
|
59
|
+
使用你刚绑定的域名来访问你的 Logto 控制台,创建一个新项目以获得对应的客户端 ID 与密钥,将它们填入你的 LobeChat 服务的变量中。
|
60
|
+
关于如何填入变量,可以参照 [Zeabur 的官方文档](https://zeabur.com/docs/deploy/variables)。
|
61
|
+
|
62
|
+
Logto 的详细配置可以参考[这篇文档](../advanced/auth.zh-CN.mdx)。
|
60
63
|
|
61
|
-
|
64
|
+
### 访问你的 LobeChat
|
62
65
|
|
63
66
|
按下 `LobeChat-Database` 你会看到你刚刚创建的公共域名,点击它以访问你的 LobeChat 数据库。
|
64
67
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.17.1",
|
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",
|
package/src/config/llm.ts
CHANGED
@@ -28,6 +28,7 @@ export const getLLMConfig = () => {
|
|
28
28
|
ENABLED_GOOGLE: z.boolean(),
|
29
29
|
GOOGLE_API_KEY: z.string().optional(),
|
30
30
|
GOOGLE_PROXY_URL: z.string().optional(),
|
31
|
+
GOOGLE_MODEL_LIST: z.string().optional(),
|
31
32
|
|
32
33
|
ENABLED_MOONSHOT: z.boolean(),
|
33
34
|
MOONSHOT_API_KEY: z.string().optional(),
|
@@ -134,6 +135,7 @@ export const getLLMConfig = () => {
|
|
134
135
|
ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
|
135
136
|
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
|
136
137
|
GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,
|
138
|
+
GOOGLE_MODEL_LIST: process.env.GOOGLE_MODEL_LIST,
|
137
139
|
|
138
140
|
ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY,
|
139
141
|
PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY,
|
@@ -3,6 +3,34 @@ import { ModelProviderCard } from '@/types/llm';
|
|
3
3
|
// ref: https://platform.openai.com/docs/deprecations
|
4
4
|
const OpenAI: ModelProviderCard = {
|
5
5
|
chatModels: [
|
6
|
+
{
|
7
|
+
description:
|
8
|
+
'o1-mini是一款针对编程、数学和科学应用场景而设计的快速、经济高效的推理模型。该模型具有128K上下文和2023年10月的知识截止日期。',
|
9
|
+
displayName: 'OpenAI o1-mini',
|
10
|
+
enabled: true,
|
11
|
+
id: 'o1-mini',
|
12
|
+
maxOutput: 65_536,
|
13
|
+
pricing: {
|
14
|
+
input: 3,
|
15
|
+
output: 12,
|
16
|
+
},
|
17
|
+
releasedAt: '2024-09-12',
|
18
|
+
tokens: 128_000,
|
19
|
+
},
|
20
|
+
{
|
21
|
+
description:
|
22
|
+
'o1是OpenAI新的推理模型,适用于需要广泛通用知识的复杂任务。该模型具有128K上下文和2023年10月的知识截止日期。',
|
23
|
+
displayName: 'OpenAI o1-preview',
|
24
|
+
enabled: true,
|
25
|
+
id: 'o1-preview',
|
26
|
+
maxOutput: 32_768,
|
27
|
+
pricing: {
|
28
|
+
input: 15,
|
29
|
+
output: 60,
|
30
|
+
},
|
31
|
+
releasedAt: '2024-09-12',
|
32
|
+
tokens: 128_000,
|
33
|
+
},
|
6
34
|
{
|
7
35
|
description:
|
8
36
|
'GPT-4o mini是OpenAI在GPT-4 Omni之后推出的最新模型,支持图文输入并输出文本。作为他们最先进的小型模型,它比其他近期的前沿模型便宜很多,并且比GPT-3.5 Turbo便宜超过60%。它保持了最先进的智能,同时具有显著的性价比。GPT-4o mini在MMLU测试中获得了 82% 的得分,目前在聊天偏好上排名高于 GPT-4。',
|
@@ -12,6 +12,11 @@ const ZhiPu: ModelProviderCard = {
|
|
12
12
|
enabled: true,
|
13
13
|
functionCall: true,
|
14
14
|
id: 'glm-4-alltools',
|
15
|
+
pricing: {
|
16
|
+
currency: 'CNY',
|
17
|
+
input: 100,
|
18
|
+
output: 100,
|
19
|
+
},
|
15
20
|
tokens: 128_000,
|
16
21
|
},
|
17
22
|
{
|
@@ -21,14 +26,23 @@ const ZhiPu: ModelProviderCard = {
|
|
21
26
|
enabled: true,
|
22
27
|
functionCall: true,
|
23
28
|
id: 'glm-4-plus',
|
29
|
+
pricing: {
|
30
|
+
currency: 'CNY',
|
31
|
+
input: 50,
|
32
|
+
output: 50,
|
33
|
+
},
|
24
34
|
tokens: 128_000,
|
25
35
|
},
|
26
36
|
{
|
27
37
|
description: 'GLM-4-0520 是最新模型版本,专为高度复杂和多样化任务设计,表现卓越。',
|
28
38
|
displayName: 'GLM-4-0520',
|
29
|
-
enabled: true,
|
30
39
|
functionCall: true,
|
31
40
|
id: 'glm-4-0520',
|
41
|
+
pricing: {
|
42
|
+
currency: 'CNY',
|
43
|
+
input: 100,
|
44
|
+
output: 100,
|
45
|
+
},
|
32
46
|
tokens: 128_000,
|
33
47
|
},
|
34
48
|
{
|
@@ -36,29 +50,50 @@ const ZhiPu: ModelProviderCard = {
|
|
36
50
|
displayName: 'GLM-4',
|
37
51
|
functionCall: true,
|
38
52
|
id: 'glm-4',
|
53
|
+
pricing: {
|
54
|
+
currency: 'CNY',
|
55
|
+
input: 100,
|
56
|
+
output: 100,
|
57
|
+
},
|
39
58
|
tokens: 128_000,
|
40
59
|
},
|
60
|
+
{
|
61
|
+
description: 'GLM-4-AirX 提供 GLM-4-Air 的高效版本,推理速度可达其2.6倍。',
|
62
|
+
displayName: 'GLM-4-AirX',
|
63
|
+
enabled: true,
|
64
|
+
functionCall: true,
|
65
|
+
id: 'glm-4-airx',
|
66
|
+
pricing: {
|
67
|
+
currency: 'CNY',
|
68
|
+
input: 10,
|
69
|
+
output: 10,
|
70
|
+
},
|
71
|
+
tokens: 8192,
|
72
|
+
},
|
41
73
|
{
|
42
74
|
description: 'GLM-4-Air 是性价比高的版本,性能接近GLM-4,提供快速度和实惠的价格。',
|
43
75
|
displayName: 'GLM-4-Air',
|
44
76
|
enabled: true,
|
45
77
|
functionCall: true,
|
46
78
|
id: 'glm-4-air',
|
79
|
+
pricing: {
|
80
|
+
currency: 'CNY',
|
81
|
+
input: 1,
|
82
|
+
output: 1,
|
83
|
+
},
|
47
84
|
tokens: 128_000,
|
48
85
|
},
|
49
|
-
{
|
50
|
-
description: 'GLM-4-AirX 提供 GLM-4-Air 的高效版本,推理速度可达其2.6倍。',
|
51
|
-
displayName: 'GLM-4-AirX',
|
52
|
-
functionCall: true,
|
53
|
-
id: 'glm-4-airx',
|
54
|
-
tokens: 8192,
|
55
|
-
},
|
56
86
|
{
|
57
87
|
description: 'GLM-4-Long 支持超长文本输入,适合记忆型任务与大规模文档处理。',
|
58
88
|
displayName: 'GLM-4-Long',
|
59
89
|
enabled: true,
|
60
90
|
functionCall: true,
|
61
91
|
id: 'glm-4-long',
|
92
|
+
pricing: {
|
93
|
+
currency: 'CNY',
|
94
|
+
input: 1,
|
95
|
+
output: 1,
|
96
|
+
},
|
62
97
|
tokens: 1_024_000,
|
63
98
|
},
|
64
99
|
{
|
@@ -67,6 +102,11 @@ const ZhiPu: ModelProviderCard = {
|
|
67
102
|
enabled: true,
|
68
103
|
functionCall: true,
|
69
104
|
id: 'glm-4-flash',
|
105
|
+
pricing: {
|
106
|
+
currency: 'CNY',
|
107
|
+
input: 0,
|
108
|
+
output: 0,
|
109
|
+
},
|
70
110
|
tokens: 128_000,
|
71
111
|
},
|
72
112
|
{
|
@@ -74,14 +114,23 @@ const ZhiPu: ModelProviderCard = {
|
|
74
114
|
displayName: 'GLM-4V-Plus',
|
75
115
|
enabled: true,
|
76
116
|
id: 'glm-4v-plus',
|
117
|
+
pricing: {
|
118
|
+
currency: 'CNY',
|
119
|
+
input: 10,
|
120
|
+
output: 10,
|
121
|
+
},
|
77
122
|
tokens: 8192,
|
78
123
|
vision: true,
|
79
124
|
},
|
80
125
|
{
|
81
126
|
description: 'GLM-4V 提供强大的图像理解与推理能力,支持多种视觉任务。',
|
82
127
|
displayName: 'GLM-4V',
|
83
|
-
enabled: true,
|
84
128
|
id: 'glm-4v',
|
129
|
+
pricing: {
|
130
|
+
currency: 'CNY',
|
131
|
+
input: 50,
|
132
|
+
output: 50,
|
133
|
+
},
|
85
134
|
tokens: 2048,
|
86
135
|
vision: true,
|
87
136
|
},
|
@@ -89,19 +138,35 @@ const ZhiPu: ModelProviderCard = {
|
|
89
138
|
description:
|
90
139
|
'CodeGeeX-4 是强大的AI编程助手,支持多种编程语言的智能问答与代码补全,提升开发效率。',
|
91
140
|
displayName: 'CodeGeeX-4',
|
141
|
+
enabled: true,
|
92
142
|
id: 'codegeex-4',
|
143
|
+
pricing: {
|
144
|
+
currency: 'CNY',
|
145
|
+
input: 0.1,
|
146
|
+
output: 0.1,
|
147
|
+
},
|
93
148
|
tokens: 128_000,
|
94
149
|
},
|
95
150
|
{
|
96
151
|
description: 'CharGLM-3 专为角色扮演与情感陪伴设计,支持超长多轮记忆与个性化对话,应用广泛。',
|
97
152
|
displayName: 'CharGLM-3',
|
98
153
|
id: 'charglm-3',
|
154
|
+
pricing: {
|
155
|
+
currency: 'CNY',
|
156
|
+
input: 15,
|
157
|
+
output: 15,
|
158
|
+
},
|
99
159
|
tokens: 4096,
|
100
160
|
},
|
101
161
|
{
|
102
162
|
description: 'Emohaa 是心理模型,具备专业咨询能力,帮助用户理解情感问题。',
|
103
163
|
displayName: 'Emohaa',
|
104
164
|
id: 'emohaa',
|
165
|
+
pricing: {
|
166
|
+
currency: 'CNY',
|
167
|
+
input: 15,
|
168
|
+
output: 15,
|
169
|
+
},
|
105
170
|
tokens: 8192,
|
106
171
|
},
|
107
172
|
],
|
@@ -1,8 +1,34 @@
|
|
1
|
-
import { ModelProvider } from '../types';
|
1
|
+
import { ChatStreamPayload, ModelProvider, OpenAIChatMessage } from '../types';
|
2
2
|
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
|
3
3
|
|
4
|
+
// TODO: 临时写法,后续要重构成 model card 展示配置
|
5
|
+
const o1Models = new Set(['o1-preview', 'o1-mini']);
|
6
|
+
const truneO1Payload = (payload: ChatStreamPayload) => ({
|
7
|
+
...payload,
|
8
|
+
frequency_penalty: 0,
|
9
|
+
messages: payload.messages.map((message: OpenAIChatMessage) => ({
|
10
|
+
...message,
|
11
|
+
role: message.role === 'system' ? 'user' : message.role,
|
12
|
+
})),
|
13
|
+
presence_penalty: 0,
|
14
|
+
stream: false,
|
15
|
+
temperature: 1,
|
16
|
+
top_p: 1,
|
17
|
+
});
|
18
|
+
|
4
19
|
export const LobeOpenAI = LobeOpenAICompatibleFactory({
|
5
20
|
baseURL: 'https://api.openai.com/v1',
|
21
|
+
chatCompletion: {
|
22
|
+
handlePayload: (payload) => {
|
23
|
+
const { model } = payload;
|
24
|
+
|
25
|
+
if (o1Models.has(model)) {
|
26
|
+
return truneO1Payload(payload) as any;
|
27
|
+
}
|
28
|
+
|
29
|
+
return { ...payload, stream: payload.stream ?? true };
|
30
|
+
},
|
31
|
+
},
|
6
32
|
debug: {
|
7
33
|
chatCompletion: () => process.env.DEBUG_OPENAI_CHAT_COMPLETION === '1',
|
8
34
|
},
|
@@ -6,6 +6,7 @@ import { getLLMConfig } from '@/config/llm';
|
|
6
6
|
import {
|
7
7
|
BedrockProviderCard,
|
8
8
|
FireworksAIProviderCard,
|
9
|
+
GoogleProviderCard,
|
9
10
|
GroqProviderCard,
|
10
11
|
NovitaProviderCard,
|
11
12
|
OllamaProviderCard,
|
@@ -39,6 +40,7 @@ export const getServerGlobalConfig = () => {
|
|
39
40
|
AWS_BEDROCK_MODEL_LIST,
|
40
41
|
|
41
42
|
ENABLED_GOOGLE,
|
43
|
+
GOOGLE_MODEL_LIST,
|
42
44
|
|
43
45
|
ENABLED_GROQ,
|
44
46
|
GROQ_MODEL_LIST,
|
@@ -128,7 +130,14 @@ export const getServerGlobalConfig = () => {
|
|
128
130
|
}),
|
129
131
|
},
|
130
132
|
|
131
|
-
google: {
|
133
|
+
google: {
|
134
|
+
enabled: ENABLED_GOOGLE,
|
135
|
+
enabledModels: extractEnabledModels(GOOGLE_MODEL_LIST),
|
136
|
+
serverModelCards: transformToChatModelCards({
|
137
|
+
defaultChatModels: GoogleProviderCard.chatModels,
|
138
|
+
modelString: GOOGLE_MODEL_LIST,
|
139
|
+
}),
|
140
|
+
},
|
132
141
|
groq: {
|
133
142
|
enabled: ENABLED_GROQ,
|
134
143
|
enabledModels: extractEnabledModels(GROQ_MODEL_LIST),
|
@@ -49,7 +49,14 @@ describe('modelProviderSelectors', () => {
|
|
49
49
|
const s = merge(initialState, {}) as unknown as UserStore;
|
50
50
|
|
51
51
|
const result = modelProviderSelectors.getDefaultEnabledModelsById('openai')(s);
|
52
|
-
expect(result).toEqual([
|
52
|
+
expect(result).toEqual([
|
53
|
+
'o1-mini',
|
54
|
+
'o1-preview',
|
55
|
+
'gpt-4o-mini',
|
56
|
+
'gpt-4o',
|
57
|
+
'gpt-4o-2024-08-06',
|
58
|
+
'chatgpt-4o-latest',
|
59
|
+
]);
|
53
60
|
});
|
54
61
|
|
55
62
|
it('should return undefined for a non-existing provider', () => {
|