@lobehub/chat 1.136.9 → 1.136.11
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/changelog/v1.json +18 -0
- package/package.json +1 -1
- package/packages/database/src/repositories/aiInfra/index.test.ts +234 -0
- package/packages/database/src/repositories/aiInfra/index.ts +106 -8
- package/packages/model-bank/src/types/aiModel.ts +2 -0
- package/packages/model-runtime/src/providers/google/index.ts +1 -1
- package/packages/model-runtime/src/providers/novita/__snapshots__/index.test.ts.snap +54 -0
- package/packages/model-runtime/src/providers/openai/__snapshots__/index.test.ts.snap +84 -0
- package/packages/model-runtime/src/utils/modelParse.test.ts +103 -0
- package/packages/model-runtime/src/utils/modelParse.ts +98 -23
- package/packages/model-runtime/src/utils/postProcessModelList.test.ts +0 -3
- package/packages/model-runtime/src/utils/postProcessModelList.ts +17 -4
- package/packages/prompts/src/prompts/index.ts +1 -0
- package/packages/prompts/src/prompts/search/crawlResults.test.ts +172 -0
- package/packages/prompts/src/prompts/search/crawlResults.ts +82 -0
- package/packages/prompts/src/prompts/search/index.ts +2 -0
- package/packages/prompts/src/prompts/search/searchResults.test.ts +138 -0
- package/packages/prompts/src/prompts/search/searchResults.ts +58 -0
- package/packages/prompts/src/prompts/search/xmlEscape.ts +21 -0
- package/packages/types/src/llm.ts +16 -0
- package/packages/types/src/tool/builtin.ts +8 -0
- package/packages/types/src/tool/index.ts +2 -0
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx +25 -0
- package/src/features/ChatInput/ActionBar/Search/Controls.tsx +47 -20
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/BuiltinPluginTitle.tsx +17 -13
- package/src/features/Conversation/Messages/Assistant/Tool/Inspector/ToolTitle.tsx +1 -8
- package/src/features/Conversation/Messages/Assistant/Tool/Render/Arguments/index.tsx +12 -16
- package/src/features/Conversation/Messages/Assistant/Tool/Render/LoadingPlaceholder/index.tsx +29 -0
- package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +26 -7
- package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +2 -0
- package/src/features/PluginsUI/Render/BuiltinType/index.test.tsx +5 -5
- package/src/features/PluginsUI/Render/BuiltinType/index.tsx +1 -7
- package/src/helpers/getSearchConfig.test.ts +41 -0
- package/src/helpers/getSearchConfig.ts +5 -1
- package/src/locales/default/modelProvider.ts +15 -0
- package/src/store/aiInfra/slices/aiModel/action.ts +3 -0
- package/src/store/aiInfra/slices/aiModel/selectors.ts +7 -0
- package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +5 -1
- package/src/store/chat/slices/aiChat/actions/generateAIChatV2.ts +5 -1
- package/src/store/chat/slices/builtinTool/actions/search.test.ts +4 -3
- package/src/store/chat/slices/builtinTool/actions/search.ts +23 -15
- package/src/store/chat/slices/message/selectors.ts +10 -0
- package/src/styles/text.ts +10 -7
- package/src/tools/placeholders.ts +8 -0
- package/src/tools/web-browsing/Placeholder/PageContent.tsx +27 -0
- package/src/tools/web-browsing/Placeholder/Search.tsx +65 -0
- package/src/tools/web-browsing/Placeholder/index.tsx +40 -0
- package/src/tools/web-browsing/Render/PageContent/Loading.tsx +14 -5
- package/src/tools/web-browsing/Render/PageContent/Result.tsx +14 -13
- package/src/tools/web-browsing/Render/PageContent/index.tsx +15 -6
- package/src/tools/web-browsing/Render/Search/SearchQuery/SearchView.tsx +13 -19
- package/src/tools/web-browsing/Render/Search/SearchResult/index.tsx +21 -26
- package/src/tools/web-browsing/components/EngineAvatar.tsx +8 -2
- package/src/tools/web-browsing/const.ts +8 -1
|
@@ -9,11 +9,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
9
9
|
"enabled": false,
|
|
10
10
|
"functionCall": false,
|
|
11
11
|
"id": "whisper-1",
|
|
12
|
+
"imageOutput": false,
|
|
12
13
|
"maxOutput": undefined,
|
|
13
14
|
"pricing": undefined,
|
|
14
15
|
"reasoning": false,
|
|
15
16
|
"releasedAt": "2023-02-27",
|
|
17
|
+
"search": false,
|
|
16
18
|
"type": "stt",
|
|
19
|
+
"video": false,
|
|
17
20
|
"vision": false,
|
|
18
21
|
},
|
|
19
22
|
{
|
|
@@ -23,11 +26,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
23
26
|
"enabled": false,
|
|
24
27
|
"functionCall": false,
|
|
25
28
|
"id": "davinci-002",
|
|
29
|
+
"imageOutput": false,
|
|
26
30
|
"maxOutput": undefined,
|
|
27
31
|
"pricing": undefined,
|
|
28
32
|
"reasoning": false,
|
|
29
33
|
"releasedAt": "2023-08-21",
|
|
34
|
+
"search": false,
|
|
30
35
|
"type": "chat",
|
|
36
|
+
"video": false,
|
|
31
37
|
"vision": false,
|
|
32
38
|
},
|
|
33
39
|
{
|
|
@@ -37,11 +43,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
37
43
|
"enabled": false,
|
|
38
44
|
"functionCall": true,
|
|
39
45
|
"id": "gpt-3.5-turbo",
|
|
46
|
+
"imageOutput": false,
|
|
40
47
|
"maxOutput": undefined,
|
|
41
48
|
"pricing": undefined,
|
|
42
49
|
"reasoning": false,
|
|
43
50
|
"releasedAt": "2023-02-28",
|
|
51
|
+
"search": false,
|
|
44
52
|
"type": "chat",
|
|
53
|
+
"video": false,
|
|
45
54
|
"vision": false,
|
|
46
55
|
},
|
|
47
56
|
{
|
|
@@ -51,6 +60,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
51
60
|
"enabled": false,
|
|
52
61
|
"functionCall": false,
|
|
53
62
|
"id": "dall-e-2",
|
|
63
|
+
"imageOutput": false,
|
|
54
64
|
"maxOutput": undefined,
|
|
55
65
|
"parameters": {
|
|
56
66
|
"imageUrl": {
|
|
@@ -71,7 +81,9 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
71
81
|
"pricing": undefined,
|
|
72
82
|
"reasoning": false,
|
|
73
83
|
"releasedAt": "2023-11-01",
|
|
84
|
+
"search": false,
|
|
74
85
|
"type": "image",
|
|
86
|
+
"video": false,
|
|
75
87
|
"vision": false,
|
|
76
88
|
},
|
|
77
89
|
{
|
|
@@ -81,11 +93,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
81
93
|
"enabled": false,
|
|
82
94
|
"functionCall": false,
|
|
83
95
|
"id": "gpt-3.5-turbo-16k",
|
|
96
|
+
"imageOutput": false,
|
|
84
97
|
"maxOutput": undefined,
|
|
85
98
|
"pricing": undefined,
|
|
86
99
|
"reasoning": false,
|
|
87
100
|
"releasedAt": "2023-05-10",
|
|
101
|
+
"search": false,
|
|
88
102
|
"type": "chat",
|
|
103
|
+
"video": false,
|
|
89
104
|
"vision": false,
|
|
90
105
|
},
|
|
91
106
|
{
|
|
@@ -95,11 +110,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
95
110
|
"enabled": false,
|
|
96
111
|
"functionCall": false,
|
|
97
112
|
"id": "tts-1-hd-1106",
|
|
113
|
+
"imageOutput": false,
|
|
98
114
|
"maxOutput": undefined,
|
|
99
115
|
"pricing": undefined,
|
|
100
116
|
"reasoning": false,
|
|
101
117
|
"releasedAt": "2023-11-03",
|
|
118
|
+
"search": false,
|
|
102
119
|
"type": "chat",
|
|
120
|
+
"video": false,
|
|
103
121
|
"vision": false,
|
|
104
122
|
},
|
|
105
123
|
{
|
|
@@ -109,11 +127,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
109
127
|
"enabled": false,
|
|
110
128
|
"functionCall": false,
|
|
111
129
|
"id": "tts-1-hd",
|
|
130
|
+
"imageOutput": false,
|
|
112
131
|
"maxOutput": undefined,
|
|
113
132
|
"pricing": undefined,
|
|
114
133
|
"reasoning": false,
|
|
115
134
|
"releasedAt": "2023-11-03",
|
|
135
|
+
"search": false,
|
|
116
136
|
"type": "tts",
|
|
137
|
+
"video": false,
|
|
117
138
|
"vision": false,
|
|
118
139
|
},
|
|
119
140
|
{
|
|
@@ -123,11 +144,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
123
144
|
"enabled": false,
|
|
124
145
|
"functionCall": false,
|
|
125
146
|
"id": "gpt-3.5-turbo-16k-0613",
|
|
147
|
+
"imageOutput": false,
|
|
126
148
|
"maxOutput": undefined,
|
|
127
149
|
"pricing": undefined,
|
|
128
150
|
"reasoning": false,
|
|
129
151
|
"releasedAt": "2023-05-30",
|
|
152
|
+
"search": false,
|
|
130
153
|
"type": "chat",
|
|
154
|
+
"video": false,
|
|
131
155
|
"vision": false,
|
|
132
156
|
},
|
|
133
157
|
{
|
|
@@ -137,11 +161,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
137
161
|
"enabled": false,
|
|
138
162
|
"functionCall": false,
|
|
139
163
|
"id": "text-embedding-3-large",
|
|
164
|
+
"imageOutput": false,
|
|
140
165
|
"maxOutput": undefined,
|
|
141
166
|
"pricing": undefined,
|
|
142
167
|
"reasoning": false,
|
|
143
168
|
"releasedAt": "2024-01-22",
|
|
169
|
+
"search": false,
|
|
144
170
|
"type": "embedding",
|
|
171
|
+
"video": false,
|
|
145
172
|
"vision": false,
|
|
146
173
|
},
|
|
147
174
|
{
|
|
@@ -151,11 +178,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
151
178
|
"enabled": false,
|
|
152
179
|
"functionCall": false,
|
|
153
180
|
"id": "gpt-4-1106-vision-preview",
|
|
181
|
+
"imageOutput": false,
|
|
154
182
|
"maxOutput": undefined,
|
|
155
183
|
"pricing": undefined,
|
|
156
184
|
"reasoning": false,
|
|
157
185
|
"releasedAt": "2024-03-26",
|
|
186
|
+
"search": false,
|
|
158
187
|
"type": "chat",
|
|
188
|
+
"video": false,
|
|
159
189
|
"vision": false,
|
|
160
190
|
},
|
|
161
191
|
{
|
|
@@ -165,11 +195,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
165
195
|
"enabled": false,
|
|
166
196
|
"functionCall": false,
|
|
167
197
|
"id": "gpt-3.5-turbo-instruct-0914",
|
|
198
|
+
"imageOutput": false,
|
|
168
199
|
"maxOutput": undefined,
|
|
169
200
|
"pricing": undefined,
|
|
170
201
|
"reasoning": false,
|
|
171
202
|
"releasedAt": "2023-09-07",
|
|
203
|
+
"search": false,
|
|
172
204
|
"type": "chat",
|
|
205
|
+
"video": false,
|
|
173
206
|
"vision": false,
|
|
174
207
|
},
|
|
175
208
|
{
|
|
@@ -179,11 +212,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
179
212
|
"enabled": false,
|
|
180
213
|
"functionCall": true,
|
|
181
214
|
"id": "gpt-4-0125-preview",
|
|
215
|
+
"imageOutput": false,
|
|
182
216
|
"maxOutput": undefined,
|
|
183
217
|
"pricing": undefined,
|
|
184
218
|
"reasoning": false,
|
|
185
219
|
"releasedAt": "2024-01-23",
|
|
220
|
+
"search": false,
|
|
186
221
|
"type": "chat",
|
|
222
|
+
"video": false,
|
|
187
223
|
"vision": false,
|
|
188
224
|
},
|
|
189
225
|
{
|
|
@@ -193,11 +229,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
193
229
|
"enabled": false,
|
|
194
230
|
"functionCall": true,
|
|
195
231
|
"id": "gpt-4-turbo-preview",
|
|
232
|
+
"imageOutput": false,
|
|
196
233
|
"maxOutput": undefined,
|
|
197
234
|
"pricing": undefined,
|
|
198
235
|
"reasoning": false,
|
|
199
236
|
"releasedAt": "2024-01-23",
|
|
237
|
+
"search": false,
|
|
200
238
|
"type": "chat",
|
|
239
|
+
"video": false,
|
|
201
240
|
"vision": false,
|
|
202
241
|
},
|
|
203
242
|
{
|
|
@@ -207,11 +246,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
207
246
|
"enabled": false,
|
|
208
247
|
"functionCall": false,
|
|
209
248
|
"id": "gpt-3.5-turbo-instruct",
|
|
249
|
+
"imageOutput": false,
|
|
210
250
|
"maxOutput": undefined,
|
|
211
251
|
"pricing": undefined,
|
|
212
252
|
"reasoning": false,
|
|
213
253
|
"releasedAt": "2023-08-24",
|
|
254
|
+
"search": false,
|
|
214
255
|
"type": "chat",
|
|
256
|
+
"video": false,
|
|
215
257
|
"vision": false,
|
|
216
258
|
},
|
|
217
259
|
{
|
|
@@ -221,11 +263,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
221
263
|
"enabled": false,
|
|
222
264
|
"functionCall": false,
|
|
223
265
|
"id": "gpt-3.5-turbo-0301",
|
|
266
|
+
"imageOutput": false,
|
|
224
267
|
"maxOutput": undefined,
|
|
225
268
|
"pricing": undefined,
|
|
226
269
|
"reasoning": false,
|
|
227
270
|
"releasedAt": "2023-03-01",
|
|
271
|
+
"search": false,
|
|
228
272
|
"type": "chat",
|
|
273
|
+
"video": false,
|
|
229
274
|
"vision": false,
|
|
230
275
|
},
|
|
231
276
|
{
|
|
@@ -235,11 +280,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
235
280
|
"enabled": false,
|
|
236
281
|
"functionCall": false,
|
|
237
282
|
"id": "gpt-3.5-turbo-0613",
|
|
283
|
+
"imageOutput": false,
|
|
238
284
|
"maxOutput": undefined,
|
|
239
285
|
"pricing": undefined,
|
|
240
286
|
"reasoning": false,
|
|
241
287
|
"releasedAt": "2023-06-12",
|
|
288
|
+
"search": false,
|
|
242
289
|
"type": "chat",
|
|
290
|
+
"video": false,
|
|
243
291
|
"vision": false,
|
|
244
292
|
},
|
|
245
293
|
{
|
|
@@ -249,11 +297,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
249
297
|
"enabled": false,
|
|
250
298
|
"functionCall": false,
|
|
251
299
|
"id": "tts-1",
|
|
300
|
+
"imageOutput": false,
|
|
252
301
|
"maxOutput": undefined,
|
|
253
302
|
"pricing": undefined,
|
|
254
303
|
"reasoning": false,
|
|
255
304
|
"releasedAt": "2023-04-19",
|
|
305
|
+
"search": false,
|
|
256
306
|
"type": "tts",
|
|
307
|
+
"video": false,
|
|
257
308
|
"vision": false,
|
|
258
309
|
},
|
|
259
310
|
{
|
|
@@ -263,6 +314,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
263
314
|
"enabled": false,
|
|
264
315
|
"functionCall": false,
|
|
265
316
|
"id": "dall-e-3",
|
|
317
|
+
"imageOutput": false,
|
|
266
318
|
"maxOutput": undefined,
|
|
267
319
|
"parameters": {
|
|
268
320
|
"prompt": {
|
|
@@ -287,7 +339,9 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
287
339
|
"pricing": undefined,
|
|
288
340
|
"reasoning": false,
|
|
289
341
|
"releasedAt": "2023-10-31",
|
|
342
|
+
"search": false,
|
|
290
343
|
"type": "image",
|
|
344
|
+
"video": false,
|
|
291
345
|
"vision": false,
|
|
292
346
|
},
|
|
293
347
|
{
|
|
@@ -297,11 +351,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
297
351
|
"enabled": false,
|
|
298
352
|
"functionCall": true,
|
|
299
353
|
"id": "gpt-3.5-turbo-1106",
|
|
354
|
+
"imageOutput": false,
|
|
300
355
|
"maxOutput": undefined,
|
|
301
356
|
"pricing": undefined,
|
|
302
357
|
"reasoning": false,
|
|
303
358
|
"releasedAt": "2023-11-02",
|
|
359
|
+
"search": false,
|
|
304
360
|
"type": "chat",
|
|
361
|
+
"video": false,
|
|
305
362
|
"vision": false,
|
|
306
363
|
},
|
|
307
364
|
{
|
|
@@ -311,11 +368,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
311
368
|
"enabled": false,
|
|
312
369
|
"functionCall": true,
|
|
313
370
|
"id": "gpt-4-1106-preview",
|
|
371
|
+
"imageOutput": false,
|
|
314
372
|
"maxOutput": undefined,
|
|
315
373
|
"pricing": undefined,
|
|
316
374
|
"reasoning": false,
|
|
317
375
|
"releasedAt": "2023-11-02",
|
|
376
|
+
"search": false,
|
|
318
377
|
"type": "chat",
|
|
378
|
+
"video": false,
|
|
319
379
|
"vision": false,
|
|
320
380
|
},
|
|
321
381
|
{
|
|
@@ -325,11 +385,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
325
385
|
"enabled": false,
|
|
326
386
|
"functionCall": false,
|
|
327
387
|
"id": "babbage-002",
|
|
388
|
+
"imageOutput": false,
|
|
328
389
|
"maxOutput": undefined,
|
|
329
390
|
"pricing": undefined,
|
|
330
391
|
"reasoning": false,
|
|
331
392
|
"releasedAt": "2023-08-21",
|
|
393
|
+
"search": false,
|
|
332
394
|
"type": "chat",
|
|
395
|
+
"video": false,
|
|
333
396
|
"vision": false,
|
|
334
397
|
},
|
|
335
398
|
{
|
|
@@ -339,11 +402,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
339
402
|
"enabled": false,
|
|
340
403
|
"functionCall": false,
|
|
341
404
|
"id": "tts-1-1106",
|
|
405
|
+
"imageOutput": false,
|
|
342
406
|
"maxOutput": undefined,
|
|
343
407
|
"pricing": undefined,
|
|
344
408
|
"reasoning": false,
|
|
345
409
|
"releasedAt": "2023-11-03",
|
|
410
|
+
"search": false,
|
|
346
411
|
"type": "chat",
|
|
412
|
+
"video": false,
|
|
347
413
|
"vision": false,
|
|
348
414
|
},
|
|
349
415
|
{
|
|
@@ -353,11 +419,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
353
419
|
"enabled": false,
|
|
354
420
|
"functionCall": false,
|
|
355
421
|
"id": "gpt-4-vision-preview",
|
|
422
|
+
"imageOutput": false,
|
|
356
423
|
"maxOutput": undefined,
|
|
357
424
|
"pricing": undefined,
|
|
358
425
|
"reasoning": false,
|
|
359
426
|
"releasedAt": "2023-11-02",
|
|
427
|
+
"search": false,
|
|
360
428
|
"type": "chat",
|
|
429
|
+
"video": false,
|
|
361
430
|
"vision": true,
|
|
362
431
|
},
|
|
363
432
|
{
|
|
@@ -367,11 +436,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
367
436
|
"enabled": false,
|
|
368
437
|
"functionCall": false,
|
|
369
438
|
"id": "text-embedding-3-small",
|
|
439
|
+
"imageOutput": false,
|
|
370
440
|
"maxOutput": undefined,
|
|
371
441
|
"pricing": undefined,
|
|
372
442
|
"reasoning": false,
|
|
373
443
|
"releasedAt": "2024-01-22",
|
|
444
|
+
"search": false,
|
|
374
445
|
"type": "embedding",
|
|
446
|
+
"video": false,
|
|
375
447
|
"vision": false,
|
|
376
448
|
},
|
|
377
449
|
{
|
|
@@ -381,11 +453,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
381
453
|
"enabled": false,
|
|
382
454
|
"functionCall": true,
|
|
383
455
|
"id": "gpt-4",
|
|
456
|
+
"imageOutput": false,
|
|
384
457
|
"maxOutput": undefined,
|
|
385
458
|
"pricing": undefined,
|
|
386
459
|
"reasoning": false,
|
|
387
460
|
"releasedAt": "2023-06-27",
|
|
461
|
+
"search": false,
|
|
388
462
|
"type": "chat",
|
|
463
|
+
"video": false,
|
|
389
464
|
"vision": false,
|
|
390
465
|
},
|
|
391
466
|
{
|
|
@@ -395,11 +470,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
395
470
|
"enabled": false,
|
|
396
471
|
"functionCall": false,
|
|
397
472
|
"id": "text-embedding-ada-002",
|
|
473
|
+
"imageOutput": false,
|
|
398
474
|
"maxOutput": undefined,
|
|
399
475
|
"pricing": undefined,
|
|
400
476
|
"reasoning": false,
|
|
401
477
|
"releasedAt": "2022-12-16",
|
|
478
|
+
"search": false,
|
|
402
479
|
"type": "embedding",
|
|
480
|
+
"video": false,
|
|
403
481
|
"vision": false,
|
|
404
482
|
},
|
|
405
483
|
{
|
|
@@ -409,11 +487,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
409
487
|
"enabled": false,
|
|
410
488
|
"functionCall": true,
|
|
411
489
|
"id": "gpt-3.5-turbo-0125",
|
|
490
|
+
"imageOutput": false,
|
|
412
491
|
"maxOutput": undefined,
|
|
413
492
|
"pricing": undefined,
|
|
414
493
|
"reasoning": false,
|
|
415
494
|
"releasedAt": "2024-01-23",
|
|
495
|
+
"search": false,
|
|
416
496
|
"type": "chat",
|
|
497
|
+
"video": false,
|
|
417
498
|
"vision": false,
|
|
418
499
|
},
|
|
419
500
|
{
|
|
@@ -423,11 +504,14 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
|
|
423
504
|
"enabled": false,
|
|
424
505
|
"functionCall": true,
|
|
425
506
|
"id": "gpt-4-0613",
|
|
507
|
+
"imageOutput": false,
|
|
426
508
|
"maxOutput": undefined,
|
|
427
509
|
"pricing": undefined,
|
|
428
510
|
"reasoning": false,
|
|
429
511
|
"releasedAt": "2023-06-12",
|
|
512
|
+
"search": false,
|
|
430
513
|
"type": "chat",
|
|
514
|
+
"video": false,
|
|
431
515
|
"vision": false,
|
|
432
516
|
},
|
|
433
517
|
]
|
|
@@ -99,6 +99,14 @@ const mockDefaultModelList: (Partial<ChatModelCard> & { id: string })[] = [
|
|
|
99
99
|
// Mock the import
|
|
100
100
|
vi.mock('model-bank', () => ({
|
|
101
101
|
LOBE_DEFAULT_MODEL_LIST: mockDefaultModelList,
|
|
102
|
+
// 新增 provider 专用清单,供 findKnownModelByProvider 使用
|
|
103
|
+
google: [
|
|
104
|
+
{
|
|
105
|
+
id: 'gemini-2.5-pro',
|
|
106
|
+
displayName: 'Gemini 2.5 Pro',
|
|
107
|
+
abilities: { search: true, functionCall: true, reasoning: true, vision: true },
|
|
108
|
+
},
|
|
109
|
+
],
|
|
102
110
|
}));
|
|
103
111
|
|
|
104
112
|
describe('modelParse', () => {
|
|
@@ -151,6 +159,14 @@ describe('modelParse', () => {
|
|
|
151
159
|
});
|
|
152
160
|
});
|
|
153
161
|
|
|
162
|
+
// New sanity tests for your added config
|
|
163
|
+
describe('MODEL_LIST_CONFIGS sanity', () => {
|
|
164
|
+
it('google.imageOutputKeywords should include "-image-" for image-output capability inference', () => {
|
|
165
|
+
expect(MODEL_LIST_CONFIGS.google.imageOutputKeywords).toBeDefined();
|
|
166
|
+
expect(MODEL_LIST_CONFIGS.google.imageOutputKeywords).toContain('-image-');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
154
170
|
describe('processModelList', () => {
|
|
155
171
|
it('should process a list of models with the given provider config', async () => {
|
|
156
172
|
const modelList = [{ id: 'gpt-4o' }, { id: 'gpt-3.5-turbo' }];
|
|
@@ -220,6 +236,52 @@ describe('modelParse', () => {
|
|
|
220
236
|
expect(Array.isArray(result)).toBe(true);
|
|
221
237
|
});
|
|
222
238
|
|
|
239
|
+
// New search & imageOutput focused tests for single provider path
|
|
240
|
+
describe('search and imageOutput (processModelList)', () => {
|
|
241
|
+
it('openai: default search keywords should make "*-search" models support search', async () => {
|
|
242
|
+
// openai config does not define searchKeywords, so DEFAULT_SEARCH_KEYWORDS ['-search'] applies
|
|
243
|
+
const out = await processModelList([{ id: 'gpt-4o-search' }], MODEL_LIST_CONFIGS.openai, 'openai');
|
|
244
|
+
expect(out).toHaveLength(1);
|
|
245
|
+
expect(out[0].search).toBe(true);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('openai: models without "-search" should not get search by default', async () => {
|
|
249
|
+
const out = await processModelList([{ id: 'gpt-4o' }], MODEL_LIST_CONFIGS.openai, 'openai');
|
|
250
|
+
expect(out).toHaveLength(1);
|
|
251
|
+
expect(out[0].search).toBe(false);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('openai: "-search" models with excluded keywords (audio) should not get search', async () => {
|
|
255
|
+
const out = await processModelList(
|
|
256
|
+
[{ id: 'gpt-4o-search-audio' }],
|
|
257
|
+
MODEL_LIST_CONFIGS.openai,
|
|
258
|
+
'openai',
|
|
259
|
+
);
|
|
260
|
+
expect(out).toHaveLength(1);
|
|
261
|
+
expect(out[0].search).toBe(false);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it('google: gemini-* with "-image-" in id should infer imageOutput=true via keywords and remain chat type', async () => {
|
|
265
|
+
const out = await processModelList(
|
|
266
|
+
[{ id: 'gemini-2.5-image-pro' }],
|
|
267
|
+
MODEL_LIST_CONFIGS.google,
|
|
268
|
+
'google',
|
|
269
|
+
);
|
|
270
|
+
expect(out).toHaveLength(1);
|
|
271
|
+
expect(out[0].imageOutput).toBe(true);
|
|
272
|
+
// due to '!gemini' exclusion in IMAGE_MODEL_KEYWORDS
|
|
273
|
+
expect(out[0].type).toBe('chat');
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it('google: gemini-* without "-image-" should not infer imageOutput and get search=true via known google model', async () => {
|
|
277
|
+
const out = await processModelList([{ id: 'gemini-2.5-pro' }], MODEL_LIST_CONFIGS.google, 'google');
|
|
278
|
+
expect(out).toHaveLength(1);
|
|
279
|
+
expect(out[0].displayName).toBe('Gemini 2.5 Pro');
|
|
280
|
+
expect(out[0].search).toBe(true);
|
|
281
|
+
expect(out[0].imageOutput).toBe(false);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
223
285
|
describe('Detailed capability and property processing in processModelList', () => {
|
|
224
286
|
const config = MODEL_LIST_CONFIGS.openai;
|
|
225
287
|
|
|
@@ -411,6 +473,47 @@ describe('modelParse', () => {
|
|
|
411
473
|
expect(model.reasoning).toBe(true); // 从 knownModel.abilities.reasoning
|
|
412
474
|
});
|
|
413
475
|
|
|
476
|
+
// New search & imageOutput focused tests for multi-provider path
|
|
477
|
+
describe('search and imageOutput (processMultiProviderModelList)', () => {
|
|
478
|
+
it('non-google provider gemini-2.5-pro should still get search=true via known google model', async () => {
|
|
479
|
+
// Simulate a mixed/custom list. Even if called with providerid='openai',
|
|
480
|
+
// detectModelProvider('gemini-2.5-pro') => 'google'
|
|
481
|
+
// knownModel (google list) has abilities.search=true, so final search=true
|
|
482
|
+
const out = await processMultiProviderModelList([{ id: 'gemini-2.5-pro' }], 'openai');
|
|
483
|
+
expect(out).toHaveLength(1);
|
|
484
|
+
const m = out[0];
|
|
485
|
+
expect(m.id).toBe('gemini-2.5-pro');
|
|
486
|
+
expect(m.displayName).toBe('Gemini 2.5 Pro');
|
|
487
|
+
expect(m.search).toBe(true);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it('default search keywords should make "*-search" models support search', async () => {
|
|
491
|
+
const out = await processMultiProviderModelList([{ id: 'gpt-4o-search'}]);
|
|
492
|
+
expect(out).toHaveLength(1);
|
|
493
|
+
expect(out[0].search).toBe(true);
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
it('google: gemini-* with "-image-" in id should infer imageOutput=true via keywords', async () => {
|
|
497
|
+
const out = await processMultiProviderModelList([{ id: 'gemini-2.5-image-pro' }]);
|
|
498
|
+
expect(out).toHaveLength(1);
|
|
499
|
+
expect(out[0].imageOutput).toBe(true);
|
|
500
|
+
// and still a chat model due to "!gemini" image-type exclusion
|
|
501
|
+
expect(out[0].type).toBe('chat');
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it('openai: "-search" + "audio" should be suppressed by excludeKeywords', async () => {
|
|
505
|
+
const out = await processMultiProviderModelList([{ id: 'gpt-4o-search-audio' }], 'openai');
|
|
506
|
+
expect(out).toHaveLength(1);
|
|
507
|
+
expect(out[0].search).toBe(false);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it('google: gemini-* without "-image-" should not infer imageOutput', async () => {
|
|
511
|
+
const out = await processMultiProviderModelList([{ id: 'gemini-2.5-pro' }]);
|
|
512
|
+
expect(out).toHaveLength(1);
|
|
513
|
+
expect(out[0].imageOutput).toBe(false);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
|
|
414
517
|
describe('Extended tests for detectModelProvider', () => {
|
|
415
518
|
it('should handle unusual casing patterns', () => {
|
|
416
519
|
expect(detectModelProvider('gPt-4')).toBe('openai');
|