@lobehub/chat 1.136.5 → 1.136.6
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 +25 -0
- package/changelog/v1.json +5 -0
- package/package.json +62 -62
- package/packages/model-runtime/src/{utils/anthropicHelpers.test.ts → core/contextBuilders/anthropic.test.ts} +6 -6
- package/packages/model-runtime/src/{utils/anthropicHelpers.ts → core/contextBuilders/anthropic.ts} +3 -3
- package/packages/model-runtime/src/{utils/openaiHelpers.test.ts → core/contextBuilders/openai.test.ts} +5 -5
- package/packages/model-runtime/src/{utils/openaiHelpers.ts → core/contextBuilders/openai.ts} +4 -4
- package/packages/model-runtime/src/{utils/sensenovaHelpers.test.ts → core/contextBuilders/sensenova.test.ts} +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +1 -1
- package/packages/model-runtime/src/core/parameterResolver.test.ts +300 -0
- package/packages/model-runtime/src/core/parameterResolver.ts +275 -0
- package/packages/model-runtime/src/{utils/cloudflareHelpers.test.ts → core/streams/cloudflare.test.ts} +2 -6
- package/packages/model-runtime/src/{utils/cloudflareHelpers.ts → core/streams/cloudflare.ts} +1 -1
- package/packages/model-runtime/src/index.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/generateObject.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.ts +10 -21
- package/packages/model-runtime/src/providers/azureOpenai/index.test.ts +2 -2
- package/packages/model-runtime/src/providers/azureOpenai/index.ts +1 -1
- package/packages/model-runtime/src/providers/baichuan/index.ts +5 -3
- package/packages/model-runtime/src/providers/bedrock/index.test.ts +167 -0
- package/packages/model-runtime/src/providers/bedrock/index.ts +11 -3
- package/packages/model-runtime/src/providers/cloudflare/index.ts +3 -3
- package/packages/model-runtime/src/providers/cohere/index.ts +13 -9
- package/packages/model-runtime/src/providers/github/index.ts +1 -1
- package/packages/model-runtime/src/providers/groq/index.ts +9 -2
- package/packages/model-runtime/src/providers/minimax/index.ts +24 -6
- package/packages/model-runtime/src/providers/mistral/index.ts +16 -9
- package/packages/model-runtime/src/providers/moonshot/index.ts +5 -1
- package/packages/model-runtime/src/providers/openai/index.ts +10 -10
- package/packages/model-runtime/src/providers/perplexity/index.ts +20 -12
- package/packages/model-runtime/src/providers/qwen/index.ts +27 -29
- package/packages/model-runtime/src/providers/search1api/index.ts +1 -1
- package/packages/model-runtime/src/providers/sensenova/index.ts +1 -1
- package/packages/model-runtime/src/providers/zhipu/index.ts +21 -18
- package/packages/model-runtime/src/types/chat.ts +1 -1
- package/packages/web-crawler/package.json +1 -1
- package/src/store/chat/slices/topic/action.ts +0 -2
- /package/packages/model-runtime/src/{utils/sensenovaHelpers.ts → core/contextBuilders/sensenova.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 1.136.6](https://github.com/lobehub/lobe-chat/compare/v1.136.5...v1.136.6)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-10-11**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **bedrock**: Add parameter conflict handling for Claude 4+ models.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **bedrock**: Add parameter conflict handling for Claude 4+ models, closes [#9627](https://github.com/lobehub/lobe-chat/issues/9627) [#9523](https://github.com/lobehub/lobe-chat/issues/9523) ([54b6217](https://github.com/lobehub/lobe-chat/commit/54b6217))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 1.136.5](https://github.com/lobehub/lobe-chat/compare/v1.136.4...v1.136.5)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2025-10-11**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.136.
|
|
3
|
+
"version": "1.136.6",
|
|
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",
|
|
@@ -129,20 +129,20 @@
|
|
|
129
129
|
"@azure-rest/ai-inference": "1.0.0-beta.5",
|
|
130
130
|
"@azure/core-auth": "^1.10.1",
|
|
131
131
|
"@cfworker/json-schema": "^4.1.1",
|
|
132
|
-
"@clerk/localizations": "^3.25.
|
|
133
|
-
"@clerk/nextjs": "^6.
|
|
134
|
-
"@clerk/themes": "^2.4.
|
|
132
|
+
"@clerk/localizations": "^3.25.7",
|
|
133
|
+
"@clerk/nextjs": "^6.33.3",
|
|
134
|
+
"@clerk/themes": "^2.4.25",
|
|
135
135
|
"@codesandbox/sandpack-react": "^2.20.0",
|
|
136
|
-
"@cyntler/react-doc-viewer": "^1.17.
|
|
136
|
+
"@cyntler/react-doc-viewer": "^1.17.1",
|
|
137
137
|
"@electric-sql/pglite": "0.2.17",
|
|
138
138
|
"@emotion/react": "^11.14.0",
|
|
139
139
|
"@fal-ai/client": "^1.6.2",
|
|
140
140
|
"@formkit/auto-animate": "^0.9.0",
|
|
141
|
-
"@google/genai": "^1.
|
|
141
|
+
"@google/genai": "^1.24.0",
|
|
142
142
|
"@huggingface/inference": "^2.8.1",
|
|
143
143
|
"@icons-pack/react-simple-icons": "^13.8.0",
|
|
144
144
|
"@khmyznikov/pwa-install": "0.3.9",
|
|
145
|
-
"@langchain/community": "^0.3.
|
|
145
|
+
"@langchain/community": "^0.3.57",
|
|
146
146
|
"@lobechat/agent-runtime": "workspace:*",
|
|
147
147
|
"@lobechat/const": "workspace:*",
|
|
148
148
|
"@lobechat/context-engine": "workspace:*",
|
|
@@ -160,48 +160,48 @@
|
|
|
160
160
|
"@lobehub/charts": "^2.1.2",
|
|
161
161
|
"@lobehub/chat-plugin-sdk": "^1.32.4",
|
|
162
162
|
"@lobehub/chat-plugins-gateway": "^1.9.0",
|
|
163
|
-
"@lobehub/editor": "^1.
|
|
164
|
-
"@lobehub/icons": "^2.
|
|
163
|
+
"@lobehub/editor": "^1.16.0",
|
|
164
|
+
"@lobehub/icons": "^2.42.0",
|
|
165
165
|
"@lobehub/market-sdk": "^0.22.7",
|
|
166
166
|
"@lobehub/tts": "^2.0.1",
|
|
167
|
-
"@lobehub/ui": "^2.13.
|
|
168
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
169
|
-
"@neondatabase/serverless": "^1.0.
|
|
170
|
-
"@next/third-parties": "^15.5.
|
|
167
|
+
"@lobehub/ui": "^2.13.2",
|
|
168
|
+
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
169
|
+
"@neondatabase/serverless": "^1.0.2",
|
|
170
|
+
"@next/third-parties": "^15.5.4",
|
|
171
171
|
"@react-spring/web": "^9.7.5",
|
|
172
172
|
"@serwist/next": "^9.2.1",
|
|
173
173
|
"@t3-oss/env-nextjs": "^0.13.8",
|
|
174
|
-
"@tanstack/react-query": "^5.
|
|
175
|
-
"@trpc/client": "^11.
|
|
176
|
-
"@trpc/next": "^11.
|
|
177
|
-
"@trpc/react-query": "^11.
|
|
178
|
-
"@trpc/server": "^11.
|
|
174
|
+
"@tanstack/react-query": "^5.90.2",
|
|
175
|
+
"@trpc/client": "^11.6.0",
|
|
176
|
+
"@trpc/next": "^11.6.0",
|
|
177
|
+
"@trpc/react-query": "^11.6.0",
|
|
178
|
+
"@trpc/server": "^11.6.0",
|
|
179
179
|
"@vercel/analytics": "^1.5.0",
|
|
180
180
|
"@vercel/edge-config": "^1.4.0",
|
|
181
|
-
"@vercel/functions": "^3.
|
|
181
|
+
"@vercel/functions": "^3.1.3",
|
|
182
182
|
"@vercel/speed-insights": "^1.2.0",
|
|
183
183
|
"@xterm/xterm": "^5.5.0",
|
|
184
184
|
"ahooks": "^3.9.5",
|
|
185
|
-
"antd": "^5.27.
|
|
185
|
+
"antd": "^5.27.4",
|
|
186
186
|
"antd-style": "^3.7.1",
|
|
187
187
|
"brotli-wasm": "^3.0.1",
|
|
188
188
|
"chroma-js": "^3.1.2",
|
|
189
189
|
"cookie": "^1.0.2",
|
|
190
190
|
"countries-and-timezones": "^3.8.0",
|
|
191
191
|
"dayjs": "^1.11.18",
|
|
192
|
-
"debug": "^4.4.
|
|
192
|
+
"debug": "^4.4.3",
|
|
193
193
|
"dexie": "^3.2.7",
|
|
194
194
|
"diff": "^8.0.2",
|
|
195
|
-
"drizzle-orm": "^0.44.
|
|
195
|
+
"drizzle-orm": "^0.44.6",
|
|
196
196
|
"drizzle-zod": "^0.5.1",
|
|
197
197
|
"epub2": "^3.0.2",
|
|
198
198
|
"fast-deep-equal": "^3.1.3",
|
|
199
199
|
"file-type": "^21.0.0",
|
|
200
|
-
"framer-motion": "^12.23.
|
|
201
|
-
"gpt-tokenizer": "^3.0
|
|
200
|
+
"framer-motion": "^12.23.24",
|
|
201
|
+
"gpt-tokenizer": "^3.2.0",
|
|
202
202
|
"gray-matter": "^4.0.3",
|
|
203
203
|
"html-to-text": "^9.0.5",
|
|
204
|
-
"i18next": "^25.
|
|
204
|
+
"i18next": "^25.6.0",
|
|
205
205
|
"i18next-browser-languagedetector": "^8.2.0",
|
|
206
206
|
"i18next-resources-to-backend": "^1.2.1",
|
|
207
207
|
"idb-keyval": "^6.2.2",
|
|
@@ -210,24 +210,24 @@
|
|
|
210
210
|
"js-sha256": "^0.11.1",
|
|
211
211
|
"jsonl-parse-stringify": "^1.0.3",
|
|
212
212
|
"keyv": "^4.5.4",
|
|
213
|
-
"langchain": "^0.3.
|
|
213
|
+
"langchain": "^0.3.35",
|
|
214
214
|
"langfuse": "^3.38.5",
|
|
215
215
|
"langfuse-core": "^3.38.5",
|
|
216
216
|
"lodash-es": "^4.17.21",
|
|
217
217
|
"lucide-react": "^0.544.0",
|
|
218
|
-
"mammoth": "^1.
|
|
218
|
+
"mammoth": "^1.11.0",
|
|
219
219
|
"markdown-to-txt": "^2.0.1",
|
|
220
220
|
"mdast-util-to-markdown": "^2.1.2",
|
|
221
221
|
"model-bank": "workspace:*",
|
|
222
222
|
"modern-screenshot": "^4.6.6",
|
|
223
|
-
"nanoid": "^5.1.
|
|
223
|
+
"nanoid": "^5.1.6",
|
|
224
224
|
"next": "~15.3.5",
|
|
225
225
|
"next-auth": "5.0.0-beta.29",
|
|
226
226
|
"next-mdx-remote": "^5.0.0",
|
|
227
227
|
"nextjs-toploader": "^3.9.17",
|
|
228
228
|
"node-machine-id": "^1.1.12",
|
|
229
229
|
"numeral": "^2.0.6",
|
|
230
|
-
"nuqs": "^2.
|
|
230
|
+
"nuqs": "^2.7.1",
|
|
231
231
|
"officeparser": "5.1.1",
|
|
232
232
|
"oidc-provider": "^9.5.1",
|
|
233
233
|
"ollama": "^0.6.0",
|
|
@@ -238,43 +238,43 @@
|
|
|
238
238
|
"pdf-parse": "^1.1.1",
|
|
239
239
|
"pdfjs-dist": "4.8.69",
|
|
240
240
|
"pg": "^8.16.3",
|
|
241
|
-
"pino": "^9.
|
|
241
|
+
"pino": "^9.13.1",
|
|
242
242
|
"plaiceholder": "^3.0.0",
|
|
243
243
|
"polished": "^4.3.1",
|
|
244
|
-
"posthog-js": "^1.
|
|
244
|
+
"posthog-js": "^1.275.1",
|
|
245
245
|
"pure-rand": "^7.0.1",
|
|
246
246
|
"pwa-install-handler": "^2.6.3",
|
|
247
|
-
"query-string": "^9.3.
|
|
247
|
+
"query-string": "^9.3.1",
|
|
248
248
|
"random-words": "^2.0.1",
|
|
249
|
-
"react": "^19.
|
|
249
|
+
"react": "^19.2.0",
|
|
250
250
|
"react-confetti": "^6.4.0",
|
|
251
|
-
"react-dom": "^19.
|
|
251
|
+
"react-dom": "^19.2.0",
|
|
252
252
|
"react-fast-marquee": "^1.6.5",
|
|
253
253
|
"react-hotkeys-hook": "^5.1.0",
|
|
254
|
-
"react-i18next": "^15.7.
|
|
254
|
+
"react-i18next": "^15.7.4",
|
|
255
255
|
"react-layout-kit": "^2.0.0",
|
|
256
256
|
"react-lazy-load": "^4.0.1",
|
|
257
257
|
"react-pdf": "^9.2.1",
|
|
258
258
|
"react-rnd": "^10.5.2",
|
|
259
259
|
"react-scan": "^0.4.3",
|
|
260
|
-
"react-virtuoso": "^4.14.
|
|
260
|
+
"react-virtuoso": "^4.14.1",
|
|
261
261
|
"react-wrap-balancer": "^1.1.1",
|
|
262
262
|
"remark": "^15.0.1",
|
|
263
263
|
"remark-gfm": "^4.0.1",
|
|
264
264
|
"remark-html": "^16.0.1",
|
|
265
265
|
"resolve-accept-language": "^3.1.13",
|
|
266
266
|
"rtl-detect": "^1.1.2",
|
|
267
|
-
"semver": "^7.7.
|
|
268
|
-
"sharp": "^0.34.
|
|
269
|
-
"shiki": "^3.
|
|
267
|
+
"semver": "^7.7.3",
|
|
268
|
+
"sharp": "^0.34.4",
|
|
269
|
+
"shiki": "^3.13.0",
|
|
270
270
|
"ssrf-safe-fetch": "workspace:*",
|
|
271
271
|
"stripe": "^17.7.0",
|
|
272
272
|
"superjson": "^2.2.2",
|
|
273
|
-
"svix": "^1.
|
|
274
|
-
"swr": "2.3.
|
|
273
|
+
"svix": "^1.77.0",
|
|
274
|
+
"swr": "^2.3.6",
|
|
275
275
|
"systemjs": "^6.15.1",
|
|
276
|
-
"tokenx": "^1.
|
|
277
|
-
"ts-md5": "^2.0.
|
|
276
|
+
"tokenx": "^1.1.0",
|
|
277
|
+
"ts-md5": "^2.0.1",
|
|
278
278
|
"ua-parser-js": "^1.0.41",
|
|
279
279
|
"unstructured-client": "^0.19.0",
|
|
280
280
|
"url-join": "^5.0.0",
|
|
@@ -290,14 +290,14 @@
|
|
|
290
290
|
"devDependencies": {
|
|
291
291
|
"@commitlint/cli": "^19.8.1",
|
|
292
292
|
"@edge-runtime/vm": "^5.0.0",
|
|
293
|
-
"@huggingface/tasks": "^0.19.
|
|
293
|
+
"@huggingface/tasks": "^0.19.50",
|
|
294
294
|
"@lobechat/types": "workspace:*",
|
|
295
295
|
"@lobehub/i18n-cli": "^1.25.1",
|
|
296
296
|
"@lobehub/lint": "^1.26.2",
|
|
297
297
|
"@lobehub/market-types": "^1.11.4",
|
|
298
298
|
"@lobehub/seo-cli": "^1.7.0",
|
|
299
|
-
"@next/bundle-analyzer": "^15.5.
|
|
300
|
-
"@next/eslint-plugin-next": "^15.5.
|
|
299
|
+
"@next/bundle-analyzer": "^15.5.4",
|
|
300
|
+
"@next/eslint-plugin-next": "^15.5.4",
|
|
301
301
|
"@peculiar/webcrypto": "^1.5.0",
|
|
302
302
|
"@prettier/sync": "^0.6.1",
|
|
303
303
|
"@semantic-release/exec": "^6.0.3",
|
|
@@ -312,12 +312,12 @@
|
|
|
312
312
|
"@types/json-schema": "^7.0.15",
|
|
313
313
|
"@types/lodash": "^4.17.20",
|
|
314
314
|
"@types/lodash-es": "^4.17.12",
|
|
315
|
-
"@types/node": "^22.18.
|
|
315
|
+
"@types/node": "^22.18.9",
|
|
316
316
|
"@types/numeral": "^2.0.5",
|
|
317
317
|
"@types/oidc-provider": "^9.5.0",
|
|
318
318
|
"@types/pg": "^8.15.5",
|
|
319
|
-
"@types/react": "^19.
|
|
320
|
-
"@types/react-dom": "^19.1
|
|
319
|
+
"@types/react": "^19.2.2",
|
|
320
|
+
"@types/react-dom": "^19.2.1",
|
|
321
321
|
"@types/rtl-detect": "^1.0.3",
|
|
322
322
|
"@types/semver": "^7.7.1",
|
|
323
323
|
"@types/systemjs": "^6.15.3",
|
|
@@ -329,28 +329,28 @@
|
|
|
329
329
|
"ajv-keywords": "^5.1.0",
|
|
330
330
|
"commitlint": "^19.8.1",
|
|
331
331
|
"consola": "^3.4.2",
|
|
332
|
-
"cross-env": "^10.
|
|
332
|
+
"cross-env": "^10.1.0",
|
|
333
333
|
"crypto-js": "^4.2.0",
|
|
334
|
-
"dbdocs": "^0.16.
|
|
335
|
-
"dotenv": "^17.2.
|
|
334
|
+
"dbdocs": "^0.16.2",
|
|
335
|
+
"dotenv": "^17.2.3",
|
|
336
336
|
"dotenv-expand": "^12.0.3",
|
|
337
|
-
"dpdm-fast": "^1.0.
|
|
337
|
+
"dpdm-fast": "^1.0.14",
|
|
338
338
|
"drizzle-dbml-generator": "^0.10.0",
|
|
339
|
-
"drizzle-kit": "^0.31.
|
|
339
|
+
"drizzle-kit": "^0.31.5",
|
|
340
340
|
"eslint": "^8.57.1",
|
|
341
341
|
"eslint-plugin-mdx": "^3.6.2",
|
|
342
|
-
"fake-indexeddb": "^6.2.
|
|
343
|
-
"fs-extra": "^11.3.
|
|
342
|
+
"fake-indexeddb": "^6.2.3",
|
|
343
|
+
"fs-extra": "^11.3.2",
|
|
344
344
|
"glob": "^11.0.3",
|
|
345
|
-
"happy-dom": "^
|
|
345
|
+
"happy-dom": "^20.0.0",
|
|
346
346
|
"husky": "^9.1.7",
|
|
347
|
-
"import-in-the-middle": "^1.
|
|
347
|
+
"import-in-the-middle": "^1.15.0",
|
|
348
348
|
"just-diff": "^6.0.2",
|
|
349
349
|
"lint-staged": "^15.5.2",
|
|
350
350
|
"lodash": "^4.17.21",
|
|
351
351
|
"markdown-table": "^3.0.4",
|
|
352
352
|
"mcp-hello-world": "^1.1.2",
|
|
353
|
-
"mime": "^4.0
|
|
353
|
+
"mime": "^4.1.0",
|
|
354
354
|
"node-fetch": "^3.3.2",
|
|
355
355
|
"node-gyp": "^11.4.2",
|
|
356
356
|
"openapi-typescript": "^7.9.1",
|
|
@@ -364,12 +364,12 @@
|
|
|
364
364
|
"semantic-release": "^21.1.2",
|
|
365
365
|
"serwist": "^9.2.1",
|
|
366
366
|
"stylelint": "^15.11.0",
|
|
367
|
-
"tsx": "^4.20.
|
|
367
|
+
"tsx": "^4.20.6",
|
|
368
368
|
"type-fest": "^4.41.0",
|
|
369
|
-
"typescript": "^5.9.
|
|
369
|
+
"typescript": "^5.9.3",
|
|
370
370
|
"unified": "^11.0.5",
|
|
371
371
|
"unist-util-visit": "^5.0.0",
|
|
372
|
-
"vite": "^7.1.
|
|
372
|
+
"vite": "^7.1.9",
|
|
373
373
|
"vitest": "^3.2.4"
|
|
374
374
|
},
|
|
375
375
|
"packageManager": "pnpm@10.18.0",
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { OpenAI } from 'openai';
|
|
2
2
|
import { describe, expect, it, vi } from 'vitest';
|
|
3
3
|
|
|
4
|
-
import { OpenAIChatMessage, UserMessageContentPart } from '
|
|
5
|
-
import { imageUrlToBase64 } from '
|
|
4
|
+
import { OpenAIChatMessage, UserMessageContentPart } from '../../types/chat';
|
|
5
|
+
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
6
|
+
import { parseDataUri } from '../../utils/uriParser';
|
|
6
7
|
import {
|
|
7
8
|
buildAnthropicBlock,
|
|
8
9
|
buildAnthropicMessage,
|
|
9
10
|
buildAnthropicMessages,
|
|
10
11
|
buildAnthropicTools,
|
|
11
|
-
} from './
|
|
12
|
-
import { parseDataUri } from './uriParser';
|
|
12
|
+
} from './anthropic';
|
|
13
13
|
|
|
14
14
|
// Mock the parseDataUri function since it's an implementation detail
|
|
15
|
-
vi.mock('
|
|
15
|
+
vi.mock('../../utils/uriParser', () => ({
|
|
16
16
|
parseDataUri: vi.fn().mockReturnValue({
|
|
17
17
|
mimeType: 'image/jpeg',
|
|
18
18
|
base64: 'base64EncodedString',
|
|
19
19
|
type: 'base64',
|
|
20
20
|
}),
|
|
21
21
|
}));
|
|
22
|
-
vi.mock('
|
|
22
|
+
vi.mock('../../utils/imageToBase64');
|
|
23
23
|
|
|
24
24
|
describe('anthropicHelpers', () => {
|
|
25
25
|
describe('buildAnthropicBlock', () => {
|
package/packages/model-runtime/src/{utils/anthropicHelpers.ts → core/contextBuilders/anthropic.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import OpenAI from 'openai';
|
|
3
3
|
|
|
4
|
-
import { OpenAIChatMessage, UserMessageContentPart } from '
|
|
5
|
-
import { imageUrlToBase64 } from '
|
|
6
|
-
import { parseDataUri } from '
|
|
4
|
+
import { OpenAIChatMessage, UserMessageContentPart } from '../../types';
|
|
5
|
+
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
6
|
+
import { parseDataUri } from '../../utils/uriParser';
|
|
7
7
|
|
|
8
8
|
export const buildAnthropicBlock = async (
|
|
9
9
|
content: UserMessageContentPart,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
3
|
|
|
4
|
-
import { imageUrlToBase64 } from '
|
|
4
|
+
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
5
|
+
import { parseDataUri } from '../../utils/uriParser';
|
|
5
6
|
import {
|
|
6
7
|
convertImageUrlToFile,
|
|
7
8
|
convertMessageContent,
|
|
8
9
|
convertOpenAIMessages,
|
|
9
10
|
convertOpenAIResponseInputs,
|
|
10
|
-
} from './
|
|
11
|
-
import { parseDataUri } from './uriParser';
|
|
11
|
+
} from './openai';
|
|
12
12
|
|
|
13
13
|
// 模拟依赖
|
|
14
|
-
vi.mock('
|
|
15
|
-
vi.mock('
|
|
14
|
+
vi.mock('../../utils/imageToBase64');
|
|
15
|
+
vi.mock('../../utils/uriParser');
|
|
16
16
|
|
|
17
17
|
describe('convertMessageContent', () => {
|
|
18
18
|
beforeEach(() => {
|
package/packages/model-runtime/src/{utils/openaiHelpers.ts → core/contextBuilders/openai.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import OpenAI, { toFile } from 'openai';
|
|
2
2
|
|
|
3
|
-
import { disableStreamModels, systemToUserModels } from '
|
|
4
|
-
import { ChatStreamPayload, OpenAIChatMessage } from '
|
|
5
|
-
import { imageUrlToBase64 } from '
|
|
6
|
-
import { parseDataUri } from '
|
|
3
|
+
import { disableStreamModels, systemToUserModels } from '../../const/models';
|
|
4
|
+
import { ChatStreamPayload, OpenAIChatMessage } from '../../types';
|
|
5
|
+
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
6
|
+
import { parseDataUri } from '../../utils/uriParser';
|
|
7
7
|
|
|
8
8
|
export const convertMessageContent = async (
|
|
9
9
|
content: OpenAI.ChatCompletionContentPart,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { convertSenseNovaMessage } from './
|
|
3
|
+
import { convertSenseNovaMessage } from './sensenova';
|
|
4
4
|
|
|
5
5
|
describe('convertSenseNovaMessage', () => {
|
|
6
6
|
it('should convert string content to text type array', () => {
|
|
@@ -6,8 +6,8 @@ import OpenAI from 'openai';
|
|
|
6
6
|
import { CreateImagePayload, CreateImageResponse } from '../../types/image';
|
|
7
7
|
import { getModelPricing } from '../../utils/getModelPricing';
|
|
8
8
|
import { imageUrlToBase64 } from '../../utils/imageToBase64';
|
|
9
|
-
import { convertImageUrlToFile } from '../../utils/openaiHelpers';
|
|
10
9
|
import { parseDataUri } from '../../utils/uriParser';
|
|
10
|
+
import { convertImageUrlToFile } from '../contextBuilders/openai';
|
|
11
11
|
import { convertOpenAIImageUsage } from '../usageConverters/openai';
|
|
12
12
|
|
|
13
13
|
const log = createDebug('lobe-image:openai-compatible');
|
|
@@ -11,7 +11,7 @@ import type { Stream } from 'openai/streaming';
|
|
|
11
11
|
import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
12
12
|
|
|
13
13
|
import * as debugStreamModule from '../../utils/debugStream';
|
|
14
|
-
import * as openaiHelpers from '
|
|
14
|
+
import * as openaiHelpers from '../contextBuilders/openai';
|
|
15
15
|
import { createOpenAICompatibleRuntime } from './index';
|
|
16
16
|
|
|
17
17
|
const sleep = async (ms: number) =>
|
|
@@ -29,10 +29,10 @@ import { desensitizeUrl } from '../../utils/desensitizeUrl';
|
|
|
29
29
|
import { getModelPropertyWithFallback } from '../../utils/getFallbackModelProperty';
|
|
30
30
|
import { getModelPricing } from '../../utils/getModelPricing';
|
|
31
31
|
import { handleOpenAIError } from '../../utils/handleOpenAIError';
|
|
32
|
-
import { convertOpenAIMessages, convertOpenAIResponseInputs } from '../../utils/openaiHelpers';
|
|
33
32
|
import { postProcessModelList } from '../../utils/postProcessModelList';
|
|
34
33
|
import { StreamingResponse } from '../../utils/response';
|
|
35
34
|
import { LobeRuntimeAI } from '../BaseAI';
|
|
35
|
+
import { convertOpenAIMessages, convertOpenAIResponseInputs } from '../contextBuilders/openai';
|
|
36
36
|
import { OpenAIResponsesStream, OpenAIStream, OpenAIStreamOptions } from '../streams';
|
|
37
37
|
import { createOpenAICompatibleImage } from './createImage';
|
|
38
38
|
import { transformResponseAPIToStream, transformResponseToStream } from './nonStreamToStream';
|