@lobehub/chat 1.6.4 → 1.6.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/docs/self-hosting/advanced/sso-providers/auth0.zh-CN.mdx +4 -8
  3. package/docs/usage/agents/agent-organization.mdx +69 -0
  4. package/docs/usage/agents/agent-organization.zh-CN.mdx +67 -0
  5. package/docs/usage/foundation/basic.mdx +55 -0
  6. package/docs/usage/foundation/basic.zh-CN.mdx +56 -0
  7. package/docs/usage/foundation/share.mdx +46 -0
  8. package/docs/usage/foundation/share.zh-CN.mdx +43 -0
  9. package/docs/usage/foundation/text2image.mdx +49 -0
  10. package/docs/usage/foundation/text2image.zh-CN.mdx +46 -0
  11. package/docs/usage/foundation/translate.mdx +40 -0
  12. package/docs/usage/foundation/translate.zh-CN.mdx +39 -0
  13. package/docs/usage/foundation/tts-stt.mdx +47 -0
  14. package/docs/usage/foundation/tts-stt.zh-CN.mdx +45 -0
  15. package/docs/usage/foundation/vision.mdx +49 -0
  16. package/docs/usage/foundation/vision.zh-CN.mdx +45 -0
  17. package/docs/usage/providers/baichuan.mdx +64 -0
  18. package/docs/usage/providers/baichuan.zh-CN.mdx +61 -0
  19. package/docs/usage/providers/taichu.mdx +64 -0
  20. package/docs/usage/providers/taichu.zh-CN.mdx +61 -0
  21. package/package.json +5 -5
  22. package/src/config/modelProviders/deepseek.ts +1 -0
  23. package/src/config/modelProviders/google.ts +6 -18
  24. package/src/config/modelProviders/groq.ts +11 -5
  25. package/src/config/modelProviders/ollama.ts +26 -3
  26. package/src/config/modelProviders/openai.ts +12 -9
  27. package/src/config/modelProviders/perplexity.ts +3 -3
  28. package/src/config/modelProviders/togetherai.ts +2 -2
  29. package/src/config/modelProviders/zeroone.ts +3 -7
  30. package/src/config/modelProviders/zhipu.ts +8 -4
  31. package/src/libs/agent-runtime/openai/__snapshots__/index.test.ts.snap +2 -2
  32. package/src/libs/agent-runtime/openrouter/__snapshots__/index.test.ts.snap +1 -1
  33. package/src/libs/agent-runtime/qwen/index.test.ts +15 -13
  34. package/src/libs/agent-runtime/qwen/index.ts +1 -1
  35. package/src/libs/agent-runtime/togetherai/__snapshots__/index.test.ts.snap +3 -3
  36. package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.test.ts +15 -7
  37. package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +1 -1
  38. package/src/libs/agent-runtime/utils/streams/qwen.ts +4 -4
  39. package/src/server/routers/edge/config/__snapshots__/index.test.ts.snap +1 -1
@@ -58,9 +58,9 @@ const TogetherAI: ModelProviderCard = {
58
58
  tokens: 32_768,
59
59
  },
60
60
  {
61
- displayName: 'Qwen 1.5 Chat (14B)',
61
+ displayName: 'Qwen 1.5 Chat (32B)',
62
62
  enabled: true,
63
- id: 'Qwen/Qwen1.5-14B-Chat',
63
+ id: 'Qwen/Qwen1.5-32B-Chat',
64
64
  tokens: 32_768,
65
65
  },
66
66
  {
@@ -11,7 +11,8 @@ const ZeroOne: ModelProviderCard = {
11
11
  tokens: 32_768,
12
12
  },
13
13
  {
14
- description: '在 yi-large 模型的基础上支持并强化了工具调用的能力,适用于各种需要搭建 agent 或 workflow 的业务场景。',
14
+ description:
15
+ '在 yi-large 模型的基础上支持并强化了工具调用的能力,适用于各种需要搭建 agent 或 workflow 的业务场景。',
15
16
  displayName: 'Yi Large FC',
16
17
  enabled: true,
17
18
  functionCall: true,
@@ -67,14 +68,9 @@ const ZeroOne: ModelProviderCard = {
67
68
  id: 'yi-large-preview',
68
69
  tokens: 16_384,
69
70
  },
70
- {
71
- description: '「兼容版本模型」实时信息获取,以及文本推理能力增强。',
72
- displayName: 'Yi Large RAG Preview',
73
- id: 'yi-large-rag-preview',
74
- tokens: 16_384,
75
- },
76
71
  ],
77
72
  checkModel: 'yi-large',
73
+ disableBrowserRequest: true,
78
74
  id: 'zeroone',
79
75
  name: '01.AI',
80
76
  };
@@ -6,7 +6,8 @@ import { ModelProviderCard } from '@/types/llm';
6
6
  const ZhiPu: ModelProviderCard = {
7
7
  chatModels: [
8
8
  {
9
- description: 'GLM-4-AllTools 是专门为支持智能体和相关任务而进一步优化的模型版本。它能够自主理解用户的意图,规划复杂的指令,并能够调用一个或多个工具(例如网络浏览器、代码解释器和文本生图像)以完成复杂的任务。',
9
+ description:
10
+ 'GLM-4-AllTools 是专门为支持智能体和相关任务而进一步优化的模型版本。它能够自主理解用户的意图,规划复杂的指令,并能够调用一个或多个工具(例如网络浏览器、代码解释器和文本生图像)以完成复杂的任务。',
10
11
  displayName: 'GLM-4-AllTools',
11
12
  enabled: true,
12
13
  functionCall: true,
@@ -50,7 +51,8 @@ const ZhiPu: ModelProviderCard = {
50
51
  tokens: 128_000,
51
52
  },
52
53
  {
53
- description: '实现了视觉语言特征的深度融合,支持视觉问答、图像字幕、视觉定位、复杂目标检测等各类图像理解任务',
54
+ description:
55
+ '实现了视觉语言特征的深度融合,支持视觉问答、图像字幕、视觉定位、复杂目标检测等各类图像理解任务',
54
56
  displayName: 'GLM-4V',
55
57
  enabled: true,
56
58
  id: 'glm-4v',
@@ -58,14 +60,16 @@ const ZhiPu: ModelProviderCard = {
58
60
  vision: true,
59
61
  },
60
62
  {
61
- description: '适用于对知识量、推理能力、创造力要求较高的场景,比如广告文案、小说写作、知识类写作、代码生成等',
63
+ description:
64
+ '适用于对知识量、推理能力、创造力要求较高的场景,比如广告文案、小说写作、知识类写作、代码生成等', // Will be discontinued on December 31, 2024
62
65
  displayName: 'GLM-3-Turbo',
63
66
  functionCall: true,
64
67
  id: 'glm-3-turbo',
65
68
  tokens: 128_000,
66
69
  },
67
70
  {
68
- description: 'CodeGeeX是一款强大的AI编程助手,提供智能问答和代码补全功能,支持多种编程语言,帮助开发者提高编程效率。',
71
+ description:
72
+ 'CodeGeeX是一款强大的AI编程助手,提供智能问答和代码补全功能,支持多种编程语言,帮助开发者提高编程效率。',
69
73
  displayName: 'CodeGeeX-4',
70
74
  enabled: true,
71
75
  functionCall: false,
@@ -3,7 +3,7 @@
3
3
  exports[`LobeOpenAI > models > should get models 1`] = `
4
4
  [
5
5
  {
6
- "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务",
6
+ "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
7
7
  "displayName": "GPT-3.5 Turbo",
8
8
  "functionCall": true,
9
9
  "id": "gpt-3.5-turbo",
@@ -17,7 +17,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
17
17
  "tokens": 16385,
18
18
  },
19
19
  {
20
- "displayName": "GPT-3.5 Turbo 16K (0613)",
20
+ "description": "Currently points to gpt-3.5-turbo-16k-0613",
21
21
  "id": "gpt-3.5-turbo-16k-0613",
22
22
  "legacy": true,
23
23
  "tokens": 16385,
@@ -59,7 +59,7 @@ Updated by OpenAI to point to the [latest version of GPT-3.5](/models?q=openai/g
59
59
 
60
60
  Usage of Gemma is subject to Google's [Gemma Terms of Use](https://ai.google.dev/gemma/terms).",
61
61
  "displayName": "Google: Gemma 7B",
62
- "enabled": true,
62
+ "enabled": false,
63
63
  "functionCall": false,
64
64
  "id": "google/gemma-7b-it",
65
65
  "maxTokens": undefined,
@@ -3,9 +3,7 @@ import OpenAI from 'openai';
3
3
  import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
4
4
 
5
5
  import Qwen from '@/config/modelProviders/qwen';
6
- import { LobeOpenAICompatibleRuntime } from '@/libs/agent-runtime';
7
- import { ModelProvider } from '@/libs/agent-runtime';
8
- import { AgentRuntimeErrorType } from '@/libs/agent-runtime';
6
+ import { AgentRuntimeErrorType, ModelProvider } from '@/libs/agent-runtime';
9
7
 
10
8
  import * as debugStreamModule from '../utils/debugStream';
11
9
  import { LobeQwenAI } from './index';
@@ -134,19 +132,23 @@ describe('LobeQwenAI', () => {
134
132
  });
135
133
 
136
134
  const decoder = new TextDecoder();
137
-
138
135
  const reader = result.body!.getReader();
139
- expect(decoder.decode((await reader.read()).value)).toContain(
140
- 'id: chatcmpl-fc539f49-51a8-94be-8061\n',
141
- );
142
- expect(decoder.decode((await reader.read()).value)).toContain('event: text\n');
143
- expect(decoder.decode((await reader.read()).value)).toContain('data: "Hello"\n\n');
136
+ const stream: string[] = [];
144
137
 
145
- expect(decoder.decode((await reader.read()).value)).toContain(
138
+ while (true) {
139
+ const { value, done } = await reader.read();
140
+ if (done) break;
141
+ stream.push(decoder.decode(value));
142
+ }
143
+
144
+ expect(stream).toEqual([
146
145
  'id: chatcmpl-fc539f49-51a8-94be-8061\n',
147
- );
148
- expect(decoder.decode((await reader.read()).value)).toContain('event: stop\n');
149
- expect(decoder.decode((await reader.read()).value)).toContain('');
146
+ 'event: text\n',
147
+ 'data: "Hello"\n\n',
148
+ 'id: chatcmpl-fc539f49-51a8-94be-8061\n',
149
+ 'event: stop\n',
150
+ 'data: "stop"\n\n',
151
+ ]);
150
152
 
151
153
  expect((await reader.read()).done).toBe(true);
152
154
  });
@@ -123,6 +123,6 @@ export class LobeQwenAI extends LobeOpenAICompatibleRuntime implements LobeRunti
123
123
  'result_format',
124
124
  'top_p',
125
125
  )
126
- : params;
126
+ : omit(params, 'frequency_penalty');
127
127
  }
128
128
  }
@@ -135,7 +135,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = `
135
135
  {
136
136
  "description": "Qwen1.5 is the beta version of Qwen2, a transformer-based decoder-only language model pretrained on a large amount of data. In comparison with the previous released Qwen.",
137
137
  "displayName": "Qwen 1.5 Chat (14B)",
138
- "enabled": true,
138
+ "enabled": false,
139
139
  "functionCall": false,
140
140
  "id": "Qwen/Qwen1.5-14B-Chat",
141
141
  "maxOutput": 32768,
@@ -145,7 +145,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = `
145
145
  {
146
146
  "description": "Qwen1.5 is the beta version of Qwen2, a transformer-based decoder-only language model pretrained on a large amount of data. In comparison with the previous released Qwen.",
147
147
  "displayName": "Qwen 1.5 Chat (32B)",
148
- "enabled": false,
148
+ "enabled": true,
149
149
  "functionCall": false,
150
150
  "id": "Qwen/Qwen1.5-32B-Chat",
151
151
  "maxOutput": 32768,
@@ -335,7 +335,7 @@ exports[`LobeTogetherAI > models > should get models 1`] = `
335
335
  {
336
336
  "description": "Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models.",
337
337
  "displayName": "Gemma Instruct (7B)",
338
- "enabled": true,
338
+ "enabled": false,
339
339
  "functionCall": false,
340
340
  "id": "google/gemma-7b-it",
341
341
  "maxOutput": 8192,
@@ -373,15 +373,23 @@ describe('LobeOpenAICompatibleFactory', () => {
373
373
  });
374
374
 
375
375
  const decoder = new TextDecoder();
376
-
377
376
  const reader = result.body!.getReader();
378
- expect(decoder.decode((await reader.read()).value)).toContain('id: a\n');
379
- expect(decoder.decode((await reader.read()).value)).toContain('event: text\n');
380
- expect(decoder.decode((await reader.read()).value)).toContain('data: "Hello"\n\n');
377
+ const stream: string[] = [];
378
+
379
+ while (true) {
380
+ const { value, done } = await reader.read();
381
+ if (done) break;
382
+ stream.push(decoder.decode(value));
383
+ }
381
384
 
382
- expect(decoder.decode((await reader.read()).value)).toContain('id: a\n');
383
- expect(decoder.decode((await reader.read()).value)).toContain('event: text\n');
384
- expect(decoder.decode((await reader.read()).value)).toContain('');
385
+ expect(stream).toEqual([
386
+ 'id: a\n',
387
+ 'event: text\n',
388
+ 'data: "Hello"\n\n',
389
+ 'id: a\n',
390
+ 'event: stop\n',
391
+ 'data: "stop"\n\n',
392
+ ]);
385
393
 
386
394
  expect((await reader.read()).done).toBe(true);
387
395
  });
@@ -89,7 +89,7 @@ export function transformResponseToStream(data: OpenAI.ChatCompletion) {
89
89
  controller.enqueue({
90
90
  choices: data.choices.map((choice: OpenAI.ChatCompletion.Choice) => ({
91
91
  delta: {
92
- content: choice.message.content,
92
+ content: null,
93
93
  role: choice.message.role,
94
94
  },
95
95
  finish_reason: choice.finish_reason,
@@ -62,14 +62,14 @@ export const transformQwenStream = (chunk: OpenAI.ChatCompletionChunk): StreamPr
62
62
  } as StreamProtocolToolCallChunk;
63
63
  }
64
64
 
65
- if (item.finish_reason) {
66
- return { data: item.finish_reason, id: chunk.id, type: 'stop' };
67
- }
68
-
69
65
  if (typeof item.delta?.content === 'string') {
70
66
  return { data: item.delta.content, id: chunk.id, type: 'text' };
71
67
  }
72
68
 
69
+ if (item.finish_reason) {
70
+ return { data: item.finish_reason, id: chunk.id, type: 'stop' };
71
+ }
72
+
73
73
  if (item.delta?.content === null) {
74
74
  return { data: item.delta, id: chunk.id, type: 'data' };
75
75
  }
@@ -40,7 +40,7 @@ exports[`configRouter > getGlobalConfig > Model Provider env > OPENAI_MODEL_LIST
40
40
  "tokens": 16385,
41
41
  },
42
42
  {
43
- "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务",
43
+ "description": "GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125",
44
44
  "displayName": "GPT-3.5 Turbo",
45
45
  "enabled": true,
46
46
  "functionCall": true,