@lobehub/chat 1.1.1 → 1.1.2

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 CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.1.2](https://github.com/lobehub/lobe-chat/compare/v1.1.1...v1.1.2)
6
+
7
+ <sup>Released on **2024-06-20**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
5
22
  ### [Version 1.1.1](https://github.com/lobehub/lobe-chat/compare/v1.1.0...v1.1.1)
6
23
 
7
24
  <sup>Released on **2024-06-20**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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",
@@ -95,14 +95,14 @@
95
95
  "@ant-design/icons": "^5.3.7",
96
96
  "@anthropic-ai/sdk": "^0.24.0",
97
97
  "@auth/core": "0.28.0",
98
- "@aws-sdk/client-bedrock-runtime": "^3.583.0",
99
- "@aws-sdk/client-s3": "^3.583.0",
100
- "@aws-sdk/s3-request-presigner": "^3.583.0",
98
+ "@aws-sdk/client-bedrock-runtime": "^3.600.0",
99
+ "@aws-sdk/client-s3": "^3.600.0",
100
+ "@aws-sdk/s3-request-presigner": "^3.600.0",
101
101
  "@azure/openai": "1.0.0-beta.12",
102
102
  "@cfworker/json-schema": "^1.12.8",
103
103
  "@clerk/localizations": "2.0.0",
104
- "@clerk/nextjs": "^5.1.2",
105
- "@clerk/themes": "^2.1.7",
104
+ "@clerk/nextjs": "^5.1.6",
105
+ "@clerk/themes": "^2.1.10",
106
106
  "@google/generative-ai": "^0.13.0",
107
107
  "@icons-pack/react-simple-icons": "^9.5.0",
108
108
  "@khmyznikov/pwa-install": "^0.3.9",
@@ -113,19 +113,19 @@
113
113
  "@lobehub/ui": "^1.143.5",
114
114
  "@microsoft/fetch-event-source": "^2.0.1",
115
115
  "@neondatabase/serverless": "^0.9.3",
116
- "@next/third-parties": "^14.2.3",
117
- "@sentry/nextjs": "^7.116.0",
116
+ "@next/third-parties": "^14.2.4",
117
+ "@sentry/nextjs": "^7.117.0",
118
118
  "@t3-oss/env-nextjs": "^0.10.1",
119
119
  "@trpc/client": "next",
120
120
  "@trpc/next": "next",
121
121
  "@trpc/server": "next",
122
122
  "@vercel/analytics": "^1.3.1",
123
- "@vercel/speed-insights": "^1.0.11",
123
+ "@vercel/speed-insights": "^1.0.12",
124
124
  "ahooks": "^3.8.0",
125
125
  "ai": "3.0.19",
126
- "antd": "^5.17.3",
126
+ "antd": "^5.18.3",
127
127
  "antd-style": "^3.6.2",
128
- "brotli-wasm": "^3.0.0",
128
+ "brotli-wasm": "^3.0.1",
129
129
  "chroma-js": "^2.4.2",
130
130
  "dayjs": "^1.11.11",
131
131
  "debug": "^4.3.5",
@@ -141,25 +141,25 @@
141
141
  "idb-keyval": "^6.2.1",
142
142
  "immer": "^10.1.1",
143
143
  "ip": "^2.0.1",
144
- "jose": "^5.3.0",
145
- "langfuse": "^3.11.1",
146
- "langfuse-core": "^3.11.1",
144
+ "jose": "^5.4.1",
145
+ "langfuse": "^3.12.2",
146
+ "langfuse-core": "^3.12.2",
147
147
  "lodash-es": "^4.17.21",
148
148
  "lucide-react": "latest",
149
149
  "modern-screenshot": "^4.4.39",
150
150
  "nanoid": "^5.0.7",
151
- "next": "^14.2.3",
151
+ "next": "^14.2.4",
152
152
  "next-auth": "5.0.0-beta.15",
153
153
  "next-sitemap": "^4.2.3",
154
154
  "numeral": "^2.0.6",
155
155
  "nuqs": "^1.17.4",
156
- "ollama": "^0.5.1",
157
- "openai": "^4.47.1",
156
+ "ollama": "^0.5.2",
157
+ "openai": "^4.52.0",
158
158
  "partial-json": "^0.1.7",
159
- "pg": "^8.11.5",
160
- "pino": "^9.1.0",
159
+ "pg": "^8.12.0",
160
+ "pino": "^9.2.0",
161
161
  "polished": "^4.3.1",
162
- "posthog-js": "^1.135.2",
162
+ "posthog-js": "^1.139.6",
163
163
  "pwa-install-handler": "^2.6.0",
164
164
  "query-string": "^9.0.0",
165
165
  "random-words": "^2.0.1",
@@ -183,16 +183,16 @@
183
183
  "swr": "^2.2.5",
184
184
  "systemjs": "^6.15.1",
185
185
  "ts-md5": "^1.3.1",
186
- "ua-parser-js": "^1.0.37",
186
+ "ua-parser-js": "^1.0.38",
187
187
  "url-join": "^5.0.0",
188
188
  "use-merge-value": "^1.2.0",
189
189
  "utility-types": "^3.11.0",
190
190
  "uuid": "^10.0.0",
191
- "ws": "^8.17.0",
191
+ "ws": "^8.17.1",
192
192
  "y-protocols": "^1.0.6",
193
193
  "y-webrtc": "^10.3.0",
194
- "yaml": "^2.4.2",
195
- "yjs": "^13.6.15",
194
+ "yaml": "^2.4.5",
195
+ "yjs": "^13.6.18",
196
196
  "zod": "^3.23.8",
197
197
  "zustand": "^4.5.2",
198
198
  "zustand-utils": "^1.3.2"
@@ -204,19 +204,19 @@
204
204
  "@lobehub/i18n-cli": "^1.18.1",
205
205
  "@lobehub/lint": "^1.23.4",
206
206
  "@lobehub/seo-cli": "^1.4.1",
207
- "@next/bundle-analyzer": "^14.2.3",
208
- "@next/eslint-plugin-next": "^14.2.3",
209
- "@peculiar/webcrypto": "^1.4.6",
210
- "@testing-library/jest-dom": "^6.4.5",
207
+ "@next/bundle-analyzer": "^14.2.4",
208
+ "@next/eslint-plugin-next": "^14.2.4",
209
+ "@peculiar/webcrypto": "^1.5.0",
210
+ "@testing-library/jest-dom": "^6.4.6",
211
211
  "@testing-library/react": "^16.0.0",
212
212
  "@types/chroma-js": "^2.4.4",
213
213
  "@types/debug": "^4.1.12",
214
214
  "@types/diff": "^5.2.1",
215
215
  "@types/ip": "^1.1.3",
216
216
  "@types/json-schema": "^7.0.15",
217
- "@types/lodash": "^4.17.4",
217
+ "@types/lodash": "^4.17.5",
218
218
  "@types/lodash-es": "^4.17.12",
219
- "@types/node": "^20.12.12",
219
+ "@types/node": "^20.14.6",
220
220
  "@types/numeral": "^2.0.5",
221
221
  "@types/pg": "^8.11.6",
222
222
  "@types/react": "^18.3.3",
@@ -227,38 +227,38 @@
227
227
  "@types/ua-parser-js": "^0.7.39",
228
228
  "@types/uuid": "^9.0.8",
229
229
  "@types/ws": "^8.5.10",
230
- "@umijs/lint": "^4.2.5",
230
+ "@umijs/lint": "^4.2.13",
231
231
  "@vitest/coverage-v8": "~1.2.2",
232
232
  "ajv-keywords": "^5.1.0",
233
233
  "commitlint": "^19.3.0",
234
234
  "consola": "^3.2.3",
235
235
  "dotenv": "^16.4.5",
236
236
  "dpdm": "^3.14.0",
237
- "drizzle-kit": "^0.21.1",
237
+ "drizzle-kit": "^0.22.7",
238
238
  "eslint": "^8.57.0",
239
239
  "eslint-plugin-mdx": "^2.3.4",
240
240
  "fake-indexeddb": "^6.0.0",
241
- "glob": "^10.4.1",
241
+ "glob": "^10.4.2",
242
242
  "gray-matter": "^4.0.3",
243
- "happy-dom": "^14.11.0",
243
+ "happy-dom": "^14.12.0",
244
244
  "husky": "^9.0.11",
245
245
  "just-diff": "^6.0.2",
246
- "lint-staged": "^15.2.5",
246
+ "lint-staged": "^15.2.7",
247
247
  "lodash": "^4.17.21",
248
248
  "markdown-table": "^3.0.3",
249
249
  "node-fetch": "^3.3.2",
250
250
  "node-gyp": "^10.1.0",
251
251
  "p-map": "^7.0.2",
252
- "prettier": "^3.2.5",
252
+ "prettier": "^3.3.2",
253
253
  "remark-cli": "^11.0.0",
254
254
  "remark-parse": "^10.0.2",
255
255
  "semantic-release": "^21.1.2",
256
256
  "stylelint": "^15.11.0",
257
- "tsx": "^4.11.0",
258
- "typescript": "^5.4.5",
259
- "unified": "^11.0.4",
257
+ "tsx": "^4.15.6",
258
+ "typescript": "^5.5.2",
259
+ "unified": "^11.0.5",
260
260
  "unist-util-visit": "^5.0.0",
261
- "vite": "^5.2.11",
261
+ "vite": "^5.3.1",
262
262
  "vitest": "~1.2.2",
263
263
  "vitest-canvas-mock": "^0.3.3"
264
264
  },
@@ -362,6 +362,7 @@ export const messages = pgTable(
362
362
  .notNull(),
363
363
  sessionId: text('session_id').references(() => sessions.id, { onDelete: 'cascade' }),
364
364
  topicId: text('topic_id').references(() => topics.id, { onDelete: 'cascade' }),
365
+ // @ts-ignore
365
366
  parentId: text('parent_id').references(() => messages.id, { onDelete: 'set null' }),
366
367
  quotaId: text('quota_id').references(() => messages.id, { onDelete: 'set null' }),
367
368
 
@@ -265,6 +265,82 @@ describe('LobeOpenAICompatibleFactory', () => {
265
265
  );
266
266
  });
267
267
 
268
+ it.skip('should handle anthropic sonnet 3.5 tool calling chunks correctly', async () => {
269
+ const chunks = [
270
+ {
271
+ id: 'chatcmpl-b3f58dc5-0699-4b28-aefe-6624c2a68d51',
272
+ created: 1718909418,
273
+ model: 'claude-3-5-sonnet-20240620',
274
+ object: 'chat.completion.chunk',
275
+
276
+ choices: [
277
+ {
278
+ index: 0,
279
+ delta: {
280
+ content:
281
+ '好的,我可以帮您查询杭州的天气情况。让我使用实时天气工具来获取杭州的当前天气信息。',
282
+ id: 'rolu_01JXyRw6Ti78mR2dn6U5h1pa',
283
+ function: {
284
+ arguments: '{"city": "杭州"}',
285
+ name: 'realtime-weather____fetchCurrentWeather',
286
+ },
287
+ type: 'function',
288
+ index: 0,
289
+ },
290
+ },
291
+ ],
292
+ },
293
+ {
294
+ id: 'chatcmpl-b3f58dc5-0699-4b28-aefe-6624c2a68d51',
295
+ choices: [{ finish_reason: 'stop', index: 0, delta: {} }],
296
+ created: 1718909418,
297
+ model: 'claude-3-5-sonnet-20240620',
298
+ object: 'chat.completion.chunk',
299
+ },
300
+ ];
301
+ const mockStream = new ReadableStream({
302
+ start(controller) {
303
+ chunks.forEach((item) => {
304
+ controller.enqueue(item);
305
+ });
306
+
307
+ controller.close();
308
+ },
309
+ });
310
+ vi.spyOn(instance['client'].chat.completions, 'create').mockResolvedValue(
311
+ mockStream as any,
312
+ );
313
+
314
+ const stream: string[] = [];
315
+ const result = await instance.chat({
316
+ messages: [{ content: 'Hello', role: 'user' }],
317
+ model: 'gpt-3.5-turbo',
318
+ temperature: 0,
319
+ });
320
+ const decoder = new TextDecoder();
321
+ const reader = result.body!.getReader();
322
+
323
+ while (true) {
324
+ const { value, done } = await reader.read();
325
+ if (done) break;
326
+ stream.push(decoder.decode(value));
327
+ }
328
+
329
+ expect(stream).toEqual(
330
+ [
331
+ 'id: chatcmpl-b3f58dc5-0699-4b28-aefe-6624c2a68d51',
332
+ 'event: text',
333
+ 'data: "好的,我可以帮您查询杭州的天气情况。让我使用实时天气工具来获取杭州的当前天气信息。"\n',
334
+ 'id: chatcmpl-b3f58dc5-0699-4b28-aefe-6624c2a68d51',
335
+ 'event: tool_calls',
336
+ 'data: ""\n',
337
+ 'id: chatcmpl-b3f58dc5-0699-4b28-aefe-6624c2a68d51',
338
+ 'event: stop',
339
+ 'data: "stop"\n',
340
+ ].map((item) => `${item}\n`),
341
+ );
342
+ });
343
+
268
344
  it('should transform non-streaming response to stream correctly', async () => {
269
345
  const mockResponse: OpenAI.ChatCompletion = {
270
346
  id: 'a',