@lobehub/chat 1.19.32 → 1.19.34
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/next.config.mjs +5 -0
- package/package.json +1 -1
- package/src/app/robots.tsx +26 -7
- package/src/config/modelProviders/google.ts +53 -62
- package/src/libs/agent-runtime/minimax/index.test.ts +4 -4
- package/src/libs/agent-runtime/minimax/index.ts +16 -6
- package/src/libs/agent-runtime/utils/streams/minimax.test.ts +24 -0
- package/src/libs/agent-runtime/utils/streams/minimax.ts +15 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.19.34](https://github.com/lobehub/lobe-chat/compare/v1.19.33...v1.19.34)
|
6
|
+
|
7
|
+
<sup>Released on **2024-09-26**</sup>
|
8
|
+
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<details>
|
12
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
13
|
+
|
14
|
+
</details>
|
15
|
+
|
16
|
+
<div align="right">
|
17
|
+
|
18
|
+
[](#readme-top)
|
19
|
+
|
20
|
+
</div>
|
21
|
+
|
22
|
+
### [Version 1.19.33](https://github.com/lobehub/lobe-chat/compare/v1.19.32...v1.19.33)
|
23
|
+
|
24
|
+
<sup>Released on **2024-09-25**</sup>
|
25
|
+
|
26
|
+
#### 🐛 Bug Fixes
|
27
|
+
|
28
|
+
- **misc**: MiniMax output long content interrupted by non-existent error.
|
29
|
+
|
30
|
+
#### 💄 Styles
|
31
|
+
|
32
|
+
- **misc**: Update google provider model info.
|
33
|
+
|
34
|
+
<br/>
|
35
|
+
|
36
|
+
<details>
|
37
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
38
|
+
|
39
|
+
#### What's fixed
|
40
|
+
|
41
|
+
- **misc**: MiniMax output long content interrupted by non-existent error, closes [#4088](https://github.com/lobehub/lobe-chat/issues/4088) ([4f6e20d](https://github.com/lobehub/lobe-chat/commit/4f6e20d))
|
42
|
+
|
43
|
+
#### Styles
|
44
|
+
|
45
|
+
- **misc**: Update google provider model info, closes [#4129](https://github.com/lobehub/lobe-chat/issues/4129) ([b1442b9](https://github.com/lobehub/lobe-chat/commit/b1442b9))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.19.32](https://github.com/lobehub/lobe-chat/compare/v1.19.31...v1.19.32)
|
6
56
|
|
7
57
|
<sup>Released on **2024-09-25**</sup>
|
package/next.config.mjs
CHANGED
@@ -112,6 +112,11 @@ const nextConfig = {
|
|
112
112
|
permanent: true,
|
113
113
|
source: '/sitemap.xml',
|
114
114
|
},
|
115
|
+
{
|
116
|
+
destination: '/sitemap-index.xml',
|
117
|
+
permanent: true,
|
118
|
+
source: '/sitemap-0.xml',
|
119
|
+
},
|
115
120
|
{
|
116
121
|
destination: '/manifest.webmanifest',
|
117
122
|
permanent: true,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.19.
|
3
|
+
"version": "1.19.34",
|
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/app/robots.tsx
CHANGED
@@ -3,14 +3,33 @@ import { MetadataRoute } from 'next';
|
|
3
3
|
import { sitemapModule } from '@/server/sitemap';
|
4
4
|
import { getCanonicalUrl } from '@/server/utils/url';
|
5
5
|
|
6
|
-
|
6
|
+
const robots = (): MetadataRoute.Robots => {
|
7
7
|
return {
|
8
8
|
host: getCanonicalUrl(),
|
9
|
-
rules:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
rules: [
|
10
|
+
{
|
11
|
+
allow: ['/discover/*'],
|
12
|
+
disallow: ['/discover/search/*'],
|
13
|
+
userAgent: ['Facebot', 'facebookexternalhit'],
|
14
|
+
},
|
15
|
+
{
|
16
|
+
allow: ['/discover/*'],
|
17
|
+
disallow: ['/discover/search/*'],
|
18
|
+
userAgent: 'LinkedInBot',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
allow: ['/discover/*'],
|
22
|
+
disallow: ['/discover/search/*'],
|
23
|
+
userAgent: 'Twitterbot',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
allow: ['/'],
|
27
|
+
disallow: ['/api/*', '/login', '/signup', '/files', '/repos/*', '/discover/search/*'],
|
28
|
+
userAgent: '*',
|
29
|
+
},
|
30
|
+
],
|
14
31
|
sitemap: sitemapModule.getRobots(),
|
15
32
|
};
|
16
|
-
}
|
33
|
+
};
|
34
|
+
|
35
|
+
export default robots;
|
@@ -16,78 +16,69 @@ const Google: ModelProviderCard = {
|
|
16
16
|
input: 0.075,
|
17
17
|
output: 0.3,
|
18
18
|
},
|
19
|
-
tokens:
|
19
|
+
tokens: 1_000_000 + 8192,
|
20
20
|
vision: true,
|
21
21
|
},
|
22
22
|
{
|
23
|
-
description: 'Gemini 1.5 Flash
|
24
|
-
displayName: 'Gemini 1.5 Flash
|
23
|
+
description: 'Gemini 1.5 Flash 002 是一款高效的多模态模型,支持广泛应用的扩展。',
|
24
|
+
displayName: 'Gemini 1.5 Flash 002',
|
25
|
+
enabled: true,
|
25
26
|
functionCall: true,
|
26
|
-
id: 'gemini-1.5-flash-
|
27
|
+
id: 'gemini-1.5-flash-002',
|
27
28
|
maxOutput: 8192,
|
28
29
|
pricing: {
|
29
30
|
cachedInput: 0.018_75,
|
30
31
|
input: 0.075,
|
31
32
|
output: 0.3,
|
32
33
|
},
|
33
|
-
releasedAt: '2024-
|
34
|
-
tokens:
|
35
|
-
vision: true,
|
36
|
-
},
|
37
|
-
{
|
38
|
-
description: 'Gemini 1.5 Flash 8B 0827 专为处理大规模任务场景设计,提供无与伦比的处理速度。',
|
39
|
-
displayName: 'Gemini 1.5 Flash 8B 0827',
|
40
|
-
functionCall: true,
|
41
|
-
id: 'gemini-1.5-flash-8b-exp-0827',
|
42
|
-
maxOutput: 8192,
|
43
|
-
releasedAt: '2024-08-27',
|
44
|
-
tokens: 1_048_576 + 8192,
|
34
|
+
releasedAt: '2024-09-25',
|
35
|
+
tokens: 1_000_000 + 8192,
|
45
36
|
vision: true,
|
46
37
|
},
|
47
38
|
{
|
48
|
-
description:
|
49
|
-
|
50
|
-
displayName: 'Gemini 1.5 Flash 8B 0924',
|
51
|
-
enabled: true,
|
39
|
+
description: 'Gemini 1.5 Flash 001 是一款高效的多模态模型,支持广泛应用的扩展。',
|
40
|
+
displayName: 'Gemini 1.5 Flash 001',
|
52
41
|
functionCall: true,
|
53
|
-
id: 'gemini-1.5-flash-
|
42
|
+
id: 'gemini-1.5-flash-001',
|
54
43
|
maxOutput: 8192,
|
55
44
|
pricing: {
|
56
45
|
cachedInput: 0.018_75,
|
57
46
|
input: 0.075,
|
58
47
|
output: 0.3,
|
59
48
|
},
|
60
|
-
|
61
|
-
tokens: 1_048_576 + 8192,
|
49
|
+
tokens: 1_000_000 + 8192,
|
62
50
|
vision: true,
|
63
51
|
},
|
64
52
|
{
|
65
|
-
description: 'Gemini 1.5 Flash
|
66
|
-
displayName: 'Gemini 1.5 Flash
|
53
|
+
description: 'Gemini 1.5 Flash 0827 提供了优化后的多模态处理能力,适用多种复杂任务场景。',
|
54
|
+
displayName: 'Gemini 1.5 Flash 0827',
|
67
55
|
functionCall: true,
|
68
|
-
id: 'gemini-1.5-flash-
|
56
|
+
id: 'gemini-1.5-flash-exp-0827',
|
69
57
|
maxOutput: 8192,
|
70
58
|
pricing: {
|
71
59
|
cachedInput: 0.018_75,
|
72
60
|
input: 0.075,
|
73
61
|
output: 0.3,
|
74
62
|
},
|
75
|
-
|
63
|
+
releasedAt: '2024-08-27',
|
64
|
+
tokens: 1_000_000 + 8192,
|
76
65
|
vision: true,
|
77
66
|
},
|
67
|
+
|
78
68
|
{
|
79
|
-
description:
|
80
|
-
|
69
|
+
description:
|
70
|
+
'Gemini 1.5 Flash 8B 0924 是最新的实验性模型,在文本和多模态用例中都有显著的性能提升。',
|
71
|
+
displayName: 'Gemini 1.5 Flash 8B 0924',
|
81
72
|
functionCall: true,
|
82
|
-
id: 'gemini-1.5-flash-
|
73
|
+
id: 'gemini-1.5-flash-8b-exp-0924',
|
83
74
|
maxOutput: 8192,
|
84
75
|
pricing: {
|
85
76
|
cachedInput: 0.018_75,
|
86
77
|
input: 0.075,
|
87
78
|
output: 0.3,
|
88
79
|
},
|
89
|
-
releasedAt: '2024-09-
|
90
|
-
tokens:
|
80
|
+
releasedAt: '2024-09-24',
|
81
|
+
tokens: 1_000_000 + 8192,
|
91
82
|
vision: true,
|
92
83
|
},
|
93
84
|
{
|
@@ -104,69 +95,69 @@ const Google: ModelProviderCard = {
|
|
104
95
|
output: 10.5,
|
105
96
|
},
|
106
97
|
releasedAt: '2024-02-15',
|
107
|
-
tokens:
|
98
|
+
tokens: 2_000_000 + 8192,
|
108
99
|
vision: true,
|
109
100
|
},
|
110
101
|
{
|
111
|
-
description:
|
112
|
-
|
102
|
+
description:
|
103
|
+
'Gemini 1.5 Pro 002 是最新的生产就绪模型,提供更高质量的输出,特别在数学、长上下文和视觉任务方面有显著提升。',
|
104
|
+
displayName: 'Gemini 1.5 Pro 002',
|
105
|
+
enabled: true,
|
113
106
|
functionCall: true,
|
114
|
-
id: 'gemini-1.5-pro-
|
107
|
+
id: 'gemini-1.5-pro-002',
|
115
108
|
maxOutput: 8192,
|
116
109
|
pricing: {
|
117
|
-
cachedInput: 0.
|
118
|
-
input:
|
119
|
-
output:
|
110
|
+
cachedInput: 0.315,
|
111
|
+
input: 1.25,
|
112
|
+
output: 2.5,
|
120
113
|
},
|
121
|
-
releasedAt: '2024-
|
122
|
-
tokens:
|
114
|
+
releasedAt: '2024-09-24',
|
115
|
+
tokens: 2_000_000 + 8192,
|
123
116
|
vision: true,
|
124
117
|
},
|
125
118
|
{
|
126
|
-
description: 'Gemini 1.5 Pro
|
127
|
-
displayName: 'Gemini 1.5 Pro
|
119
|
+
description: 'Gemini 1.5 Pro 001 是可扩展的多模态AI解决方案,支持广泛的复杂任务。',
|
120
|
+
displayName: 'Gemini 1.5 Pro 001',
|
128
121
|
functionCall: true,
|
129
|
-
id: 'gemini-1.5-pro-
|
122
|
+
id: 'gemini-1.5-pro-001',
|
130
123
|
maxOutput: 8192,
|
131
124
|
pricing: {
|
132
125
|
cachedInput: 0.875,
|
133
126
|
input: 3.5,
|
134
127
|
output: 10.5,
|
135
128
|
},
|
136
|
-
releasedAt: '2024-
|
137
|
-
tokens:
|
129
|
+
releasedAt: '2024-02-15',
|
130
|
+
tokens: 2_000_000 + 8192,
|
138
131
|
vision: true,
|
139
132
|
},
|
140
133
|
{
|
141
|
-
description: 'Gemini 1.5 Pro
|
142
|
-
displayName: 'Gemini 1.5 Pro
|
134
|
+
description: 'Gemini 1.5 Pro 0827 结合最新优化技术,带来更高效的多模态数据处理能力。',
|
135
|
+
displayName: 'Gemini 1.5 Pro 0827',
|
143
136
|
functionCall: true,
|
144
|
-
id: 'gemini-1.5-pro-
|
137
|
+
id: 'gemini-1.5-pro-exp-0827',
|
145
138
|
maxOutput: 8192,
|
146
139
|
pricing: {
|
147
140
|
cachedInput: 0.875,
|
148
141
|
input: 3.5,
|
149
142
|
output: 10.5,
|
150
143
|
},
|
151
|
-
releasedAt: '2024-
|
152
|
-
tokens:
|
144
|
+
releasedAt: '2024-08-27',
|
145
|
+
tokens: 2_000_000 + 8192,
|
153
146
|
vision: true,
|
154
147
|
},
|
155
148
|
{
|
156
|
-
description:
|
157
|
-
|
158
|
-
displayName: 'Gemini 1.5 Pro 002',
|
159
|
-
enabled: true,
|
149
|
+
description: 'Gemini 1.5 Pro 0801 提供出色的多模态处理能力,为应用开发带来更大灵活性。',
|
150
|
+
displayName: 'Gemini 1.5 Pro 0801',
|
160
151
|
functionCall: true,
|
161
|
-
id: 'gemini-1.5-pro-
|
152
|
+
id: 'gemini-1.5-pro-exp-0801',
|
162
153
|
maxOutput: 8192,
|
163
154
|
pricing: {
|
164
|
-
cachedInput: 0.
|
165
|
-
input:
|
166
|
-
output:
|
155
|
+
cachedInput: 0.875,
|
156
|
+
input: 3.5,
|
157
|
+
output: 10.5,
|
167
158
|
},
|
168
|
-
releasedAt: '2024-
|
169
|
-
tokens:
|
159
|
+
releasedAt: '2024-08-01',
|
160
|
+
tokens: 2_000_000 + 8192,
|
170
161
|
vision: true,
|
171
162
|
},
|
172
163
|
{
|
@@ -210,7 +201,7 @@ const Google: ModelProviderCard = {
|
|
210
201
|
],
|
211
202
|
checkModel: 'gemini-1.5-flash-latest',
|
212
203
|
description:
|
213
|
-
'Google 的 Gemini 系列是其最先进、通用的
|
204
|
+
'Google 的 Gemini 系列是其最先进、通用的 AI模型,由 Google DeepMind 打造,专为多模态设计,支持文本、代码、图像、音频和视频的无缝理解与处理。适用于从数据中心到移动设备的多种环境,极大提升了AI模型的效率与应用广泛性。',
|
214
205
|
id: 'google',
|
215
206
|
modelsUrl: 'https://ai.google.dev/gemini-api/docs/models/gemini',
|
216
207
|
name: 'Google',
|
@@ -253,10 +253,10 @@ describe('LobeMinimaxAI', () => {
|
|
253
253
|
});
|
254
254
|
});
|
255
255
|
|
256
|
-
it('should include max tokens when model is abab6.
|
256
|
+
it('should include max tokens when model is abab6.5t-chat', () => {
|
257
257
|
const payload: ChatStreamPayload = {
|
258
258
|
messages: [{ content: 'Hello', role: 'user' }],
|
259
|
-
model: 'abab6.
|
259
|
+
model: 'abab6.5t-chat',
|
260
260
|
temperature: 0,
|
261
261
|
top_p: 0,
|
262
262
|
};
|
@@ -265,9 +265,9 @@ describe('LobeMinimaxAI', () => {
|
|
265
265
|
|
266
266
|
expect(result).toEqual({
|
267
267
|
messages: [{ content: 'Hello', role: 'user' }],
|
268
|
-
model: 'abab6.
|
268
|
+
model: 'abab6.5t-chat',
|
269
269
|
stream: true,
|
270
|
-
max_tokens:
|
270
|
+
max_tokens: 4096,
|
271
271
|
});
|
272
272
|
});
|
273
273
|
});
|
@@ -127,9 +127,14 @@ export class LobeMinimaxAI implements LobeRuntimeAI {
|
|
127
127
|
// https://www.minimaxi.com/document/guides/chat-model/V2
|
128
128
|
private getMaxTokens(model: string): number | undefined {
|
129
129
|
switch (model) {
|
130
|
-
case 'abab6.
|
130
|
+
case 'abab6.5t-chat':
|
131
|
+
case 'abab6.5g-chat':
|
132
|
+
case 'abab5.5s-chat':
|
133
|
+
case 'abab5.5-chat':{
|
134
|
+
return 4096;
|
135
|
+
}
|
131
136
|
case 'abab6.5s-chat': {
|
132
|
-
return
|
137
|
+
return 8192;
|
133
138
|
}
|
134
139
|
}
|
135
140
|
}
|
@@ -139,12 +144,17 @@ export class LobeMinimaxAI implements LobeRuntimeAI {
|
|
139
144
|
|
140
145
|
return {
|
141
146
|
...params,
|
142
|
-
|
147
|
+
frequency_penalty: undefined,
|
148
|
+
max_tokens:
|
149
|
+
payload.max_tokens !== undefined
|
150
|
+
? payload.max_tokens
|
151
|
+
: this.getMaxTokens(payload.model),
|
152
|
+
presence_penalty: undefined,
|
143
153
|
stream: true,
|
144
154
|
temperature:
|
145
|
-
|
146
|
-
|
147
|
-
|
155
|
+
temperature === undefined || temperature <= 0
|
156
|
+
? undefined
|
157
|
+
: temperature / 2,
|
148
158
|
|
149
159
|
tools: params.tools?.map((tool) => ({
|
150
160
|
function: {
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
2
|
+
import { processDoubleData } from './minimax'; // 假设文件名为 minimax.ts
|
3
|
+
|
4
|
+
describe('processDoubleData', () => {
|
5
|
+
it('should remove the second "data: {"id": and everything after it when matchCount is 2', () => {
|
6
|
+
const chunkValue = `data: {"id":"first"} some other text
|
7
|
+
|
8
|
+
data: {"id":"second"} more text`;
|
9
|
+
const result = processDoubleData(chunkValue);
|
10
|
+
expect(result).toBe('data: {"id":"first"} some other text');
|
11
|
+
});
|
12
|
+
|
13
|
+
it('should not modify chunkValue when matchCount is not 2', () => {
|
14
|
+
const chunkValue = `data: {"id":"first"} some other text`;
|
15
|
+
const result = processDoubleData(chunkValue);
|
16
|
+
expect(result).toBe(chunkValue);
|
17
|
+
});
|
18
|
+
|
19
|
+
it('should not modify chunkValue when matchCount is more than 2', () => {
|
20
|
+
const chunkValue = `data: {"id":"first"} some other text data: {"id":"second"} more text data: {"id":"third"} even more text`;
|
21
|
+
const result = processDoubleData(chunkValue);
|
22
|
+
expect(result).toBe(chunkValue);
|
23
|
+
});
|
24
|
+
});
|
@@ -4,6 +4,19 @@ import { ChatStreamCallbacks } from '../../types';
|
|
4
4
|
import { transformOpenAIStream } from './openai';
|
5
5
|
import { createCallbacksTransformer, createSSEProtocolTransformer } from './protocol';
|
6
6
|
|
7
|
+
export const processDoubleData = (chunkValue: string): string => {
|
8
|
+
const dataPattern = /data: {"id":"/g;
|
9
|
+
const matchCount = (chunkValue.match(dataPattern) || []).length;
|
10
|
+
let modifiedChunkValue = chunkValue;
|
11
|
+
if (matchCount === 2) {
|
12
|
+
const secondDataIdIndex = chunkValue.indexOf('data: {"id":', chunkValue.indexOf('data: {"id":') + 1);
|
13
|
+
if (secondDataIdIndex !== -1) {
|
14
|
+
modifiedChunkValue = chunkValue.slice(0, secondDataIdIndex).trim();
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return modifiedChunkValue;
|
18
|
+
};
|
19
|
+
|
7
20
|
const unit8ArrayToJSONChunk = (unit8Array: Uint8Array): OpenAI.ChatCompletionChunk => {
|
8
21
|
const decoder = new TextDecoder();
|
9
22
|
|
@@ -12,6 +25,8 @@ const unit8ArrayToJSONChunk = (unit8Array: Uint8Array): OpenAI.ChatCompletionChu
|
|
12
25
|
// chunkValue example:
|
13
26
|
// data: {"id":"028a65377137d57aaceeffddf48ae99f","choices":[{"finish_reason":"tool_calls","index":0,"delta":{"role":"assistant","tool_calls":[{"id":"call_function_7371372822","type":"function","function":{"name":"realtime-weather____fetchCurrentWeather","arguments":"{\"city\": [\"杭州\", \"北京\"]}"}}]}}],"created":155511,"model":"abab6.5s-chat","object":"chat.completion.chunk"}
|
14
27
|
|
28
|
+
chunkValue = processDoubleData(chunkValue);
|
29
|
+
|
15
30
|
// so we need to remove `data:` prefix and then parse it as JSON
|
16
31
|
if (chunkValue.startsWith('data:')) {
|
17
32
|
chunkValue = chunkValue.slice(5).trim();
|