@lobehub/chat 1.87.3 → 1.87.5
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/apps/desktop/src/main/core/App.ts +4 -0
- package/changelog/v1.json +18 -0
- package/docs/usage/providers/vllm.zh-CN.mdx +2 -2
- package/package.json +76 -76
- package/src/config/aiModels/google.ts +41 -52
- package/src/config/aiModels/groq.ts +11 -0
- package/src/config/aiModels/novita.ts +101 -2
- package/src/config/aiModels/sensenova.ts +33 -13
- package/src/features/InitClientDB/ErrorResult.tsx +0 -3
- package/src/libs/model-runtime/google/index.ts +2 -0
- package/src/libs/model-runtime/sensenova/index.ts +6 -4
- package/src/libs/model-runtime/utils/sensenovaHelpers.ts +14 -3
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.87.5](https://github.com/lobehub/lobe-chat/compare/v1.87.4...v1.87.5)
|
6
|
+
|
7
|
+
<sup>Released on **2025-05-20**</sup>
|
8
|
+
|
9
|
+
#### 🐛 Bug Fixes
|
10
|
+
|
11
|
+
- **misc**: Fix desktop open issue on linux like Fedora42.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### What's fixed
|
19
|
+
|
20
|
+
- **misc**: Fix desktop open issue on linux like Fedora42, closes [#7883](https://github.com/lobehub/lobe-chat/issues/7883) ([5b0154f](https://github.com/lobehub/lobe-chat/commit/5b0154f))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.87.4](https://github.com/lobehub/lobe-chat/compare/v1.87.3...v1.87.4)
|
31
|
+
|
32
|
+
<sup>Released on **2025-05-18**</sup>
|
33
|
+
|
34
|
+
#### 🐛 Bug Fixes
|
35
|
+
|
36
|
+
- **misc**: Supported SenseNova v6 models correctly & update Gemini models.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### What's fixed
|
44
|
+
|
45
|
+
- **misc**: Supported SenseNova v6 models correctly & update Gemini models, closes [#7778](https://github.com/lobehub/lobe-chat/issues/7778) ([e2b5ed3](https://github.com/lobehub/lobe-chat/commit/e2b5ed3))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.87.3](https://github.com/lobehub/lobe-chat/compare/v1.87.2...v1.87.3)
|
6
56
|
|
7
57
|
<sup>Released on **2025-05-17**</sup>
|
@@ -186,6 +186,10 @@ export class App {
|
|
186
186
|
}
|
187
187
|
});
|
188
188
|
|
189
|
+
// refs: https://github.com/lobehub/lobe-chat/pull/7883
|
190
|
+
// https://github.com/electron/electron/issues/46538#issuecomment-2808806722
|
191
|
+
app.commandLine.appendSwitch('gtk-version', '3');
|
192
|
+
|
189
193
|
app.commandLine.appendSwitch('enable-features', this.chromeFlags.join(','));
|
190
194
|
|
191
195
|
logger.debug('Waiting for app to be ready');
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"fixes": [
|
5
|
+
"Fix desktop open issue on linux like Fedora42."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-05-20",
|
9
|
+
"version": "1.87.5"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"fixes": [
|
14
|
+
"Supported SenseNova v6 models correctly & update Gemini models."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-05-18",
|
18
|
+
"version": "1.87.4"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"improvements": [
|
@@ -19,7 +19,7 @@ tags:
|
|
19
19
|
<Steps>
|
20
20
|
### 步骤一:准备工作
|
21
21
|
|
22
|
-
vLLM
|
22
|
+
vLLM 对于硬件和软件环境均有一定要求,请务必根据以下要求进行配置:
|
23
23
|
|
24
24
|
| 硬件需求 | |
|
25
25
|
| --------- | ----------------------------------------------------------------------- |
|
@@ -95,4 +95,4 @@ tags:
|
|
95
95
|
<Image alt={'选择 vLLM 模型'} inStep src={'https://github.com/user-attachments/assets/fcdfb9c5-819a-488f-b28d-0857fe861219'} />
|
96
96
|
</Steps>
|
97
97
|
|
98
|
-
至此你已经可以在 LobeChat 中使用 vLLM 提供的模型进行对话了。
|
98
|
+
至此你已经可以在 LobeChat 中使用 vLLM 提供的模型进行对话了。
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.87.
|
3
|
+
"version": "1.87.5",
|
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",
|
@@ -121,26 +121,26 @@
|
|
121
121
|
"dependencies": {
|
122
122
|
"@ant-design/icons": "^5.6.1",
|
123
123
|
"@ant-design/pro-components": "^2.8.7",
|
124
|
-
"@anthropic-ai/sdk": "^0.
|
124
|
+
"@anthropic-ai/sdk": "^0.51.0",
|
125
125
|
"@auth/core": "^0.38.0",
|
126
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
127
|
-
"@aws-sdk/client-s3": "^3.
|
128
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
126
|
+
"@aws-sdk/client-bedrock-runtime": "^3.812.0",
|
127
|
+
"@aws-sdk/client-s3": "^3.812.0",
|
128
|
+
"@aws-sdk/s3-request-presigner": "^3.812.0",
|
129
129
|
"@azure-rest/ai-inference": "1.0.0-beta.5",
|
130
130
|
"@azure/core-auth": "^1.9.0",
|
131
131
|
"@cfworker/json-schema": "^4.1.1",
|
132
|
-
"@clerk/localizations": "^3.
|
133
|
-
"@clerk/nextjs": "^6.
|
134
|
-
"@clerk/themes": "^2.2.
|
132
|
+
"@clerk/localizations": "^3.16.0",
|
133
|
+
"@clerk/nextjs": "^6.19.4",
|
134
|
+
"@clerk/themes": "^2.2.45",
|
135
135
|
"@codesandbox/sandpack-react": "^2.20.0",
|
136
136
|
"@cyntler/react-doc-viewer": "^1.17.0",
|
137
137
|
"@electric-sql/pglite": "0.2.17",
|
138
|
-
"@google-cloud/vertexai": "^1.
|
139
|
-
"@google/generative-ai": "^0.24.
|
138
|
+
"@google-cloud/vertexai": "^1.10.0",
|
139
|
+
"@google/generative-ai": "^0.24.1",
|
140
140
|
"@huggingface/inference": "^2.8.1",
|
141
141
|
"@icons-pack/react-simple-icons": "9.6.0",
|
142
142
|
"@khmyznikov/pwa-install": "0.3.9",
|
143
|
-
"@langchain/community": "^0.3.
|
143
|
+
"@langchain/community": "^0.3.43",
|
144
144
|
"@lobechat/electron-client-ipc": "workspace:*",
|
145
145
|
"@lobechat/electron-server-ipc": "workspace:*",
|
146
146
|
"@lobechat/file-loaders": "workspace:*",
|
@@ -150,96 +150,96 @@
|
|
150
150
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
151
151
|
"@lobehub/icons": "^2.0.0",
|
152
152
|
"@lobehub/tts": "^2.0.1",
|
153
|
-
"@lobehub/ui": "^2.1.
|
154
|
-
"@modelcontextprotocol/sdk": "^1.11.
|
153
|
+
"@lobehub/ui": "^2.1.6",
|
154
|
+
"@modelcontextprotocol/sdk": "^1.11.4",
|
155
155
|
"@neondatabase/serverless": "^1.0.0",
|
156
|
-
"@next/third-parties": "^15.3.
|
156
|
+
"@next/third-parties": "^15.3.2",
|
157
157
|
"@react-spring/web": "^9.7.5",
|
158
158
|
"@sentry/nextjs": "^7.120.3",
|
159
|
-
"@serwist/next": "^9.0.
|
159
|
+
"@serwist/next": "^9.0.14",
|
160
160
|
"@t3-oss/env-nextjs": "^0.12.0",
|
161
|
-
"@tanstack/react-query": "^5.
|
162
|
-
"@trpc/client": "^11.
|
163
|
-
"@trpc/next": "^11.
|
164
|
-
"@trpc/react-query": "^11.
|
165
|
-
"@trpc/server": "^11.
|
161
|
+
"@tanstack/react-query": "^5.76.1",
|
162
|
+
"@trpc/client": "^11.1.2",
|
163
|
+
"@trpc/next": "^11.1.2",
|
164
|
+
"@trpc/react-query": "^11.1.2",
|
165
|
+
"@trpc/server": "^11.1.2",
|
166
166
|
"@vercel/analytics": "^1.5.0",
|
167
167
|
"@vercel/edge-config": "^1.4.0",
|
168
|
-
"@vercel/functions": "^2.
|
168
|
+
"@vercel/functions": "^2.1.0",
|
169
169
|
"@vercel/speed-insights": "^1.2.0",
|
170
170
|
"@xterm/xterm": "^5.5.0",
|
171
|
-
"ahooks": "^3.8.
|
171
|
+
"ahooks": "^3.8.5",
|
172
172
|
"ai": "^3.4.33",
|
173
|
-
"antd": "^5.25.
|
173
|
+
"antd": "^5.25.2",
|
174
174
|
"antd-style": "^3.7.1",
|
175
175
|
"brotli-wasm": "^3.0.1",
|
176
176
|
"chroma-js": "^3.1.2",
|
177
|
-
"countries-and-timezones": "^3.
|
177
|
+
"countries-and-timezones": "^3.8.0",
|
178
178
|
"dayjs": "^1.11.13",
|
179
|
-
"debug": "^4.4.
|
179
|
+
"debug": "^4.4.1",
|
180
180
|
"dexie": "^3.2.7",
|
181
181
|
"diff": "^7.0.0",
|
182
182
|
"drizzle-orm": "^0.41.0",
|
183
183
|
"drizzle-zod": "^0.5.1",
|
184
184
|
"epub2": "^3.0.2",
|
185
185
|
"fast-deep-equal": "^3.1.3",
|
186
|
-
"file-type": "^20.
|
187
|
-
"framer-motion": "^12.
|
186
|
+
"file-type": "^20.5.0",
|
187
|
+
"framer-motion": "^12.12.1",
|
188
188
|
"gpt-tokenizer": "^2.9.0",
|
189
189
|
"html-to-text": "^9.0.5",
|
190
190
|
"i18next": "^24.2.3",
|
191
|
-
"i18next-browser-languagedetector": "^8.0
|
191
|
+
"i18next-browser-languagedetector": "^8.1.0",
|
192
192
|
"i18next-resources-to-backend": "^1.2.1",
|
193
|
-
"idb-keyval": "^6.2.
|
193
|
+
"idb-keyval": "^6.2.2",
|
194
194
|
"immer": "^10.1.1",
|
195
195
|
"jose": "^5.10.0",
|
196
196
|
"js-sha256": "^0.11.0",
|
197
197
|
"jsonl-parse-stringify": "^1.0.3",
|
198
198
|
"keyv": "^4.5.4",
|
199
|
-
"langchain": "^0.3.
|
200
|
-
"langfuse": "^3.37.
|
201
|
-
"langfuse-core": "^3.37.
|
199
|
+
"langchain": "^0.3.26",
|
200
|
+
"langfuse": "^3.37.2",
|
201
|
+
"langfuse-core": "^3.37.2",
|
202
202
|
"lodash-es": "^4.17.21",
|
203
203
|
"lucide-react": "^0.509.0",
|
204
204
|
"mammoth": "^1.9.0",
|
205
205
|
"mdast-util-to-markdown": "^2.1.2",
|
206
206
|
"modern-screenshot": "^4.6.0",
|
207
207
|
"nanoid": "^5.1.5",
|
208
|
-
"next": "^15.3.
|
208
|
+
"next": "^15.3.2",
|
209
209
|
"next-auth": "5.0.0-beta.25",
|
210
210
|
"next-mdx-remote": "^5.0.0",
|
211
211
|
"nextjs-toploader": "^3.8.16",
|
212
212
|
"numeral": "^2.0.6",
|
213
|
-
"nuqs": "^2.4.
|
213
|
+
"nuqs": "^2.4.3",
|
214
214
|
"officeparser": "^5.1.1",
|
215
|
-
"oidc-provider": "^8.
|
216
|
-
"ollama": "^0.5.
|
217
|
-
"openai": "^4.
|
215
|
+
"oidc-provider": "^8.8.1",
|
216
|
+
"ollama": "^0.5.15",
|
217
|
+
"openai": "^4.100.0",
|
218
218
|
"openapi-fetch": "^0.9.8",
|
219
219
|
"partial-json": "^0.1.7",
|
220
220
|
"path-browserify-esm": "^1.0.6",
|
221
221
|
"pdf-parse": "^1.1.1",
|
222
222
|
"pdfjs-dist": "4.8.69",
|
223
|
-
"pg": "^8.
|
224
|
-
"pino": "^9.
|
223
|
+
"pg": "^8.16.0",
|
224
|
+
"pino": "^9.7.0",
|
225
225
|
"plaiceholder": "^3.0.0",
|
226
226
|
"polished": "^4.3.1",
|
227
|
-
"posthog-js": "^1.
|
227
|
+
"posthog-js": "^1.245.0",
|
228
228
|
"pwa-install-handler": "^2.6.2",
|
229
|
-
"query-string": "^9.1.
|
229
|
+
"query-string": "^9.1.2",
|
230
230
|
"random-words": "^2.0.1",
|
231
231
|
"react": "^19.1.0",
|
232
232
|
"react-confetti": "^6.4.0",
|
233
233
|
"react-dom": "^19.1.0",
|
234
234
|
"react-fast-marquee": "^1.6.5",
|
235
|
-
"react-hotkeys-hook": "^4.6.
|
236
|
-
"react-i18next": "^15.
|
235
|
+
"react-hotkeys-hook": "^4.6.2",
|
236
|
+
"react-i18next": "^15.5.1",
|
237
237
|
"react-layout-kit": "^1.9.1",
|
238
238
|
"react-lazy-load": "^4.0.1",
|
239
239
|
"react-pdf": "^9.2.1",
|
240
240
|
"react-rnd": "^10.5.2",
|
241
|
-
"react-scan": "^0.3.
|
242
|
-
"react-virtuoso": "^4.12.
|
241
|
+
"react-scan": "^0.3.4",
|
242
|
+
"react-virtuoso": "^4.12.7",
|
243
243
|
"react-wrap-balancer": "^1.1.1",
|
244
244
|
"remark": "^15.0.1",
|
245
245
|
"remark-gfm": "^4.0.1",
|
@@ -247,12 +247,12 @@
|
|
247
247
|
"request-filtering-agent": "^2.0.1",
|
248
248
|
"resolve-accept-language": "^3.1.11",
|
249
249
|
"rtl-detect": "^1.1.2",
|
250
|
-
"semver": "^7.7.
|
250
|
+
"semver": "^7.7.2",
|
251
251
|
"sharp": "^0.33.5",
|
252
|
-
"shiki": "^3.2
|
252
|
+
"shiki": "^3.4.2",
|
253
253
|
"stripe": "^16.12.0",
|
254
254
|
"superjson": "^2.2.2",
|
255
|
-
"svix": "^1.
|
255
|
+
"svix": "^1.65.0",
|
256
256
|
"swr": "^2.3.3",
|
257
257
|
"systemjs": "^6.15.1",
|
258
258
|
"ts-md5": "^1.3.1",
|
@@ -262,24 +262,24 @@
|
|
262
262
|
"use-merge-value": "^1.2.0",
|
263
263
|
"utility-types": "^3.11.0",
|
264
264
|
"uuid": "^11.1.0",
|
265
|
-
"ws": "^8.18.
|
265
|
+
"ws": "^8.18.2",
|
266
266
|
"y-protocols": "^1.0.6",
|
267
267
|
"y-webrtc": "^10.3.0",
|
268
|
-
"yaml": "^2.
|
269
|
-
"yjs": "^13.6.
|
270
|
-
"zod": "^3.
|
271
|
-
"zustand": "^5.0.
|
268
|
+
"yaml": "^2.8.0",
|
269
|
+
"yjs": "^13.6.27",
|
270
|
+
"zod": "^3.25.7",
|
271
|
+
"zustand": "^5.0.4",
|
272
272
|
"zustand-utils": "^2.1.0"
|
273
273
|
},
|
274
274
|
"devDependencies": {
|
275
|
-
"@commitlint/cli": "^19.8.
|
275
|
+
"@commitlint/cli": "^19.8.1",
|
276
276
|
"@edge-runtime/vm": "^5.0.0",
|
277
277
|
"@huggingface/tasks": "^0.15.9",
|
278
278
|
"@lobehub/i18n-cli": "^1.20.3",
|
279
279
|
"@lobehub/lint": "^1.26.1",
|
280
280
|
"@lobehub/seo-cli": "^1.4.3",
|
281
|
-
"@next/bundle-analyzer": "^15.3.
|
282
|
-
"@next/eslint-plugin-next": "^15.3.
|
281
|
+
"@next/bundle-analyzer": "^15.3.2",
|
282
|
+
"@next/eslint-plugin-next": "^15.3.2",
|
283
283
|
"@peculiar/webcrypto": "^1.5.0",
|
284
284
|
"@semantic-release/exec": "^6.0.3",
|
285
285
|
"@testing-library/jest-dom": "^6.6.3",
|
@@ -294,12 +294,12 @@
|
|
294
294
|
"@types/json-schema": "^7.0.15",
|
295
295
|
"@types/lodash": "^4.17.16",
|
296
296
|
"@types/lodash-es": "^4.17.12",
|
297
|
-
"@types/node": "^22.
|
297
|
+
"@types/node": "^22.15.19",
|
298
298
|
"@types/numeral": "^2.0.5",
|
299
299
|
"@types/oidc-provider": "^8.8.1",
|
300
|
-
"@types/pg": "^8.
|
301
|
-
"@types/react": "^19.1.
|
302
|
-
"@types/react-dom": "^19.1.
|
300
|
+
"@types/pg": "^8.15.2",
|
301
|
+
"@types/react": "^19.1.4",
|
302
|
+
"@types/react-dom": "^19.1.5",
|
303
303
|
"@types/rtl-detect": "^1.0.3",
|
304
304
|
"@types/semver": "^7.7.0",
|
305
305
|
"@types/systemjs": "^6.15.3",
|
@@ -307,35 +307,35 @@
|
|
307
307
|
"@types/unist": "^3.0.3",
|
308
308
|
"@types/uuid": "^10.0.0",
|
309
309
|
"@types/ws": "^8.18.1",
|
310
|
-
"@vitest/coverage-v8": "^3.1.
|
310
|
+
"@vitest/coverage-v8": "^3.1.4",
|
311
311
|
"ajv-keywords": "^5.1.0",
|
312
|
-
"commitlint": "^19.8.
|
312
|
+
"commitlint": "^19.8.1",
|
313
313
|
"consola": "^3.4.2",
|
314
314
|
"cross-env": "^7.0.3",
|
315
315
|
"crypto-js": "^4.2.0",
|
316
|
-
"dbdocs": "^0.14.
|
317
|
-
"dotenv": "^16.
|
316
|
+
"dbdocs": "^0.14.4",
|
317
|
+
"dotenv": "^16.5.0",
|
318
318
|
"dpdm-fast": "^1.0.7",
|
319
319
|
"drizzle-dbml-generator": "^0.10.0",
|
320
320
|
"drizzle-kit": "^0.30.6",
|
321
321
|
"eslint": "^8.57.1",
|
322
|
-
"eslint-plugin-mdx": "^3.
|
323
|
-
"fake-indexeddb": "^6.0.
|
322
|
+
"eslint-plugin-mdx": "^3.4.2",
|
323
|
+
"fake-indexeddb": "^6.0.1",
|
324
324
|
"fs-extra": "^11.3.0",
|
325
|
-
"glob": "^11.0.
|
325
|
+
"glob": "^11.0.2",
|
326
326
|
"gray-matter": "^4.0.3",
|
327
|
-
"happy-dom": "^17.4.
|
327
|
+
"happy-dom": "^17.4.7",
|
328
328
|
"husky": "^9.1.7",
|
329
329
|
"just-diff": "^6.0.2",
|
330
|
-
"lint-staged": "^15.5.
|
330
|
+
"lint-staged": "^15.5.2",
|
331
331
|
"lodash": "^4.17.21",
|
332
332
|
"markdown-table": "^3.0.4",
|
333
333
|
"markdown-to-txt": "^2.0.1",
|
334
334
|
"mcp-hello-world": "^1.1.2",
|
335
|
-
"mime": "^4.0.
|
335
|
+
"mime": "^4.0.7",
|
336
336
|
"node-fetch": "^3.3.2",
|
337
337
|
"node-gyp": "^11.2.0",
|
338
|
-
"openapi-typescript": "^7.
|
338
|
+
"openapi-typescript": "^7.8.0",
|
339
339
|
"p-map": "^7.0.3",
|
340
340
|
"prettier": "^3.5.3",
|
341
341
|
"remark-cli": "^12.0.1",
|
@@ -343,14 +343,14 @@
|
|
343
343
|
"remark-mdx": "^3.1.0",
|
344
344
|
"remark-parse": "^11.0.0",
|
345
345
|
"semantic-release": "^21.1.2",
|
346
|
-
"serwist": "^9.0.
|
346
|
+
"serwist": "^9.0.14",
|
347
347
|
"stylelint": "^15.11.0",
|
348
|
-
"tsx": "^4.19.
|
349
|
-
"typescript": "^5.8.
|
348
|
+
"tsx": "^4.19.4",
|
349
|
+
"typescript": "^5.8.3",
|
350
350
|
"unified": "^11.0.5",
|
351
351
|
"unist-util-visit": "^5.0.0",
|
352
|
-
"vite": "^5.4.
|
353
|
-
"vitest": "^3.1.
|
352
|
+
"vite": "^5.4.19",
|
353
|
+
"vitest": "^3.1.4",
|
354
354
|
"vitest-canvas-mock": "^0.3.3"
|
355
355
|
},
|
356
356
|
"packageManager": "pnpm@10.10.0",
|
@@ -1,31 +1,6 @@
|
|
1
1
|
import { AIChatModelCard } from '@/types/aiModel';
|
2
2
|
|
3
3
|
const googleChatModels: AIChatModelCard[] = [
|
4
|
-
{
|
5
|
-
abilities: {
|
6
|
-
functionCall: true,
|
7
|
-
reasoning: true,
|
8
|
-
search: true,
|
9
|
-
vision: true,
|
10
|
-
},
|
11
|
-
contextWindowTokens: 1_048_576 + 65_536,
|
12
|
-
description:
|
13
|
-
'Gemini 2.5 Pro Experimental 是 Google 最先进的思维模型,能够对代码、数学和STEM领域的复杂问题进行推理,以及使用长上下文分析大型数据集、代码库和文档。',
|
14
|
-
displayName: 'Gemini 2.5 Pro Experimental 03-25',
|
15
|
-
enabled: true,
|
16
|
-
id: 'gemini-2.5-pro-exp-03-25',
|
17
|
-
maxOutput: 65_536,
|
18
|
-
pricing: {
|
19
|
-
input: 0,
|
20
|
-
output: 0,
|
21
|
-
},
|
22
|
-
releasedAt: '2025-03-25',
|
23
|
-
settings: {
|
24
|
-
searchImpl: 'params',
|
25
|
-
searchProvider: 'google',
|
26
|
-
},
|
27
|
-
type: 'chat',
|
28
|
-
},
|
29
4
|
{
|
30
5
|
abilities: {
|
31
6
|
functionCall: true,
|
@@ -59,13 +34,13 @@ const googleChatModels: AIChatModelCard[] = [
|
|
59
34
|
},
|
60
35
|
contextWindowTokens: 1_048_576 + 65_536,
|
61
36
|
description:
|
62
|
-
'Gemini 2.5 Pro
|
63
|
-
displayName: 'Gemini 2.5 Pro
|
64
|
-
id: 'gemini-2.5-pro-
|
37
|
+
'Gemini 2.5 Pro Experimental 是 Google 最先进的思维模型,能够对代码、数学和STEM领域的复杂问题进行推理,以及使用长上下文分析大型数据集、代码库和文档。',
|
38
|
+
displayName: 'Gemini 2.5 Pro Experimental 03-25',
|
39
|
+
id: 'gemini-2.5-pro-exp-03-25',
|
65
40
|
maxOutput: 65_536,
|
66
41
|
pricing: {
|
67
|
-
input:
|
68
|
-
output:
|
42
|
+
input: 0,
|
43
|
+
output: 0,
|
69
44
|
},
|
70
45
|
releasedAt: '2025-03-25',
|
71
46
|
settings: {
|
@@ -98,26 +73,6 @@ const googleChatModels: AIChatModelCard[] = [
|
|
98
73
|
},
|
99
74
|
type: 'chat',
|
100
75
|
},
|
101
|
-
{
|
102
|
-
abilities: {
|
103
|
-
reasoning: true,
|
104
|
-
vision: true,
|
105
|
-
},
|
106
|
-
contextWindowTokens: 1_048_576 + 65_536,
|
107
|
-
description:
|
108
|
-
'Gemini 2.0 Flash Thinking Exp 是 Google 的实验性多模态推理AI模型,能对复杂问题进行推理,拥有新的思维能力。',
|
109
|
-
displayName: 'Gemini 2.0 Flash Thinking Experimental 01-21',
|
110
|
-
enabled: true,
|
111
|
-
id: 'gemini-2.0-flash-thinking-exp-01-21',
|
112
|
-
maxOutput: 65_536,
|
113
|
-
pricing: {
|
114
|
-
cachedInput: 0,
|
115
|
-
input: 0,
|
116
|
-
output: 0,
|
117
|
-
},
|
118
|
-
releasedAt: '2025-01-21',
|
119
|
-
type: 'chat',
|
120
|
-
},
|
121
76
|
{
|
122
77
|
abilities: {
|
123
78
|
functionCall: true,
|
@@ -128,7 +83,6 @@ const googleChatModels: AIChatModelCard[] = [
|
|
128
83
|
description:
|
129
84
|
'Gemini 2.0 Flash 提供下一代功能和改进,包括卓越的速度、原生工具使用、多模态生成和1M令牌上下文窗口。',
|
130
85
|
displayName: 'Gemini 2.0 Flash',
|
131
|
-
enabled: true,
|
132
86
|
id: 'gemini-2.0-flash',
|
133
87
|
maxOutput: 8192,
|
134
88
|
pricing: {
|
@@ -167,6 +121,24 @@ const googleChatModels: AIChatModelCard[] = [
|
|
167
121
|
},
|
168
122
|
type: 'chat',
|
169
123
|
},
|
124
|
+
{
|
125
|
+
abilities: {
|
126
|
+
imageOutput: true,
|
127
|
+
vision: true,
|
128
|
+
},
|
129
|
+
contextWindowTokens: 32_768 + 8192,
|
130
|
+
description: 'Gemini 2.0 Flash 预览模型,支持图像生成',
|
131
|
+
displayName: 'Gemini 2.0 Flash Preview Image Generation',
|
132
|
+
enabled: true,
|
133
|
+
id: 'gemini-2.0-flash-preview-image-generation',
|
134
|
+
maxOutput: 8192,
|
135
|
+
pricing: {
|
136
|
+
input: 0.1,
|
137
|
+
output: 0.039, // per image
|
138
|
+
},
|
139
|
+
releasedAt: '2025-05-07',
|
140
|
+
type: 'chat',
|
141
|
+
},
|
170
142
|
{
|
171
143
|
abilities: {
|
172
144
|
imageOutput: true,
|
@@ -175,7 +147,6 @@ const googleChatModels: AIChatModelCard[] = [
|
|
175
147
|
contextWindowTokens: 1_048_576 + 8192,
|
176
148
|
description: 'Gemini 2.0 Flash 实验模型,支持图像生成',
|
177
149
|
displayName: 'Gemini 2.0 Flash (Image Generation) Experimental',
|
178
|
-
enabled: true,
|
179
150
|
id: 'gemini-2.0-flash-exp-image-generation',
|
180
151
|
maxOutput: 8192,
|
181
152
|
pricing: {
|
@@ -221,6 +192,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
221
192
|
},
|
222
193
|
{
|
223
194
|
abilities: {
|
195
|
+
imageOutput: true,
|
224
196
|
vision: true,
|
225
197
|
},
|
226
198
|
contextWindowTokens: 1_048_576 + 8192,
|
@@ -235,6 +207,23 @@ const googleChatModels: AIChatModelCard[] = [
|
|
235
207
|
releasedAt: '2025-02-05',
|
236
208
|
type: 'chat',
|
237
209
|
},
|
210
|
+
{
|
211
|
+
abilities: {
|
212
|
+
vision: true,
|
213
|
+
},
|
214
|
+
contextWindowTokens: 1_048_576 + 32_768,
|
215
|
+
description:
|
216
|
+
'LearnLM 是一个实验性的、特定于任务的语言模型,经过训练以符合学习科学原则,可在教学和学习场景中遵循系统指令,充当专家导师等。',
|
217
|
+
displayName: 'LearnLM 2.0 Flash Experimental',
|
218
|
+
id: 'learnlm-2.0-flash-experimental',
|
219
|
+
maxOutput: 32_768,
|
220
|
+
pricing: {
|
221
|
+
cachedInput: 0,
|
222
|
+
input: 0,
|
223
|
+
output: 0,
|
224
|
+
},
|
225
|
+
type: 'chat',
|
226
|
+
},
|
238
227
|
{
|
239
228
|
abilities: {
|
240
229
|
vision: true,
|
@@ -179,6 +179,17 @@ const groqChatModels: AIChatModelCard[] = [
|
|
179
179
|
},
|
180
180
|
type: 'chat',
|
181
181
|
},
|
182
|
+
{
|
183
|
+
contextWindowTokens: 131_072,
|
184
|
+
displayName: 'Llama Guard 4 12B',
|
185
|
+
id: 'meta-llama/Llama-Guard-4-12B',
|
186
|
+
maxOutput: 128,
|
187
|
+
pricing: {
|
188
|
+
input: 0.2,
|
189
|
+
output: 0.2,
|
190
|
+
},
|
191
|
+
type: 'chat',
|
192
|
+
},
|
182
193
|
{
|
183
194
|
contextWindowTokens: 8192,
|
184
195
|
displayName: 'Llama Guard 3 8B',
|
@@ -1,7 +1,106 @@
|
|
1
1
|
import { AIChatModelCard } from '@/types/aiModel';
|
2
|
-
|
3
2
|
// https://novita.ai/pricing
|
4
3
|
const novitaChatModels: AIChatModelCard[] = [
|
4
|
+
{
|
5
|
+
contextWindowTokens: 32_000,
|
6
|
+
displayName: 'Qwen3 0.6B FP8',
|
7
|
+
id: 'qwen/qwen3-0.6b-fp8',
|
8
|
+
pricing: {
|
9
|
+
input: 0,
|
10
|
+
output: 0
|
11
|
+
},
|
12
|
+
type: 'chat',
|
13
|
+
},
|
14
|
+
{
|
15
|
+
contextWindowTokens: 32_000,
|
16
|
+
displayName: 'Qwen3 1.7B FP8',
|
17
|
+
id: 'qwen/qwen3-1.7b-fp8',
|
18
|
+
pricing: {
|
19
|
+
input: 0,
|
20
|
+
output: 0
|
21
|
+
},
|
22
|
+
type: 'chat',
|
23
|
+
},
|
24
|
+
{
|
25
|
+
contextWindowTokens: 128_000,
|
26
|
+
displayName: 'Qwen3 4B FP8',
|
27
|
+
id: 'qwen/qwen3-4b-fp8',
|
28
|
+
pricing: {
|
29
|
+
input: 0,
|
30
|
+
output: 0
|
31
|
+
},
|
32
|
+
type: 'chat',
|
33
|
+
},
|
34
|
+
{
|
35
|
+
contextWindowTokens: 160_000,
|
36
|
+
displayName: 'Deepseek Prover V2 671B',
|
37
|
+
id: 'deepseek/deepseek-prover-v2-671b',
|
38
|
+
pricing: {
|
39
|
+
input: 0.7,
|
40
|
+
output: 2.5
|
41
|
+
},
|
42
|
+
type: 'chat',
|
43
|
+
},
|
44
|
+
{
|
45
|
+
contextWindowTokens: 40_960,
|
46
|
+
displayName: 'Qwen3 235B A22B FP8',
|
47
|
+
id: 'qwen/qwen3-235b-a22b-fp8',
|
48
|
+
pricing: {
|
49
|
+
input: 0.2,
|
50
|
+
output: 0.8
|
51
|
+
},
|
52
|
+
type: 'chat',
|
53
|
+
},
|
54
|
+
{
|
55
|
+
contextWindowTokens: 40_960,
|
56
|
+
displayName: 'Qwen3 30B A3B FP8',
|
57
|
+
id: 'qwen/qwen3-30b-a3b-fp8',
|
58
|
+
pricing: {
|
59
|
+
input: 0.1,
|
60
|
+
output: 0.45
|
61
|
+
},
|
62
|
+
type: 'chat',
|
63
|
+
},
|
64
|
+
{
|
65
|
+
contextWindowTokens: 40_960,
|
66
|
+
displayName: 'Qwen3 32B FP8',
|
67
|
+
id: 'qwen/qwen3-32b-fp8',
|
68
|
+
pricing: {
|
69
|
+
input: 0.1,
|
70
|
+
output: 0.45
|
71
|
+
},
|
72
|
+
type: 'chat',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
contextWindowTokens: 131_072,
|
76
|
+
displayName: 'Llama 3.3 70B Instruct',
|
77
|
+
id: 'meta-llama/llama-3.3-70b-instruct',
|
78
|
+
pricing: {
|
79
|
+
input: 0.13,
|
80
|
+
output: 0.39
|
81
|
+
},
|
82
|
+
type: 'chat',
|
83
|
+
},
|
84
|
+
{
|
85
|
+
contextWindowTokens: 128_000,
|
86
|
+
displayName: 'Qwen3 8B FP8',
|
87
|
+
id: 'qwen/qwen3-8b-fp8',
|
88
|
+
pricing: {
|
89
|
+
input: 0.035,
|
90
|
+
output: 0.138
|
91
|
+
},
|
92
|
+
type: 'chat',
|
93
|
+
},
|
94
|
+
{
|
95
|
+
contextWindowTokens: 40_960,
|
96
|
+
displayName: 'Qwen3 14B FP8',
|
97
|
+
id: 'qwen/qwen3-14b-fp8',
|
98
|
+
pricing: {
|
99
|
+
input: 0.07,
|
100
|
+
output: 0.275
|
101
|
+
},
|
102
|
+
type: 'chat',
|
103
|
+
},
|
5
104
|
{
|
6
105
|
contextWindowTokens: 131_072,
|
7
106
|
displayName: 'Llama 4 Scout 17B Instruct',
|
@@ -469,4 +568,4 @@ const novitaChatModels: AIChatModelCard[] = [
|
|
469
568
|
|
470
569
|
export const allModels = [...novitaChatModels];
|
471
570
|
|
472
|
-
export default allModels;
|
571
|
+
export default allModels;
|
@@ -9,7 +9,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
9
9
|
reasoning: true,
|
10
10
|
vision: true,
|
11
11
|
},
|
12
|
-
contextWindowTokens:
|
12
|
+
contextWindowTokens: 32_768,
|
13
13
|
description: '兼顾视觉、语言深度推理,实现慢思考和深度推理,呈现完整的思维链过程。',
|
14
14
|
displayName: 'SenseNova V6 Reasoner',
|
15
15
|
enabled: true,
|
@@ -24,10 +24,9 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
24
24
|
},
|
25
25
|
{
|
26
26
|
abilities: {
|
27
|
-
reasoning: true,
|
28
27
|
vision: true,
|
29
28
|
},
|
30
|
-
contextWindowTokens:
|
29
|
+
contextWindowTokens: 32_768,
|
31
30
|
description:
|
32
31
|
'实现图片、文本、视频能力的原生统一,突破传统多模态分立局限,在多模基础能力、语言基础能力等核心维度全面领先,文理兼修,在多项测评中多次位列国内外第一梯队水平。',
|
33
32
|
displayName: 'SenseNova V6 Turbo',
|
@@ -45,7 +44,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
45
44
|
abilities: {
|
46
45
|
vision: true,
|
47
46
|
},
|
48
|
-
contextWindowTokens:
|
47
|
+
contextWindowTokens: 32_768,
|
49
48
|
description:
|
50
49
|
'实现图片、文本、视频能力的原生统一,突破传统多模态分立局限,在OpenCompass和SuperCLUE评测中斩获双冠军。',
|
51
50
|
displayName: 'SenseNova V6 Pro',
|
@@ -53,21 +52,33 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
53
52
|
id: 'SenseNova-V6-Pro',
|
54
53
|
pricing: {
|
55
54
|
currency: 'CNY',
|
56
|
-
input:
|
57
|
-
output:
|
55
|
+
input: 3,
|
56
|
+
output: 9,
|
58
57
|
},
|
59
58
|
releasedAt: '2025-04-14',
|
60
59
|
type: 'chat',
|
61
60
|
},
|
61
|
+
{
|
62
|
+
contextWindowTokens: 32_768,
|
63
|
+
description: '部分性能优于 SenseCat-5-1202',
|
64
|
+
displayName: 'SenseChat 5.5 Beta',
|
65
|
+
id: 'SenseChat-5-beta',
|
66
|
+
pricing: {
|
67
|
+
currency: 'CNY',
|
68
|
+
input: 8,
|
69
|
+
output: 20,
|
70
|
+
},
|
71
|
+
type: 'chat',
|
72
|
+
},
|
62
73
|
{
|
63
74
|
abilities: {
|
64
75
|
functionCall: true,
|
65
76
|
},
|
66
|
-
contextWindowTokens:
|
77
|
+
contextWindowTokens: 32_768,
|
67
78
|
description:
|
68
79
|
'是基于V5.5的最新版本,较上版本在中英文基础能力,聊天,理科知识, 文科知识,写作,数理逻辑,字数控制 等几个维度的表现有显著提升。',
|
69
80
|
displayName: 'SenseChat 5.5 1202',
|
70
|
-
id: '
|
81
|
+
id: 'SenseCat-5-1202',
|
71
82
|
pricing: {
|
72
83
|
currency: 'CNY',
|
73
84
|
input: 8,
|
@@ -101,10 +112,11 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
101
112
|
'最新版本模型 (V5.5),128K上下文长度,在数学推理、英文对话、指令跟随以及长文本理解等领域能力显著提升,比肩GPT-4o。',
|
102
113
|
displayName: 'SenseChat 5.5',
|
103
114
|
id: 'SenseChat-5',
|
115
|
+
maxOutput: 131_072,
|
104
116
|
pricing: {
|
105
117
|
currency: 'CNY',
|
106
|
-
input:
|
107
|
-
output:
|
118
|
+
input: 8,
|
119
|
+
output: 20,
|
108
120
|
},
|
109
121
|
type: 'chat',
|
110
122
|
},
|
@@ -112,11 +124,12 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
112
124
|
abilities: {
|
113
125
|
vision: true,
|
114
126
|
},
|
115
|
-
contextWindowTokens:
|
127
|
+
contextWindowTokens: 16_384,
|
116
128
|
description:
|
117
129
|
'最新版本模型 (V5.5),支持多图的输入,全面实现模型基础能力优化,在对象属性识别、空间关系、动作事件识别、场景理解、情感识别、逻辑常识推理和文本理解生成上都实现了较大提升。',
|
118
130
|
displayName: 'SenseChat 5.5 Vision',
|
119
131
|
id: 'SenseChat-Vision',
|
132
|
+
maxOutput: 16_384,
|
120
133
|
pricing: {
|
121
134
|
currency: 'CNY',
|
122
135
|
input: 10, // 限时优惠
|
@@ -133,10 +146,11 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
133
146
|
description: '适用于快速问答、模型微调场景',
|
134
147
|
displayName: 'SenseChat 5.0 Turbo',
|
135
148
|
id: 'SenseChat-Turbo',
|
149
|
+
maxOutput: 32_768,
|
136
150
|
pricing: {
|
137
151
|
currency: 'CNY',
|
138
|
-
input:
|
139
|
-
output:
|
152
|
+
input: 0.3,
|
153
|
+
output: 0.6,
|
140
154
|
},
|
141
155
|
type: 'chat',
|
142
156
|
},
|
@@ -145,6 +159,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
145
159
|
description: '基础版本模型 (V4),128K上下文长度,在长文本理解及生成等任务中表现出色',
|
146
160
|
displayName: 'SenseChat 4.0 128K',
|
147
161
|
id: 'SenseChat-128K',
|
162
|
+
maxOutput: 131_072,
|
148
163
|
pricing: {
|
149
164
|
currency: 'CNY',
|
150
165
|
input: 60,
|
@@ -157,6 +172,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
157
172
|
description: '基础版本模型 (V4),32K上下文长度,灵活应用于各类场景',
|
158
173
|
displayName: 'SenseChat 4.0 32K',
|
159
174
|
id: 'SenseChat-32K',
|
175
|
+
maxOutput: 32_768,
|
160
176
|
pricing: {
|
161
177
|
currency: 'CNY',
|
162
178
|
input: 36,
|
@@ -169,6 +185,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
169
185
|
description: '基础版本模型 (V4),4K上下文长度,通用能力强大',
|
170
186
|
displayName: 'SenseChat 4.0 4K',
|
171
187
|
id: 'SenseChat',
|
188
|
+
maxOutput: 4096,
|
172
189
|
pricing: {
|
173
190
|
currency: 'CNY',
|
174
191
|
input: 12,
|
@@ -182,6 +199,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
182
199
|
'专门为适应香港地区的对话习惯、俚语及本地知识而设计,在粤语的对话理解上超越了GPT-4,在知识、推理、数学及代码编写等多个领域均能与GPT-4 Turbo相媲美。',
|
183
200
|
displayName: 'SenseChat 5.0 Cantonese',
|
184
201
|
id: 'SenseChat-5-Cantonese',
|
202
|
+
maxOutput: 32_768,
|
185
203
|
pricing: {
|
186
204
|
currency: 'CNY',
|
187
205
|
input: 27,
|
@@ -194,6 +212,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
194
212
|
description: '拟人对话标准版模型,8K上下文长度,高响应速度',
|
195
213
|
displayName: 'SenseChat Character',
|
196
214
|
id: 'SenseChat-Character',
|
215
|
+
maxOutput: 1024,
|
197
216
|
pricing: {
|
198
217
|
currency: 'CNY',
|
199
218
|
input: 12,
|
@@ -206,6 +225,7 @@ const sensenovaChatModels: AIChatModelCard[] = [
|
|
206
225
|
description: '拟人对话高级版模型,32K上下文长度,能力全面提升,支持中/英文对话',
|
207
226
|
displayName: 'SenseChat Character Pro',
|
208
227
|
id: 'SenseChat-Character-Pro',
|
228
|
+
maxOutput: 4096,
|
209
229
|
pricing: {
|
210
230
|
currency: 'CNY',
|
211
231
|
input: 15,
|
@@ -38,11 +38,13 @@ const modelsOffSafetySettings = new Set(['gemini-2.0-flash-exp']);
|
|
38
38
|
const modelsWithModalities = new Set([
|
39
39
|
'gemini-2.0-flash-exp',
|
40
40
|
'gemini-2.0-flash-exp-image-generation',
|
41
|
+
'gemini-2.0-flash-preview-image-generation',
|
41
42
|
]);
|
42
43
|
|
43
44
|
const modelsDisableInstuction = new Set([
|
44
45
|
'gemini-2.0-flash-exp',
|
45
46
|
'gemini-2.0-flash-exp-image-generation',
|
47
|
+
'gemini-2.0-flash-preview-image-generation',
|
46
48
|
]);
|
47
49
|
|
48
50
|
export interface GoogleModelCard {
|
@@ -12,7 +12,8 @@ export const LobeSenseNovaAI = LobeOpenAICompatibleFactory({
|
|
12
12
|
baseURL: 'https://api.sensenova.cn/compatible-mode/v1',
|
13
13
|
chatCompletion: {
|
14
14
|
handlePayload: (payload) => {
|
15
|
-
const { frequency_penalty, messages, model, temperature, top_p, ...rest } =
|
15
|
+
const { frequency_penalty, max_tokens, messages, model, temperature, top_p, ...rest } =
|
16
|
+
payload;
|
16
17
|
|
17
18
|
return {
|
18
19
|
...rest,
|
@@ -20,8 +21,9 @@ export const LobeSenseNovaAI = LobeOpenAICompatibleFactory({
|
|
20
21
|
frequency_penalty !== undefined && frequency_penalty > 0 && frequency_penalty <= 2
|
21
22
|
? frequency_penalty
|
22
23
|
: undefined,
|
24
|
+
max_new_tokens: max_tokens !== undefined && max_tokens > 0 ? max_tokens : undefined,
|
23
25
|
messages: messages.map((message) =>
|
24
|
-
message.role !== 'user' || !/^Sense(Nova-V6|Chat-Vision)/.test(model)
|
26
|
+
message.role !== 'user' || !model || !/^Sense(Nova-V6|Chat-Vision)/.test(model)
|
25
27
|
? message
|
26
28
|
: { ...message, content: convertSenseNovaMessage(message.content) },
|
27
29
|
) as any[],
|
@@ -41,11 +43,11 @@ export const LobeSenseNovaAI = LobeOpenAICompatibleFactory({
|
|
41
43
|
models: async ({ client }) => {
|
42
44
|
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
43
45
|
|
44
|
-
const functionCallKeywords = ['
|
46
|
+
const functionCallKeywords = ['1202'];
|
45
47
|
|
46
48
|
const visionKeywords = ['vision', 'sensenova-v6'];
|
47
49
|
|
48
|
-
const reasoningKeywords = ['deepseek-r1', '
|
50
|
+
const reasoningKeywords = ['deepseek-r1', 'reasoner'];
|
49
51
|
|
50
52
|
client.baseURL = 'https://api.sensenova.cn/v1/llm';
|
51
53
|
|
@@ -4,18 +4,29 @@ export const convertSenseNovaMessage = (content: any) => {
|
|
4
4
|
return [{ text: content, type: 'text' }];
|
5
5
|
}
|
6
6
|
|
7
|
+
// 如果内容为空或不是数组,返回空数组避免后续错误
|
8
|
+
if (!Array.isArray(content)) {
|
9
|
+
return [];
|
10
|
+
}
|
11
|
+
|
7
12
|
// 如果内容包含图片内容,则需要对 array 类 content,进行格式转换
|
8
13
|
return content
|
9
|
-
|
14
|
+
.map((item: any) => {
|
15
|
+
// 如果项为空,跳过处理
|
16
|
+
if (!item) return null;
|
17
|
+
|
10
18
|
// 如果为 content,则格式转换为 text 类
|
11
19
|
if (item.type === 'text') return item;
|
12
20
|
|
13
21
|
// 如果为 image_url,则格式转换为 image_url 类
|
14
|
-
if (item.type === 'image_url' && item.image_url
|
22
|
+
if (item.type === 'image_url' && item.image_url) {
|
15
23
|
const url = item.image_url.url;
|
16
24
|
|
25
|
+
// 确保 URL 存在且为字符串
|
26
|
+
if (!url || typeof url !== 'string') return null;
|
27
|
+
|
17
28
|
// 如果 image_url 为 base64 格式,则返回 image_base64 类,否则返回 image_url 类
|
18
|
-
return url.startsWith('data:image/jpeg;base64')
|
29
|
+
return url.startsWith('data:image/jpeg;base64') || url.startsWith('data:image/png;base64')
|
19
30
|
? {
|
20
31
|
image_base64: url.split(',')[1],
|
21
32
|
type: 'image_base64',
|