@lobehub/chat 1.51.6 → 1.51.8
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.ja-JP.md +8 -8
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/changelog/v1.json +18 -0
- package/package.json +1 -1
- package/src/app/(backend)/webapi/chat/models/[provider]/route.ts +1 -1
- package/src/config/aiModels/qwen.ts +101 -2
- package/src/libs/agent-runtime/ai360/index.ts +8 -1
- package/src/libs/agent-runtime/anthropic/index.ts +2 -1
- package/src/libs/agent-runtime/baichuan/index.ts +1 -1
- package/src/libs/agent-runtime/cloudflare/index.test.ts +0 -117
- package/src/libs/agent-runtime/cloudflare/index.ts +32 -11
- package/src/libs/agent-runtime/deepseek/index.ts +4 -1
- package/src/libs/agent-runtime/fireworksai/index.ts +8 -1
- package/src/libs/agent-runtime/giteeai/index.ts +9 -1
- package/src/libs/agent-runtime/github/index.test.ts +5 -16
- package/src/libs/agent-runtime/github/index.ts +31 -33
- package/src/libs/agent-runtime/google/index.ts +2 -1
- package/src/libs/agent-runtime/groq/index.ts +7 -1
- package/src/libs/agent-runtime/higress/index.ts +2 -1
- package/src/libs/agent-runtime/huggingface/index.ts +10 -1
- package/src/libs/agent-runtime/hunyuan/index.ts +3 -1
- package/src/libs/agent-runtime/internlm/index.ts +3 -1
- package/src/libs/agent-runtime/mistral/index.ts +2 -1
- package/src/libs/agent-runtime/moonshot/index.ts +3 -1
- package/src/libs/agent-runtime/novita/__snapshots__/index.test.ts.snap +48 -12
- package/src/libs/agent-runtime/novita/index.ts +9 -1
- package/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +70 -66
- package/src/libs/agent-runtime/openai/index.ts +37 -0
- package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +172 -4
- package/src/libs/agent-runtime/openrouter/index.ts +17 -2
- package/src/libs/agent-runtime/qwen/index.ts +10 -1
- package/src/libs/agent-runtime/sensenova/index.ts +3 -1
- package/src/libs/agent-runtime/siliconcloud/index.ts +10 -1
- package/src/libs/agent-runtime/stepfun/index.ts +3 -1
- package/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap +1309 -5
- package/src/libs/agent-runtime/togetherai/index.test.ts +0 -13
- package/src/libs/agent-runtime/togetherai/index.ts +25 -20
- package/src/libs/agent-runtime/utils/cloudflareHelpers.test.ts +0 -99
- package/src/libs/agent-runtime/utils/cloudflareHelpers.ts +0 -70
- package/src/libs/agent-runtime/xai/index.ts +3 -1
- package/src/libs/agent-runtime/zeroone/index.ts +3 -1
- package/src/libs/agent-runtime/zhipu/index.ts +3 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.51.8](https://github.com/lobehub/lobe-chat/compare/v1.51.7...v1.51.8)
|
6
|
+
|
7
|
+
<sup>Released on **2025-02-06**</sup>
|
8
|
+
|
9
|
+
#### ♻ Code Refactoring
|
10
|
+
|
11
|
+
- **misc**: Refactor model fetch method.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Code refactoring
|
19
|
+
|
20
|
+
- **misc**: Refactor model fetch method, closes [#5768](https://github.com/lobehub/lobe-chat/issues/5768) ([e406908](https://github.com/lobehub/lobe-chat/commit/e406908))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.51.7](https://github.com/lobehub/lobe-chat/compare/v1.51.6...v1.51.7)
|
31
|
+
|
32
|
+
<sup>Released on **2025-02-06**</sup>
|
33
|
+
|
34
|
+
#### 💄 Styles
|
35
|
+
|
36
|
+
- **misc**: Add Aliyun deepseek-r1 distill models.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### Styles
|
44
|
+
|
45
|
+
- **misc**: Add Aliyun deepseek-r1 distill models, closes [#5769](https://github.com/lobehub/lobe-chat/issues/5769) ([8b68190](https://github.com/lobehub/lobe-chat/commit/8b68190))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.51.6](https://github.com/lobehub/lobe-chat/compare/v1.51.5...v1.51.6)
|
6
56
|
|
7
57
|
<sup>Released on **2025-02-06**</sup>
|
package/README.ja-JP.md
CHANGED
@@ -302,14 +302,14 @@ LobeChat エージェントマーケットプレイスでは、クリエイタ
|
|
302
302
|
|
303
303
|
<!-- AGENT LIST -->
|
304
304
|
|
305
|
-
| 最近追加
|
306
|
-
|
|
307
|
-
| [
|
308
|
-
| [
|
309
|
-
| [
|
310
|
-
| [
|
311
|
-
|
312
|
-
> 📊 Total agents: [<kbd>**
|
305
|
+
| 最近追加 | 説明 |
|
306
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
307
|
+
| [命理研究者](https://lobechat.com/discover/assistant/fate-researcher)<br/><sup>By **[Jack980506](https://github.com/Jack980506)** on **2025-02-06**</sup> | 八字命に精通<br/>`命理学` `八字` `伝統文化` |
|
308
|
+
| [言語の魅力学習メンター](https://lobechat.com/discover/assistant/bad-language-helper)<br/><sup>By **[Guducat](https://github.com/Guducat)** on **2025-02-06**</sup> | 言語の魅力と多様な応答を教えるのが得意<br/>`言語学習` `対話例` |
|
309
|
+
| [Allinone](https://lobechat.com/discover/assistant/allinone-v-1)<br/><sup>By **[AXuanCreator](https://github.com/AXuanCreator)** on **2025-02-06**</sup> | 革新・未来・卓越<br/>`プログラミング` `低コスト` `簡潔な回答` |
|
310
|
+
| [ディープシンカー](https://lobechat.com/discover/assistant/deep-thinker)<br/><sup>By **[prolapser](https://github.com/prolapser)** on **2025-02-06**</sup> | 深い人間のような思考と分析。<br/>`思考` `推論` `反省` `考え` `思索` |
|
311
|
+
|
312
|
+
> 📊 Total agents: [<kbd>**485**</kbd> ](https://lobechat.com/discover/assistants)
|
313
313
|
|
314
314
|
<!-- AGENT LIST -->
|
315
315
|
|
package/README.md
CHANGED
@@ -319,14 +319,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
|
|
319
319
|
|
320
320
|
<!-- AGENT LIST -->
|
321
321
|
|
322
|
-
| Recent Submits
|
323
|
-
|
|
324
|
-
| [
|
325
|
-
| [
|
326
|
-
| [
|
327
|
-
| [
|
328
|
-
|
329
|
-
> 📊 Total agents: [<kbd>**
|
322
|
+
| Recent Submits | Description |
|
323
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
324
|
+
| [Astrology Researcher](https://lobechat.com/discover/assistant/fate-researcher)<br/><sup>By **[Jack980506](https://github.com/Jack980506)** on **2025-02-06**</sup> | Expert in BaZi astrology<br/>`astrology` `ba-zi` `traditional-culture` |
|
325
|
+
| [Language Charm Learning Mentor](https://lobechat.com/discover/assistant/bad-language-helper)<br/><sup>By **[Guducat](https://github.com/Guducat)** on **2025-02-06**</sup> | Specializes in teaching the charm of language and witty responses<br/>`language-learning` `dialogue-examples` |
|
326
|
+
| [Allinone](https://lobechat.com/discover/assistant/allinone-v-1)<br/><sup>By **[AXuanCreator](https://github.com/AXuanCreator)** on **2025-02-06**</sup> | Innovation · Future · Excellence<br/>`programming` `low-cost` `concise-answers` |
|
327
|
+
| [Deep Thinker](https://lobechat.com/discover/assistant/deep-thinker)<br/><sup>By **[prolapser](https://github.com/prolapser)** on **2025-02-06**</sup> | Deep, human-like thinking and analysis.<br/>`thinking` `reasoning` `reflection` `thought` `musings` |
|
328
|
+
|
329
|
+
> 📊 Total agents: [<kbd>**485**</kbd> ](https://lobechat.com/discover/assistants)
|
330
330
|
|
331
331
|
<!-- AGENT LIST -->
|
332
332
|
|
package/README.zh-CN.md
CHANGED
@@ -308,14 +308,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
|
|
308
308
|
|
309
309
|
<!-- AGENT LIST -->
|
310
310
|
|
311
|
-
| 最近新增
|
312
|
-
|
|
313
|
-
| [
|
314
|
-
| [
|
315
|
-
| [
|
316
|
-
| [
|
317
|
-
|
318
|
-
> 📊 Total agents: [<kbd>**
|
311
|
+
| 最近新增 | 描述 |
|
312
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
313
|
+
| [命理研究员](https://lobechat.com/discover/assistant/fate-researcher)<br/><sup>By **[Jack980506](https://github.com/Jack980506)** on **2025-02-06**</sup> | 精通八字命<br/>`命理学` `八字` `传统文化` |
|
314
|
+
| [语言魅力学习导师](https://lobechat.com/discover/assistant/bad-language-helper)<br/><sup>By **[Guducat](https://github.com/Guducat)** on **2025-02-06**</sup> | 擅长教学语言的魅力与花样回复<br/>`语言学习` `对话示例` |
|
315
|
+
| [Allinone](https://lobechat.com/discover/assistant/allinone-v-1)<br/><sup>By **[AXuanCreator](https://github.com/AXuanCreator)** on **2025-02-06**</sup> | 创新・未来・卓越<br/>`编程` `低成本` `简洁回答` |
|
316
|
+
| [深思者](https://lobechat.com/discover/assistant/deep-thinker)<br/><sup>By **[prolapser](https://github.com/prolapser)** on **2025-02-06**</sup> | 深刻的人类思维和分析。<br/>`思考` `推理` `反思` `思想` `沉思` |
|
317
|
+
|
318
|
+
> 📊 Total agents: [<kbd>**485**</kbd> ](https://lobechat.com/discover/assistants)
|
319
319
|
|
320
320
|
<!-- AGENT LIST -->
|
321
321
|
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"improvements": [
|
5
|
+
"Refactor model fetch method."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-02-06",
|
9
|
+
"version": "1.51.8"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"improvements": [
|
14
|
+
"Add Aliyun deepseek-r1 distill models."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-02-06",
|
18
|
+
"version": "1.51.7"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"fixes": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.51.
|
3
|
+
"version": "1.51.8",
|
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",
|
@@ -9,7 +9,7 @@ import { createErrorResponse } from '@/utils/errorResponse';
|
|
9
9
|
export const runtime = 'edge';
|
10
10
|
|
11
11
|
const noNeedAPIKey = (provider: string) =>
|
12
|
-
[ModelProvider.OpenRouter
|
12
|
+
[ModelProvider.OpenRouter].includes(provider as any);
|
13
13
|
|
14
14
|
export const GET = checkAuth(async (req, { params, jwtPayload }) => {
|
15
15
|
const { provider } = await params;
|
@@ -411,10 +411,11 @@ const qwenChatModels: AIChatModelCard[] = [
|
|
411
411
|
abilities: {
|
412
412
|
reasoning: true,
|
413
413
|
},
|
414
|
-
contextWindowTokens:
|
414
|
+
contextWindowTokens: 131_072,
|
415
415
|
description:
|
416
416
|
'DeepSeek-R1 在后训练阶段大规模使用了强化学习技术,在仅有极少标注数据的情况下,极大提升了模型推理能力,尤其在数学、代码、自然语言推理等任务上。',
|
417
417
|
displayName: 'DeepSeek R1',
|
418
|
+
enabled: true,
|
418
419
|
id: 'deepseek-r1',
|
419
420
|
maxOutput: 8192,
|
420
421
|
pricing: {
|
@@ -429,10 +430,11 @@ const qwenChatModels: AIChatModelCard[] = [
|
|
429
430
|
abilities: {
|
430
431
|
functionCall: true,
|
431
432
|
},
|
432
|
-
contextWindowTokens:
|
433
|
+
contextWindowTokens: 131_072,
|
433
434
|
description:
|
434
435
|
'DeepSeek-V3 为自研 MoE 模型,671B 参数,激活 37B,在 14.8T token 上进行了预训练,在长文本、代码、数学、百科、中文能力上表现优秀。',
|
435
436
|
displayName: 'DeepSeek V3',
|
437
|
+
enabled: true,
|
436
438
|
id: 'deepseek-v3',
|
437
439
|
maxOutput: 8192,
|
438
440
|
pricing: {
|
@@ -443,6 +445,103 @@ const qwenChatModels: AIChatModelCard[] = [
|
|
443
445
|
releasedAt: '2025-01-27',
|
444
446
|
type: 'chat',
|
445
447
|
},
|
448
|
+
{
|
449
|
+
abilities: {
|
450
|
+
reasoning: true,
|
451
|
+
},
|
452
|
+
contextWindowTokens: 131_072,
|
453
|
+
description:
|
454
|
+
'DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。',
|
455
|
+
displayName: 'DeepSeek R1 Distill Qwen 1.5B',
|
456
|
+
id: 'deepseek-r1-distill-qwen-1.5b',
|
457
|
+
maxOutput: 8192,
|
458
|
+
pricing: {
|
459
|
+
currency: 'CNY',
|
460
|
+
input: 0,
|
461
|
+
output: 0,
|
462
|
+
},
|
463
|
+
type: 'chat',
|
464
|
+
},
|
465
|
+
{
|
466
|
+
abilities: {
|
467
|
+
reasoning: true
|
468
|
+
},
|
469
|
+
contextWindowTokens: 131_072,
|
470
|
+
description: "DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。",
|
471
|
+
displayName: "DeepSeek R1 Distill Qwen 7B",
|
472
|
+
id: "deepseek-r1-distill-qwen-7b",
|
473
|
+
maxOutput: 8192,
|
474
|
+
pricing: {
|
475
|
+
currency: "CNY",
|
476
|
+
input: 0,
|
477
|
+
output: 0
|
478
|
+
},
|
479
|
+
type: "chat"
|
480
|
+
},
|
481
|
+
{
|
482
|
+
abilities: {
|
483
|
+
reasoning: true
|
484
|
+
},
|
485
|
+
contextWindowTokens: 131_072,
|
486
|
+
description: "DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。",
|
487
|
+
displayName: "DeepSeek R1 Distill Llama 8B",
|
488
|
+
id: "deepseek-r1-distill-llama-8b",
|
489
|
+
maxOutput: 8192,
|
490
|
+
pricing: {
|
491
|
+
currency: "CNY",
|
492
|
+
input: 0,
|
493
|
+
output: 0
|
494
|
+
},
|
495
|
+
type: "chat"
|
496
|
+
},
|
497
|
+
{
|
498
|
+
abilities: {
|
499
|
+
reasoning: true
|
500
|
+
},
|
501
|
+
contextWindowTokens: 131_072,
|
502
|
+
description: "DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。",
|
503
|
+
displayName: "DeepSeek R1 Distill Qwen 14B",
|
504
|
+
id: "deepseek-r1-distill-qwen-14b",
|
505
|
+
maxOutput: 8192,
|
506
|
+
pricing: {
|
507
|
+
currency: "CNY",
|
508
|
+
input: 0,
|
509
|
+
output: 0
|
510
|
+
},
|
511
|
+
type: "chat"
|
512
|
+
},
|
513
|
+
{
|
514
|
+
abilities: {
|
515
|
+
reasoning: true
|
516
|
+
},
|
517
|
+
contextWindowTokens: 131_072,
|
518
|
+
description: "DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。",
|
519
|
+
displayName: "DeepSeek R1 Distill Qwen 32B",
|
520
|
+
id: "deepseek-r1-distill-qwen-32b",
|
521
|
+
maxOutput: 8192,
|
522
|
+
pricing: {
|
523
|
+
currency: "CNY",
|
524
|
+
input: 0,
|
525
|
+
output: 0
|
526
|
+
},
|
527
|
+
type: "chat"
|
528
|
+
},
|
529
|
+
{
|
530
|
+
abilities: {
|
531
|
+
reasoning: true
|
532
|
+
},
|
533
|
+
contextWindowTokens: 131_072,
|
534
|
+
description: "DeepSeek-R1-Distill 系列模型通过知识蒸馏技术,将 DeepSeek-R1 生成的样本对 Qwen、Llama 等开源模型进行微调后得到。",
|
535
|
+
displayName: "DeepSeek R1 Distill Llama 70B",
|
536
|
+
id: "deepseek-r1-distill-llama-70b",
|
537
|
+
maxOutput: 8192,
|
538
|
+
pricing: {
|
539
|
+
currency: "CNY",
|
540
|
+
input: 0,
|
541
|
+
output: 0
|
542
|
+
},
|
543
|
+
type: "chat"
|
544
|
+
}
|
446
545
|
];
|
447
546
|
|
448
547
|
export const allModels = [...qwenChatModels];
|
@@ -24,17 +24,24 @@ export const LobeAi360AI = LobeOpenAICompatibleFactory({
|
|
24
24
|
},
|
25
25
|
models: {
|
26
26
|
transformModel: (m) => {
|
27
|
+
const reasoningKeywords = [
|
28
|
+
'360gpt2-o1',
|
29
|
+
'360zhinao2-o1',
|
30
|
+
];
|
31
|
+
|
27
32
|
const model = m as unknown as Ai360ModelCard;
|
28
33
|
|
29
34
|
return {
|
30
35
|
contextWindowTokens: model.total_tokens,
|
31
|
-
|
36
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
37
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
32
38
|
functionCall: model.id === '360gpt-pro',
|
33
39
|
id: model.id,
|
34
40
|
maxTokens:
|
35
41
|
typeof model.max_tokens === 'number'
|
36
42
|
? model.max_tokens
|
37
43
|
: undefined,
|
44
|
+
reasoning: reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
38
45
|
};
|
39
46
|
},
|
40
47
|
},
|
@@ -129,8 +129,9 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
|
|
129
129
|
return modelList
|
130
130
|
.map((model) => {
|
131
131
|
return {
|
132
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
132
133
|
displayName: model.display_name,
|
133
|
-
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id
|
134
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
134
135
|
functionCall: model.id.toLowerCase().includes('claude-3'),
|
135
136
|
id: model.id,
|
136
137
|
vision: model.id.toLowerCase().includes('claude-3') && !model.id.toLowerCase().includes('claude-3-5-haiku'),
|
@@ -40,7 +40,7 @@ export const LobeBaichuanAI = LobeOpenAICompatibleFactory({
|
|
40
40
|
return {
|
41
41
|
contextWindowTokens: model.max_input_length,
|
42
42
|
displayName: model.model_show_name,
|
43
|
-
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.model
|
43
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.model === m.id)?.enabled || false,
|
44
44
|
functionCall: model.function_call,
|
45
45
|
id: model.model,
|
46
46
|
maxTokens: model.max_tokens,
|
@@ -527,122 +527,5 @@ describe('LobeCloudflareAI', () => {
|
|
527
527
|
|
528
528
|
expect(result).toHaveLength(2);
|
529
529
|
});
|
530
|
-
|
531
|
-
it('should set id to name', async () => {
|
532
|
-
// Arrange
|
533
|
-
const instance = new LobeCloudflareAI({
|
534
|
-
apiKey: 'test_api_key',
|
535
|
-
baseURLOrAccountID: accountID,
|
536
|
-
});
|
537
|
-
|
538
|
-
vi.spyOn(globalThis, 'fetch').mockResolvedValue(
|
539
|
-
new Response(
|
540
|
-
JSON.stringify({
|
541
|
-
result: [
|
542
|
-
{
|
543
|
-
id: 'id1',
|
544
|
-
name: 'name1',
|
545
|
-
task: { name: 'Text Generation' },
|
546
|
-
},
|
547
|
-
],
|
548
|
-
}),
|
549
|
-
),
|
550
|
-
);
|
551
|
-
|
552
|
-
// Act
|
553
|
-
const result = await instance.models();
|
554
|
-
|
555
|
-
// Assert
|
556
|
-
expect(result).toEqual([
|
557
|
-
expect.objectContaining({
|
558
|
-
displayName: 'name1',
|
559
|
-
id: 'name1',
|
560
|
-
}),
|
561
|
-
]);
|
562
|
-
});
|
563
|
-
|
564
|
-
it('should filter text generation models', async () => {
|
565
|
-
// Arrange
|
566
|
-
const instance = new LobeCloudflareAI({
|
567
|
-
apiKey: 'test_api_key',
|
568
|
-
baseURLOrAccountID: accountID,
|
569
|
-
});
|
570
|
-
|
571
|
-
vi.spyOn(globalThis, 'fetch').mockResolvedValue(
|
572
|
-
new Response(
|
573
|
-
JSON.stringify({
|
574
|
-
result: [
|
575
|
-
{
|
576
|
-
id: '1',
|
577
|
-
name: 'model1',
|
578
|
-
task: { name: 'Text Generation' },
|
579
|
-
},
|
580
|
-
{
|
581
|
-
id: '2',
|
582
|
-
name: 'model2',
|
583
|
-
task: { name: 'Text Classification' },
|
584
|
-
},
|
585
|
-
],
|
586
|
-
}),
|
587
|
-
),
|
588
|
-
);
|
589
|
-
|
590
|
-
// Act
|
591
|
-
const result = await instance.models();
|
592
|
-
|
593
|
-
// Assert
|
594
|
-
expect(result).toEqual([
|
595
|
-
expect.objectContaining({
|
596
|
-
displayName: 'model1',
|
597
|
-
id: 'model1',
|
598
|
-
}),
|
599
|
-
]);
|
600
|
-
});
|
601
|
-
|
602
|
-
it('should enable non-beta models and mark beta models', async () => {
|
603
|
-
// Arrange
|
604
|
-
const instance = new LobeCloudflareAI({
|
605
|
-
apiKey: 'test_api_key',
|
606
|
-
baseURLOrAccountID: accountID,
|
607
|
-
});
|
608
|
-
|
609
|
-
vi.spyOn(globalThis, 'fetch').mockResolvedValue(
|
610
|
-
new Response(
|
611
|
-
JSON.stringify({
|
612
|
-
result: [
|
613
|
-
{
|
614
|
-
id: '1',
|
615
|
-
name: 'model1',
|
616
|
-
task: { name: 'Text Generation' },
|
617
|
-
properties: [{ property_id: 'beta', value: 'false' }],
|
618
|
-
},
|
619
|
-
{
|
620
|
-
id: '2',
|
621
|
-
name: 'model2',
|
622
|
-
task: { name: 'Text Generation' },
|
623
|
-
properties: [{ property_id: 'beta', value: 'true' }],
|
624
|
-
},
|
625
|
-
],
|
626
|
-
}),
|
627
|
-
),
|
628
|
-
);
|
629
|
-
|
630
|
-
// Act
|
631
|
-
const result = await instance.models();
|
632
|
-
|
633
|
-
// Assert
|
634
|
-
expect(result).toEqual([
|
635
|
-
expect.objectContaining({
|
636
|
-
displayName: 'model1',
|
637
|
-
enabled: true,
|
638
|
-
id: 'model1',
|
639
|
-
}),
|
640
|
-
expect.objectContaining({
|
641
|
-
displayName: 'model2 (Beta)',
|
642
|
-
enabled: false,
|
643
|
-
id: 'model2',
|
644
|
-
}),
|
645
|
-
]);
|
646
|
-
});
|
647
530
|
});
|
648
531
|
});
|
@@ -1,12 +1,9 @@
|
|
1
|
-
import { ChatModelCard } from '@/types/llm';
|
2
|
-
|
3
1
|
import { LobeRuntimeAI } from '../BaseAI';
|
4
2
|
import { AgentRuntimeErrorType } from '../error';
|
5
3
|
import { ChatCompetitionOptions, ChatStreamPayload, ModelProvider } from '../types';
|
6
4
|
import {
|
7
5
|
CloudflareStreamTransformer,
|
8
6
|
DEFAULT_BASE_URL_PREFIX,
|
9
|
-
convertModelManifest,
|
10
7
|
desensitizeCloudflareUrl,
|
11
8
|
fillUrl,
|
12
9
|
} from '../utils/cloudflareHelpers';
|
@@ -15,6 +12,19 @@ import { debugStream } from '../utils/debugStream';
|
|
15
12
|
import { StreamingResponse } from '../utils/response';
|
16
13
|
import { createCallbacksTransformer } from '../utils/streams';
|
17
14
|
|
15
|
+
import { LOBE_DEFAULT_MODEL_LIST } from '@/config/aiModels';
|
16
|
+
import { ChatModelCard } from '@/types/llm';
|
17
|
+
|
18
|
+
export interface CloudflareModelCard {
|
19
|
+
description: string;
|
20
|
+
name: string;
|
21
|
+
properties?: Record<string, string>;
|
22
|
+
task?: {
|
23
|
+
description?: string;
|
24
|
+
name: string;
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
18
28
|
export interface LobeCloudflareParams {
|
19
29
|
apiKey?: string;
|
20
30
|
baseURLOrAccountID?: string;
|
@@ -111,13 +121,24 @@ export class LobeCloudflareAI implements LobeRuntimeAI {
|
|
111
121
|
},
|
112
122
|
method: 'GET',
|
113
123
|
});
|
114
|
-
const
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
.map((model) =>
|
120
|
-
|
121
|
-
|
124
|
+
const json = await response.json();
|
125
|
+
|
126
|
+
const modelList: CloudflareModelCard[] = json.result;
|
127
|
+
|
128
|
+
return modelList
|
129
|
+
.map((model) => {
|
130
|
+
return {
|
131
|
+
contextWindowTokens: model.properties?.max_total_tokens
|
132
|
+
? Number(model.properties.max_total_tokens)
|
133
|
+
: LOBE_DEFAULT_MODEL_LIST.find((m) => model.name === m.id)?.contextWindowTokens ?? undefined,
|
134
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.name === m.id)?.displayName ?? (model.properties?.["beta"] === "true" ? `${model.name} (Beta)` : undefined),
|
135
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.name === m.id)?.enabled || false,
|
136
|
+
functionCall: model.description.toLowerCase().includes('function call') || model.properties?.["function_calling"] === "true",
|
137
|
+
id: model.name,
|
138
|
+
reasoning: model.name.toLowerCase().includes('deepseek-r1'),
|
139
|
+
vision: model.name.toLowerCase().includes('vision') || model.task?.name.toLowerCase().includes('image-to-text') || model.description.toLowerCase().includes('vision'),
|
140
|
+
};
|
141
|
+
})
|
142
|
+
.filter(Boolean) as ChatModelCard[];
|
122
143
|
}
|
123
144
|
}
|
@@ -64,9 +64,12 @@ export const LobeDeepSeekAI = LobeOpenAICompatibleFactory({
|
|
64
64
|
const model = m as unknown as DeepSeekModelCard;
|
65
65
|
|
66
66
|
return {
|
67
|
-
|
67
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
68
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
69
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
68
70
|
functionCall: !model.id.toLowerCase().includes('deepseek-reasoner'),
|
69
71
|
id: model.id,
|
72
|
+
reasoning: model.id.toLowerCase().includes('deepseek-reasoner'),
|
70
73
|
};
|
71
74
|
},
|
72
75
|
},
|
@@ -17,13 +17,20 @@ export const LobeFireworksAI = LobeOpenAICompatibleFactory({
|
|
17
17
|
},
|
18
18
|
models: {
|
19
19
|
transformModel: (m) => {
|
20
|
+
const reasoningKeywords = [
|
21
|
+
'deepseek-r1',
|
22
|
+
'qwq',
|
23
|
+
];
|
24
|
+
|
20
25
|
const model = m as unknown as FireworksAIModelCard;
|
21
26
|
|
22
27
|
return {
|
23
28
|
contextWindowTokens: model.context_length,
|
24
|
-
|
29
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
30
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
25
31
|
functionCall: model.supports_tools || model.id.toLowerCase().includes('function'),
|
26
32
|
id: model.id,
|
33
|
+
reasoning: reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
27
34
|
vision: model.supports_image_input,
|
28
35
|
};
|
29
36
|
},
|
@@ -24,12 +24,20 @@ export const LobeGiteeAI = LobeOpenAICompatibleFactory({
|
|
24
24
|
'qwen2-vl',
|
25
25
|
];
|
26
26
|
|
27
|
+
const reasoningKeywords = [
|
28
|
+
'deepseek-r1',
|
29
|
+
'qwq',
|
30
|
+
];
|
31
|
+
|
27
32
|
const model = m as unknown as GiteeAIModelCard;
|
28
33
|
|
29
34
|
return {
|
30
|
-
|
35
|
+
contextWindowTokens: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.contextWindowTokens ?? undefined,
|
36
|
+
displayName: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.displayName ?? undefined,
|
37
|
+
enabled: LOBE_DEFAULT_MODEL_LIST.find((m) => model.id === m.id)?.enabled || false,
|
31
38
|
functionCall: functionCallKeywords.some(keyword => model.id.toLowerCase().includes(keyword)) && !model.id.toLowerCase().includes('qwen2.5-coder'),
|
32
39
|
id: model.id,
|
40
|
+
reasoning: reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
33
41
|
vision: visionKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
|
34
42
|
};
|
35
43
|
},
|
@@ -217,22 +217,6 @@ describe('LobeGithubAI', () => {
|
|
217
217
|
it('should return a list of models', async () => {
|
218
218
|
// Arrange
|
219
219
|
const arr = [
|
220
|
-
{
|
221
|
-
id: 'azureml://registries/azureml-ai21/models/AI21-Jamba-Instruct/versions/2',
|
222
|
-
name: 'AI21-Jamba-Instruct',
|
223
|
-
friendly_name: 'AI21-Jamba-Instruct',
|
224
|
-
model_version: 2,
|
225
|
-
publisher: 'AI21 Labs',
|
226
|
-
model_family: 'AI21 Labs',
|
227
|
-
model_registry: 'azureml-ai21',
|
228
|
-
license: 'custom',
|
229
|
-
task: 'chat-completion',
|
230
|
-
description:
|
231
|
-
"Jamba-Instruct is the world's first production-grade Mamba-based LLM model and leverages its hybrid Mamba-Transformer architecture to achieve best-in-class performance, quality, and cost efficiency.\n\n**Model Developer Name**: _AI21 Labs_\n\n## Model Architecture\n\nJamba-Instruct leverages a hybrid Mamba-Transformer architecture to achieve best-in-class performance, quality, and cost efficiency.\nAI21's Jamba architecture features a blocks-and-layers approach that allows Jamba to successfully integrate the two architectures. Each Jamba block contains either an attention or a Mamba layer, followed by a multi-layer perceptron (MLP), producing an overall ratio of one Transformer layer out of every eight total layers.\n",
|
232
|
-
summary:
|
233
|
-
"Jamba-Instruct is the world's first production-grade Mamba-based LLM model and leverages its hybrid Mamba-Transformer architecture to achieve best-in-class performance, quality, and cost efficiency.",
|
234
|
-
tags: ['chat', 'rag'],
|
235
|
-
},
|
236
220
|
{
|
237
221
|
id: 'azureml://registries/azureml-cohere/models/Cohere-command-r/versions/3',
|
238
222
|
name: 'Cohere-command-r',
|
@@ -263,9 +247,14 @@ describe('LobeGithubAI', () => {
|
|
263
247
|
for (let i = 0; i < arr.length; i++) {
|
264
248
|
const model = models[i];
|
265
249
|
expect(model).toEqual({
|
250
|
+
contextWindowTokens: undefined,
|
266
251
|
description: arr[i].description,
|
267
252
|
displayName: arr[i].friendly_name,
|
253
|
+
enabled: false,
|
254
|
+
functionCall: true,
|
268
255
|
id: arr[i].name,
|
256
|
+
reasoning: false,
|
257
|
+
vision: false,
|
269
258
|
});
|
270
259
|
}
|
271
260
|
});
|