@lobehub/chat 1.91.1 → 1.91.3
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/.eslintrc.js +2 -0
- package/CHANGELOG.md +58 -0
- package/changelog/v1.json +21 -0
- package/package.json +2 -2
- package/src/app/(backend)/middleware/auth/utils.ts +2 -1
- package/src/app/[variants]/(main)/profile/features/ClerkProfile.tsx +1 -4
- package/src/config/aiModels/modelscope.ts +4 -1
- package/src/config/aiModels/novita.ts +2 -0
- package/src/config/aiModels/openrouter.ts +2 -0
- package/src/config/aiModels/siliconcloud.ts +1 -0
- package/src/config/modelProviders/anthropic.ts +30 -11
- package/src/config/modelProviders/openai.ts +14 -0
- package/src/layout/AuthProvider/Clerk/useAppearance.ts +1 -4
- package/src/libs/model-runtime/google/index.ts +30 -40
- package/src/libs/model-runtime/novita/__snapshots__/index.test.ts.snap +19 -1
- package/src/libs/model-runtime/novita/index.ts +14 -15
- package/src/libs/model-runtime/nvidia/index.ts +2 -21
- package/src/libs/model-runtime/openai/__snapshots__/index.test.ts.snap +39 -11
- package/src/libs/model-runtime/openai/index.ts +3 -38
- package/src/libs/model-runtime/openrouter/__snapshots__/index.test.ts.snap +3 -0
- package/src/libs/model-runtime/openrouter/index.ts +45 -54
- package/src/libs/model-runtime/qwen/index.ts +2 -45
- package/src/libs/model-runtime/siliconcloud/index.ts +2 -51
- package/src/libs/model-runtime/utils/modelParse.test.ts +761 -0
- package/src/libs/model-runtime/utils/modelParse.ts +186 -0
- package/src/libs/model-runtime/volcengine/index.ts +11 -0
- package/src/libs/model-runtime/zeroone/index.ts +2 -23
- package/src/libs/model-runtime/zhipu/index.ts +7 -34
- package/src/app/[variants]/(main)/settings/provider/(detail)/ollama/OllamaModelDownloader/index.tsx +0 -0
@@ -8,15 +8,17 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
8
8
|
"enabled": false,
|
9
9
|
"functionCall": false,
|
10
10
|
"id": "whisper-1",
|
11
|
+
"maxOutput": undefined,
|
11
12
|
"reasoning": false,
|
12
13
|
"vision": false,
|
13
14
|
},
|
14
15
|
{
|
15
16
|
"contextWindowTokens": undefined,
|
16
|
-
"displayName":
|
17
|
+
"displayName": "davinci-002",
|
17
18
|
"enabled": false,
|
18
19
|
"functionCall": false,
|
19
20
|
"id": "davinci-002",
|
21
|
+
"maxOutput": undefined,
|
20
22
|
"reasoning": false,
|
21
23
|
"vision": false,
|
22
24
|
},
|
@@ -26,6 +28,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
26
28
|
"enabled": false,
|
27
29
|
"functionCall": true,
|
28
30
|
"id": "gpt-3.5-turbo",
|
31
|
+
"maxOutput": undefined,
|
29
32
|
"reasoning": false,
|
30
33
|
"vision": false,
|
31
34
|
},
|
@@ -35,24 +38,27 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
35
38
|
"enabled": false,
|
36
39
|
"functionCall": false,
|
37
40
|
"id": "dall-e-2",
|
41
|
+
"maxOutput": undefined,
|
38
42
|
"reasoning": false,
|
39
43
|
"vision": false,
|
40
44
|
},
|
41
45
|
{
|
42
46
|
"contextWindowTokens": undefined,
|
43
|
-
"displayName":
|
47
|
+
"displayName": "gpt-3.5-turbo-16k",
|
44
48
|
"enabled": false,
|
45
49
|
"functionCall": false,
|
46
50
|
"id": "gpt-3.5-turbo-16k",
|
51
|
+
"maxOutput": undefined,
|
47
52
|
"reasoning": false,
|
48
53
|
"vision": false,
|
49
54
|
},
|
50
55
|
{
|
51
56
|
"contextWindowTokens": undefined,
|
52
|
-
"displayName":
|
57
|
+
"displayName": "tts-1-hd-1106",
|
53
58
|
"enabled": false,
|
54
59
|
"functionCall": false,
|
55
60
|
"id": "tts-1-hd-1106",
|
61
|
+
"maxOutput": undefined,
|
56
62
|
"reasoning": false,
|
57
63
|
"vision": false,
|
58
64
|
},
|
@@ -62,15 +68,17 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
62
68
|
"enabled": false,
|
63
69
|
"functionCall": false,
|
64
70
|
"id": "tts-1-hd",
|
71
|
+
"maxOutput": undefined,
|
65
72
|
"reasoning": false,
|
66
73
|
"vision": false,
|
67
74
|
},
|
68
75
|
{
|
69
76
|
"contextWindowTokens": undefined,
|
70
|
-
"displayName":
|
77
|
+
"displayName": "gpt-3.5-turbo-16k-0613",
|
71
78
|
"enabled": false,
|
72
79
|
"functionCall": false,
|
73
80
|
"id": "gpt-3.5-turbo-16k-0613",
|
81
|
+
"maxOutput": undefined,
|
74
82
|
"reasoning": false,
|
75
83
|
"vision": false,
|
76
84
|
},
|
@@ -80,24 +88,27 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
80
88
|
"enabled": false,
|
81
89
|
"functionCall": false,
|
82
90
|
"id": "text-embedding-3-large",
|
91
|
+
"maxOutput": undefined,
|
83
92
|
"reasoning": false,
|
84
93
|
"vision": false,
|
85
94
|
},
|
86
95
|
{
|
87
96
|
"contextWindowTokens": undefined,
|
88
|
-
"displayName":
|
97
|
+
"displayName": "gpt-4-1106-vision-preview",
|
89
98
|
"enabled": false,
|
90
99
|
"functionCall": false,
|
91
100
|
"id": "gpt-4-1106-vision-preview",
|
101
|
+
"maxOutput": undefined,
|
92
102
|
"reasoning": false,
|
93
103
|
"vision": false,
|
94
104
|
},
|
95
105
|
{
|
96
106
|
"contextWindowTokens": undefined,
|
97
|
-
"displayName":
|
107
|
+
"displayName": "gpt-3.5-turbo-instruct-0914",
|
98
108
|
"enabled": false,
|
99
109
|
"functionCall": false,
|
100
110
|
"id": "gpt-3.5-turbo-instruct-0914",
|
111
|
+
"maxOutput": undefined,
|
101
112
|
"reasoning": false,
|
102
113
|
"vision": false,
|
103
114
|
},
|
@@ -107,6 +118,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
107
118
|
"enabled": false,
|
108
119
|
"functionCall": true,
|
109
120
|
"id": "gpt-4-0125-preview",
|
121
|
+
"maxOutput": undefined,
|
110
122
|
"reasoning": false,
|
111
123
|
"vision": false,
|
112
124
|
},
|
@@ -116,6 +128,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
116
128
|
"enabled": false,
|
117
129
|
"functionCall": true,
|
118
130
|
"id": "gpt-4-turbo-preview",
|
131
|
+
"maxOutput": undefined,
|
119
132
|
"reasoning": false,
|
120
133
|
"vision": false,
|
121
134
|
},
|
@@ -125,24 +138,27 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
125
138
|
"enabled": false,
|
126
139
|
"functionCall": false,
|
127
140
|
"id": "gpt-3.5-turbo-instruct",
|
141
|
+
"maxOutput": undefined,
|
128
142
|
"reasoning": false,
|
129
143
|
"vision": false,
|
130
144
|
},
|
131
145
|
{
|
132
146
|
"contextWindowTokens": undefined,
|
133
|
-
"displayName":
|
147
|
+
"displayName": "gpt-3.5-turbo-0301",
|
134
148
|
"enabled": false,
|
135
149
|
"functionCall": false,
|
136
150
|
"id": "gpt-3.5-turbo-0301",
|
151
|
+
"maxOutput": undefined,
|
137
152
|
"reasoning": false,
|
138
153
|
"vision": false,
|
139
154
|
},
|
140
155
|
{
|
141
156
|
"contextWindowTokens": undefined,
|
142
|
-
"displayName":
|
157
|
+
"displayName": "gpt-3.5-turbo-0613",
|
143
158
|
"enabled": false,
|
144
159
|
"functionCall": false,
|
145
160
|
"id": "gpt-3.5-turbo-0613",
|
161
|
+
"maxOutput": undefined,
|
146
162
|
"reasoning": false,
|
147
163
|
"vision": false,
|
148
164
|
},
|
@@ -152,6 +168,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
152
168
|
"enabled": false,
|
153
169
|
"functionCall": false,
|
154
170
|
"id": "tts-1",
|
171
|
+
"maxOutput": undefined,
|
155
172
|
"reasoning": false,
|
156
173
|
"vision": false,
|
157
174
|
},
|
@@ -161,6 +178,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
161
178
|
"enabled": false,
|
162
179
|
"functionCall": false,
|
163
180
|
"id": "dall-e-3",
|
181
|
+
"maxOutput": undefined,
|
164
182
|
"reasoning": false,
|
165
183
|
"vision": false,
|
166
184
|
},
|
@@ -170,6 +188,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
170
188
|
"enabled": false,
|
171
189
|
"functionCall": true,
|
172
190
|
"id": "gpt-3.5-turbo-1106",
|
191
|
+
"maxOutput": undefined,
|
173
192
|
"reasoning": false,
|
174
193
|
"vision": false,
|
175
194
|
},
|
@@ -179,24 +198,27 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
179
198
|
"enabled": false,
|
180
199
|
"functionCall": true,
|
181
200
|
"id": "gpt-4-1106-preview",
|
201
|
+
"maxOutput": undefined,
|
182
202
|
"reasoning": false,
|
183
203
|
"vision": false,
|
184
204
|
},
|
185
205
|
{
|
186
206
|
"contextWindowTokens": undefined,
|
187
|
-
"displayName":
|
207
|
+
"displayName": "babbage-002",
|
188
208
|
"enabled": false,
|
189
209
|
"functionCall": false,
|
190
210
|
"id": "babbage-002",
|
211
|
+
"maxOutput": undefined,
|
191
212
|
"reasoning": false,
|
192
213
|
"vision": false,
|
193
214
|
},
|
194
215
|
{
|
195
216
|
"contextWindowTokens": undefined,
|
196
|
-
"displayName":
|
217
|
+
"displayName": "tts-1-1106",
|
197
218
|
"enabled": false,
|
198
219
|
"functionCall": false,
|
199
220
|
"id": "tts-1-1106",
|
221
|
+
"maxOutput": undefined,
|
200
222
|
"reasoning": false,
|
201
223
|
"vision": false,
|
202
224
|
},
|
@@ -206,6 +228,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
206
228
|
"enabled": false,
|
207
229
|
"functionCall": false,
|
208
230
|
"id": "gpt-4-vision-preview",
|
231
|
+
"maxOutput": undefined,
|
209
232
|
"reasoning": false,
|
210
233
|
"vision": true,
|
211
234
|
},
|
@@ -215,6 +238,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
215
238
|
"enabled": false,
|
216
239
|
"functionCall": false,
|
217
240
|
"id": "text-embedding-3-small",
|
241
|
+
"maxOutput": undefined,
|
218
242
|
"reasoning": false,
|
219
243
|
"vision": false,
|
220
244
|
},
|
@@ -224,15 +248,17 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
224
248
|
"enabled": false,
|
225
249
|
"functionCall": true,
|
226
250
|
"id": "gpt-4",
|
251
|
+
"maxOutput": 4096,
|
227
252
|
"reasoning": false,
|
228
253
|
"vision": true,
|
229
254
|
},
|
230
255
|
{
|
231
256
|
"contextWindowTokens": undefined,
|
232
|
-
"displayName":
|
257
|
+
"displayName": "text-embedding-ada-002",
|
233
258
|
"enabled": false,
|
234
259
|
"functionCall": false,
|
235
260
|
"id": "text-embedding-ada-002",
|
261
|
+
"maxOutput": undefined,
|
236
262
|
"reasoning": false,
|
237
263
|
"vision": false,
|
238
264
|
},
|
@@ -242,6 +268,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
242
268
|
"enabled": false,
|
243
269
|
"functionCall": true,
|
244
270
|
"id": "gpt-3.5-turbo-0125",
|
271
|
+
"maxOutput": undefined,
|
245
272
|
"reasoning": false,
|
246
273
|
"vision": false,
|
247
274
|
},
|
@@ -251,6 +278,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
251
278
|
"enabled": false,
|
252
279
|
"functionCall": true,
|
253
280
|
"id": "gpt-4-0613",
|
281
|
+
"maxOutput": undefined,
|
254
282
|
"reasoning": false,
|
255
283
|
"vision": false,
|
256
284
|
},
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import type { ChatModelCard } from '@/types/llm';
|
2
|
-
|
3
1
|
import { ModelProvider } from '../types';
|
4
2
|
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
5
3
|
import { pruneReasoningPayload } from '../utils/openaiHelpers';
|
4
|
+
import { processMultiProviderModelList } from '../utils/modelParse';
|
6
5
|
|
7
6
|
export interface OpenAIModelCard {
|
8
7
|
id: string;
|
@@ -45,45 +44,11 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
|
|
45
44
|
chatCompletion: () => process.env.DEBUG_OPENAI_CHAT_COMPLETION === '1',
|
46
45
|
},
|
47
46
|
models: async ({ client }) => {
|
48
|
-
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
49
|
-
|
50
|
-
const functionCallKeywords = ['4o', '4.1', 'o3', 'o4'];
|
51
|
-
|
52
|
-
const visionKeywords = ['4o', '4.1', 'o4'];
|
53
|
-
|
54
|
-
const reasoningKeywords = ['o1', 'o3', 'o4'];
|
55
|
-
|
56
47
|
const modelsPage = (await client.models.list()) as any;
|
57
48
|
const modelList: OpenAIModelCard[] = modelsPage.data;
|
58
49
|
|
59
|
-
|
60
|
-
|
61
|
-
const knownModel = LOBE_DEFAULT_MODEL_LIST.find(
|
62
|
-
(m) => model.id.toLowerCase() === m.id.toLowerCase(),
|
63
|
-
);
|
64
|
-
|
65
|
-
return {
|
66
|
-
contextWindowTokens: knownModel?.contextWindowTokens ?? undefined,
|
67
|
-
displayName: knownModel?.displayName ?? undefined,
|
68
|
-
enabled: knownModel?.enabled || false,
|
69
|
-
functionCall:
|
70
|
-
(functionCallKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) &&
|
71
|
-
!model.id.toLowerCase().includes('audio')) ||
|
72
|
-
knownModel?.abilities?.functionCall ||
|
73
|
-
false,
|
74
|
-
id: model.id,
|
75
|
-
reasoning:
|
76
|
-
reasoningKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
77
|
-
knownModel?.abilities?.reasoning ||
|
78
|
-
false,
|
79
|
-
vision:
|
80
|
-
(visionKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) &&
|
81
|
-
!model.id.toLowerCase().includes('audio')) ||
|
82
|
-
knownModel?.abilities?.vision ||
|
83
|
-
false,
|
84
|
-
};
|
85
|
-
})
|
86
|
-
.filter(Boolean) as ChatModelCard[];
|
50
|
+
// 自动检测模型提供商并选择相应配置
|
51
|
+
return processMultiProviderModelList(modelList);
|
87
52
|
},
|
88
53
|
provider: ModelProvider.OpenAI,
|
89
54
|
});
|
@@ -13,6 +13,7 @@ _These are free, rate-limited endpoints for [Reflection 70B](/models/mattshumer/
|
|
13
13
|
"enabled": false,
|
14
14
|
"functionCall": true,
|
15
15
|
"id": "mattshumer/reflection-70b:free",
|
16
|
+
"maxOutput": undefined,
|
16
17
|
"maxTokens": 4096,
|
17
18
|
"pricing": {
|
18
19
|
"input": 0,
|
@@ -38,6 +39,7 @@ _These are free, rate-limited endpoints for [Reflection 70B](/models/mattshumer/
|
|
38
39
|
"enabled": false,
|
39
40
|
"functionCall": false,
|
40
41
|
"id": "mattshumer/reflection-70b:free",
|
42
|
+
"maxOutput": undefined,
|
41
43
|
"maxTokens": 4096,
|
42
44
|
"pricing": {
|
43
45
|
"input": 0,
|
@@ -63,6 +65,7 @@ _These are free, rate-limited endpoints for [Reflection 70B](/models/mattshumer/
|
|
63
65
|
"enabled": false,
|
64
66
|
"functionCall": false,
|
65
67
|
"id": "mattshumer/reflection-70b:free",
|
68
|
+
"maxOutput": undefined,
|
66
69
|
"maxTokens": 4096,
|
67
70
|
"pricing": {
|
68
71
|
"input": 0,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ChatModelCard } from '@/types/llm';
|
2
2
|
|
3
3
|
import { ModelProvider } from '../types';
|
4
|
+
import { processMultiProviderModelList } from '../utils/modelParse';
|
4
5
|
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
5
6
|
import { OpenRouterModelCard, OpenRouterModelExtraInfo, OpenRouterReasoning } from './type';
|
6
7
|
|
@@ -40,20 +41,9 @@ export const LobeOpenRouterAI = createOpenAICompatibleRuntime({
|
|
40
41
|
chatCompletion: () => process.env.DEBUG_OPENROUTER_CHAT_COMPLETION === '1',
|
41
42
|
},
|
42
43
|
models: async ({ client }) => {
|
43
|
-
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
44
|
-
|
45
|
-
const reasoningKeywords = [
|
46
|
-
'deepseek/deepseek-r1',
|
47
|
-
'openai/o1',
|
48
|
-
'openai/o3',
|
49
|
-
'qwen/qvq',
|
50
|
-
'qwen/qwq',
|
51
|
-
'thinking',
|
52
|
-
];
|
53
|
-
|
54
44
|
const modelsPage = (await client.models.list()) as any;
|
55
45
|
const modelList: OpenRouterModelCard[] = modelsPage.data;
|
56
|
-
|
46
|
+
|
57
47
|
const modelsExtraInfo: OpenRouterModelExtraInfo[] = [];
|
58
48
|
try {
|
59
49
|
const response = await fetch('https://openrouter.ai/api/frontend/models');
|
@@ -62,50 +52,51 @@ export const LobeOpenRouterAI = createOpenAICompatibleRuntime({
|
|
62
52
|
modelsExtraInfo.push(...data['data']);
|
63
53
|
}
|
64
54
|
} catch (error) {
|
65
|
-
// 忽略 fetch 错误,使用空的 modelsExtraInfo 数组继续处理
|
66
55
|
console.error('Failed to fetch OpenRouter frontend models:', error);
|
67
56
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
57
|
+
|
58
|
+
// 解析模型能力
|
59
|
+
const baseModels = await processMultiProviderModelList(modelList);
|
60
|
+
|
61
|
+
// 合并 OpenRouter 获取的模型信息
|
62
|
+
return baseModels.map((baseModel) => {
|
63
|
+
const model = modelList.find(m => m.id === baseModel.id);
|
64
|
+
const extraInfo = modelsExtraInfo.find(
|
65
|
+
(m) => m.slug.toLowerCase() === baseModel.id.toLowerCase(),
|
66
|
+
);
|
67
|
+
|
68
|
+
if (!model) return baseModel;
|
69
|
+
|
70
|
+
return {
|
71
|
+
...baseModel,
|
72
|
+
contextWindowTokens: model.context_length,
|
73
|
+
description: model.description,
|
74
|
+
displayName: model.name,
|
75
|
+
functionCall:
|
76
|
+
baseModel.functionCall ||
|
77
|
+
model.description.includes('function calling') ||
|
78
|
+
model.description.includes('tools') ||
|
79
|
+
extraInfo?.endpoint?.supports_tool_parameters ||
|
80
|
+
false,
|
81
|
+
maxTokens:
|
82
|
+
typeof model.top_provider.max_completion_tokens === 'number'
|
83
|
+
? model.top_provider.max_completion_tokens
|
84
|
+
: undefined,
|
85
|
+
pricing: {
|
86
|
+
input: formatPrice(model.pricing.prompt),
|
87
|
+
output: formatPrice(model.pricing.completion),
|
88
|
+
},
|
89
|
+
reasoning:
|
90
|
+
baseModel.reasoning ||
|
91
|
+
extraInfo?.endpoint?.supports_reasoning ||
|
92
|
+
false,
|
93
|
+
releasedAt: new Date(model.created * 1000).toISOString().split('T')[0],
|
94
|
+
vision:
|
95
|
+
baseModel.vision ||
|
96
|
+
model.architecture.modality.includes('image') ||
|
97
|
+
false,
|
98
|
+
};
|
99
|
+
}).filter(Boolean) as ChatModelCard[];
|
109
100
|
},
|
110
101
|
provider: ModelProvider.OpenRouter,
|
111
102
|
});
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import type { ChatModelCard } from '@/types/llm';
|
2
|
-
|
3
1
|
import { ModelProvider } from '../types';
|
2
|
+
import { processMultiProviderModelList } from '../utils/modelParse';
|
4
3
|
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
5
4
|
import { QwenAIStream } from '../utils/streams';
|
6
5
|
|
@@ -78,52 +77,10 @@ export const LobeQwenAI = createOpenAICompatibleRuntime({
|
|
78
77
|
chatCompletion: () => process.env.DEBUG_QWEN_CHAT_COMPLETION === '1',
|
79
78
|
},
|
80
79
|
models: async ({ client }) => {
|
81
|
-
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
82
|
-
|
83
|
-
const functionCallKeywords = [
|
84
|
-
'qwen-max',
|
85
|
-
'qwen-plus',
|
86
|
-
'qwen-turbo',
|
87
|
-
'qwen-long',
|
88
|
-
'qwen1.5',
|
89
|
-
'qwen2',
|
90
|
-
'qwen2.5',
|
91
|
-
'qwen3',
|
92
|
-
];
|
93
|
-
|
94
|
-
const visionKeywords = ['qvq', 'vl'];
|
95
|
-
|
96
|
-
const reasoningKeywords = ['qvq', 'qwq', 'deepseek-r1', 'qwen3'];
|
97
|
-
|
98
80
|
const modelsPage = (await client.models.list()) as any;
|
99
81
|
const modelList: QwenModelCard[] = modelsPage.data;
|
100
82
|
|
101
|
-
return modelList
|
102
|
-
.map((model) => {
|
103
|
-
const knownModel = LOBE_DEFAULT_MODEL_LIST.find(
|
104
|
-
(m) => model.id.toLowerCase() === m.id.toLowerCase(),
|
105
|
-
);
|
106
|
-
|
107
|
-
return {
|
108
|
-
contextWindowTokens: knownModel?.contextWindowTokens ?? undefined,
|
109
|
-
displayName: knownModel?.displayName ?? undefined,
|
110
|
-
enabled: knownModel?.enabled || false,
|
111
|
-
functionCall:
|
112
|
-
functionCallKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
113
|
-
knownModel?.abilities?.functionCall ||
|
114
|
-
false,
|
115
|
-
id: model.id,
|
116
|
-
reasoning:
|
117
|
-
reasoningKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
118
|
-
knownModel?.abilities?.reasoning ||
|
119
|
-
false,
|
120
|
-
vision:
|
121
|
-
visionKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
122
|
-
knownModel?.abilities?.vision ||
|
123
|
-
false,
|
124
|
-
};
|
125
|
-
})
|
126
|
-
.filter(Boolean) as ChatModelCard[];
|
83
|
+
return processMultiProviderModelList(modelList);
|
127
84
|
},
|
128
85
|
provider: ModelProvider.Qwen,
|
129
86
|
});
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import type { ChatModelCard } from '@/types/llm';
|
2
|
-
|
3
1
|
import { AgentRuntimeErrorType } from '../error';
|
4
2
|
import { ChatCompletionErrorPayload, ModelProvider } from '../types';
|
3
|
+
import { processMultiProviderModelList } from '../utils/modelParse';
|
5
4
|
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';
|
6
5
|
|
7
6
|
export interface SiliconCloudModelCard {
|
@@ -69,58 +68,10 @@ export const LobeSiliconCloudAI = createOpenAICompatibleRuntime({
|
|
69
68
|
invalidAPIKey: AgentRuntimeErrorType.InvalidProviderAPIKey,
|
70
69
|
},
|
71
70
|
models: async ({ client }) => {
|
72
|
-
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
73
|
-
|
74
|
-
const functionCallKeywords = [
|
75
|
-
'qwen/qwen3',
|
76
|
-
'qwen/qwen2.5',
|
77
|
-
'thudm/glm-4',
|
78
|
-
'deepseek-ai/deepseek',
|
79
|
-
'internlm/internlm2_5',
|
80
|
-
'meta-llama/meta-llama-3.1',
|
81
|
-
'meta-llama/meta-llama-3.3',
|
82
|
-
];
|
83
|
-
|
84
|
-
const visionKeywords = [
|
85
|
-
'opengvlab/internvl',
|
86
|
-
'qwen/qvq',
|
87
|
-
'qwen/qwen2-vl',
|
88
|
-
'teleai/telemm',
|
89
|
-
'deepseek-ai/deepseek-vl',
|
90
|
-
];
|
91
|
-
|
92
|
-
const reasoningKeywords = ['deepseek-ai/deepseek-r1', 'qwen/qvq', 'qwen/qwq', 'qwen/qwen3'];
|
93
|
-
|
94
71
|
const modelsPage = (await client.models.list()) as any;
|
95
72
|
const modelList: SiliconCloudModelCard[] = modelsPage.data;
|
96
73
|
|
97
|
-
return modelList
|
98
|
-
.map((model) => {
|
99
|
-
const knownModel = LOBE_DEFAULT_MODEL_LIST.find(
|
100
|
-
(m) => model.id.toLowerCase() === m.id.toLowerCase(),
|
101
|
-
);
|
102
|
-
|
103
|
-
return {
|
104
|
-
contextWindowTokens: knownModel?.contextWindowTokens ?? undefined,
|
105
|
-
displayName: knownModel?.displayName ?? undefined,
|
106
|
-
enabled: knownModel?.enabled || false,
|
107
|
-
functionCall:
|
108
|
-
(functionCallKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) &&
|
109
|
-
!model.id.toLowerCase().includes('deepseek-r1')) ||
|
110
|
-
knownModel?.abilities?.functionCall ||
|
111
|
-
false,
|
112
|
-
id: model.id,
|
113
|
-
reasoning:
|
114
|
-
reasoningKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
115
|
-
knownModel?.abilities?.reasoning ||
|
116
|
-
false,
|
117
|
-
vision:
|
118
|
-
visionKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
|
119
|
-
knownModel?.abilities?.vision ||
|
120
|
-
false,
|
121
|
-
};
|
122
|
-
})
|
123
|
-
.filter(Boolean) as ChatModelCard[];
|
74
|
+
return processMultiProviderModelList(modelList);
|
124
75
|
},
|
125
76
|
provider: ModelProvider.SiliconCloud,
|
126
77
|
});
|