@lobehub/chat 1.113.2 → 1.113.3

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,32 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.113.3](https://github.com/lobehub/lobe-chat/compare/v1.113.2...v1.113.3)
6
+
7
+ <sup>Released on **2025-08-19**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Support Grok thinking models in AiHubMix, The 'stream_options' parameter is only allowed when 'stream' is enabled.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Support Grok thinking models in AiHubMix, closes [#8713](https://github.com/lobehub/lobe-chat/issues/8713) ([ffa9b1b](https://github.com/lobehub/lobe-chat/commit/ffa9b1b))
21
+ - **misc**: The 'stream_options' parameter is only allowed when 'stream' is enabled, closes [#8778](https://github.com/lobehub/lobe-chat/issues/8778) ([fcc32d5](https://github.com/lobehub/lobe-chat/commit/fcc32d5))
22
+
23
+ </details>
24
+
25
+ <div align="right">
26
+
27
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
28
+
29
+ </div>
30
+
5
31
  ### [Version 1.113.2](https://github.com/lobehub/lobe-chat/compare/v1.113.1...v1.113.2)
6
32
 
7
33
  <sup>Released on **2025-08-18**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Support Grok thinking models in AiHubMix, The 'stream_options' parameter is only allowed when 'stream' is enabled."
6
+ ]
7
+ },
8
+ "date": "2025-08-19",
9
+ "version": "1.113.3"
10
+ },
2
11
  {
3
12
  "children": {},
4
13
  "date": "2025-08-18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.113.2",
3
+ "version": "1.113.3",
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",
@@ -35,8 +35,6 @@ export const responsesAPIModels = new Set([
35
35
  'codex-mini-latest',
36
36
  'computer-use-preview',
37
37
  'computer-use-preview-2025-03-11',
38
- 'gpt-5',
39
- 'gpt-5-mini',
40
38
  ]);
41
39
 
42
40
  /**
@@ -4,6 +4,7 @@ import { LobeCloudflareAI } from '../cloudflare';
4
4
  import { LobeFalAI } from '../fal';
5
5
  import { LobeGoogleAI } from '../google';
6
6
  import { LobeOpenAI } from '../openai';
7
+ import { LobeXAI } from '../xai';
7
8
 
8
9
  export const baseRuntimeMap = {
9
10
  anthropic: LobeAnthropicAI,
@@ -12,4 +13,5 @@ export const baseRuntimeMap = {
12
13
  fal: LobeFalAI,
13
14
  google: LobeGoogleAI,
14
15
  openai: LobeOpenAI,
16
+ xai: LobeXAI,
15
17
  };
@@ -65,6 +65,13 @@ export const LobeAiHubMixAI = createRouterRuntime({
65
65
  ),
66
66
  options: { baseURL: urlJoin(baseURL, '/gemini') },
67
67
  },
68
+ {
69
+ apiType: 'xai',
70
+ models: LOBE_DEFAULT_MODEL_LIST.map((m) => m.id).filter(
71
+ (id) => detectModelProvider(id) === 'xai',
72
+ ),
73
+ options: { baseURL: urlJoin(baseURL, '/v1') },
74
+ },
68
75
  {
69
76
  apiType: 'openai',
70
77
  options: {
@@ -11,6 +11,16 @@ export interface OpenAIModelCard {
11
11
 
12
12
  const prunePrefixes = ['o1', 'o3', 'o4', 'codex', 'computer-use', 'gpt-5'];
13
13
  const oaiSearchContextSize = process.env.OPENAI_SEARCH_CONTEXT_SIZE; // low, medium, high
14
+ const enableServiceTierFlex = process.env.OPENAI_SERVICE_TIER_FLEX === '1';
15
+ const flexSupportedModels = ['gpt-5', 'o3', 'o4-mini']; // Flex 处理仅适用于这些模型
16
+
17
+ const supportsFlexTier = (model: string) => {
18
+ // 排除 o3-mini,其不支持 Flex 处理
19
+ if (model.startsWith('o3-mini')) {
20
+ return false;
21
+ }
22
+ return flexSupportedModels.some(supportedModel => model.startsWith(supportedModel));
23
+ };
14
24
 
15
25
  export const LobeOpenAI = createOpenAICompatibleRuntime({
16
26
  baseURL: 'https://api.openai.com/v1',
@@ -32,6 +42,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
32
42
  frequency_penalty: undefined,
33
43
  model,
34
44
  presence_penalty: undefined,
45
+ ...(enableServiceTierFlex && supportsFlexTier(model) && { service_tier: 'flex' }),
35
46
  stream: payload.stream ?? true,
36
47
  temperature: undefined,
37
48
  top_p: undefined,
@@ -43,7 +54,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
43
54
  } as any;
44
55
  }
45
56
 
46
- return { ...rest, model, stream: payload.stream ?? true };
57
+ return { ...rest, model, ...(enableServiceTierFlex && supportsFlexTier(model) && { service_tier: 'flex' }), stream: payload.stream ?? true };
47
58
  },
48
59
  },
49
60
  debug: {
@@ -81,6 +92,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
81
92
  reasoning: payload.reasoning
82
93
  ? { ...payload.reasoning, summary: 'auto' }
83
94
  : { summary: 'auto' },
95
+ ...(enableServiceTierFlex && supportsFlexTier(model) && { service_tier: 'flex' }),
84
96
  stream: payload.stream ?? true,
85
97
  tools: openaiTools as any,
86
98
  // computer-use series must set truncation as auto
@@ -91,7 +103,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
91
103
  }) as any;
92
104
  }
93
105
 
94
- return { ...rest, model, stream: payload.stream ?? true, tools: openaiTools } as any;
106
+ return { ...rest, model, ...(enableServiceTierFlex && supportsFlexTier(model) && { service_tier: 'flex' }), stream: payload.stream ?? true, tools: openaiTools } as any;
95
107
  },
96
108
  },
97
109
  });
@@ -101,8 +101,11 @@ export const convertOpenAIResponseInputs = async (
101
101
  };
102
102
 
103
103
  export const pruneReasoningPayload = (payload: ChatStreamPayload) => {
104
+ const shouldStream = !disableStreamModels.has(payload.model);
105
+ const { stream_options, ...cleanedPayload } = payload as any;
106
+
104
107
  return {
105
- ...payload,
108
+ ...cleanedPayload,
106
109
  frequency_penalty: 0,
107
110
  messages: payload.messages.map((message: OpenAIChatMessage) => ({
108
111
  ...message,
@@ -114,7 +117,9 @@ export const pruneReasoningPayload = (payload: ChatStreamPayload) => {
114
117
  : message.role,
115
118
  })),
116
119
  presence_penalty: 0,
117
- stream: !disableStreamModels.has(payload.model),
120
+ stream: shouldStream,
121
+ // Only include stream_options when stream is enabled
122
+ ...(shouldStream && stream_options && { stream_options }),
118
123
  temperature: 1,
119
124
  top_p: 1,
120
125
  };
@@ -33,7 +33,7 @@ const groqChatModels: AIChatModelCard[] = [
33
33
  'OpenAI GPT-OSS 120B 是一款拥有 1200 亿参数的顶尖语言模型,内置浏览器搜索和代码执行功能,并具备推理能力。',
34
34
  displayName: 'GPT OSS 120B',
35
35
  id: 'openai/gpt-oss-120b',
36
- maxOutput: 32_768,
36
+ maxOutput: 65_536,
37
37
  pricing: {
38
38
  units: [
39
39
  { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
@@ -53,7 +53,7 @@ const groqChatModels: AIChatModelCard[] = [
53
53
  'OpenAI GPT-OSS 20B 是一款拥有 200 亿参数的顶尖语言模型,内置浏览器搜索和代码执行功能,并具备推理能力。',
54
54
  displayName: 'GPT OSS 20B',
55
55
  id: 'openai/gpt-oss-20b',
56
- maxOutput: 32_768,
56
+ maxOutput: 65_536,
57
57
  pricing: {
58
58
  units: [
59
59
  { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
@@ -519,21 +519,61 @@ const qwenChatModels: AIChatModelCard[] = [
519
519
  search: true,
520
520
  },
521
521
  config: {
522
- deploymentName: 'qwen-plus-2025-07-14',
522
+ deploymentName: 'qwen-plus-2025-07-28',
523
523
  },
524
- contextWindowTokens: 131_072,
524
+ contextWindowTokens: 1_000_000,
525
525
  description: '通义千问超大规模语言模型增强版,支持中文、英文等不同语言输入。',
526
526
  displayName: 'Qwen Plus',
527
527
  enabled: true,
528
528
  id: 'qwen-plus',
529
- maxOutput: 16_384,
529
+ maxOutput: 32_768,
530
530
  organization: 'Qwen',
531
531
  pricing: {
532
532
  currency: 'CNY',
533
533
  units: [
534
- { name: 'textInput_cacheRead', rate: 0.32, strategy: 'fixed', unit: 'millionTokens' },
535
- { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
536
- { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
534
+ {
535
+ lookup: {
536
+ prices: {
537
+ '[0, 128_000]': 0.8 * 0.4,
538
+ '[128_000, 256_000]': 2.4 * 0.4,
539
+ '[256_000, infinity]': 4.8 * 0.4,
540
+ },
541
+ pricingParams: ['textInputRange'],
542
+ },
543
+ name: 'textInput_cacheRead',
544
+ strategy: 'lookup',
545
+ unit: 'millionTokens',
546
+ },
547
+ {
548
+ lookup: {
549
+ prices: {
550
+ '[0, 128_000]': 0.8,
551
+ '[128_000, 256_000]': 2.4,
552
+ '[256_000, infinity]': 4.8,
553
+ },
554
+ pricingParams: ['textInputRange'],
555
+ },
556
+ name: 'textInput',
557
+ strategy: 'lookup',
558
+ unit: 'millionTokens',
559
+ },
560
+ {
561
+ lookup: {
562
+ prices: {
563
+ '[0, 128_000]_[false]': 2,
564
+ '[0, 128_000]_[true]': 8,
565
+ '[128_000, 256_000]_[false]': 20,
566
+
567
+ '[128_000, 256_000]_[true]': 24,
568
+ '[256_000, infinity]_[false]': 48,
569
+ '[256_000, infinity]_[true]': 64,
570
+ },
571
+ pricingParams: ['textInputRange', 'thinkingMode'],
572
+ },
573
+ name: 'textOutput',
574
+ strategy: 'lookup',
575
+ unit: 'millionTokens',
576
+ },
537
577
  ],
538
578
  },
539
579
  releasedAt: '2025-07-14',
@@ -643,7 +683,7 @@ const qwenChatModels: AIChatModelCard[] = [
643
683
  vision: true,
644
684
  },
645
685
  config: {
646
- deploymentName: 'qwen-vl-plus-2025-01-25',
686
+ deploymentName: 'qwen-vl-plus-2025-08-15',
647
687
  },
648
688
  contextWindowTokens: 131_072,
649
689
  description:
@@ -655,9 +695,9 @@ const qwenChatModels: AIChatModelCard[] = [
655
695
  pricing: {
656
696
  currency: 'CNY',
657
697
  units: [
658
- { name: 'textInput_cacheRead', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
659
- { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
660
- { name: 'textOutput', rate: 4.5, strategy: 'fixed', unit: 'millionTokens' },
698
+ { name: 'textInput_cacheRead', rate: 0.8 * 0.4, strategy: 'fixed', unit: 'millionTokens' },
699
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
700
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
661
701
  ],
662
702
  },
663
703
  type: 'chat',
@@ -667,7 +707,7 @@ const qwenChatModels: AIChatModelCard[] = [
667
707
  vision: true,
668
708
  },
669
709
  config: {
670
- deploymentName: 'qwen-vl-max-2025-04-08',
710
+ deploymentName: 'qwen-vl-max-2025-08-13',
671
711
  },
672
712
  contextWindowTokens: 131_072,
673
713
  description:
@@ -679,9 +719,9 @@ const qwenChatModels: AIChatModelCard[] = [
679
719
  pricing: {
680
720
  currency: 'CNY',
681
721
  units: [
682
- { name: 'textInput_cacheRead', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
683
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
684
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
722
+ { name: 'textInput_cacheRead', rate: 1.6 * 0.4, strategy: 'fixed', unit: 'millionTokens' },
723
+ { name: 'textInput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
724
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
685
725
  ],
686
726
  },
687
727
  type: 'chat',
@@ -1304,6 +1344,30 @@ const qwenChatModels: AIChatModelCard[] = [
1304
1344
  ];
1305
1345
 
1306
1346
  const qwenImageModels: AIImageModelCard[] = [
1347
+ {
1348
+ description:
1349
+ 'Qwen-Image 是一款通用图像生成模型,支持多种艺术风格,尤其擅长复杂文本渲染,特别是中英文文本渲染。模型支持多行布局、段落级文本生成以及细粒度细节刻画,可实现复杂的图文混合布局设计。',
1350
+ displayName: 'Qwen Image',
1351
+ enabled: true,
1352
+ id: 'qwen-image',
1353
+ organization: 'Qwen',
1354
+ parameters: {
1355
+ prompt: {
1356
+ default: '',
1357
+ },
1358
+ seed: { default: null },
1359
+ size: {
1360
+ default: '1328*1328',
1361
+ enum: ['1664*928', '1472*1140', '1328*1328', '1140*1472', '928*1664'],
1362
+ },
1363
+ },
1364
+ pricing: {
1365
+ currency: 'CNY',
1366
+ units: [{ name: 'imageGeneration', rate: 0.25, strategy: 'fixed', unit: 'image' }],
1367
+ },
1368
+ releasedAt: '2025-08-13',
1369
+ type: 'image',
1370
+ },
1307
1371
  {
1308
1372
  description:
1309
1373
  '万相2.2极速版,当前最新模型。在创意性、稳定性、写实质感上全面升级,生成速度快,性价比高。',
@@ -61,6 +61,27 @@ const siliconcloudChatModels: AIChatModelCard[] = [
61
61
  releasedAt: '2025-07-31',
62
62
  type: 'chat',
63
63
  },
64
+ {
65
+ abilities: {
66
+ functionCall: true,
67
+ reasoning: true,
68
+ vision: true,
69
+ },
70
+ contextWindowTokens: 65_536,
71
+ description:
72
+ 'GLM-4.5V 是由智谱 AI(Zhipu AI)发布的最新一代视觉语言模型(VLM)该模型基于拥有 106B 总参数和 12B 激活参数的旗舰文本模型 GLM-4.5-Air 构建,采用了混合专家(MoE)架构,旨在以更低的推理成本实现卓越性能 GLM-4.5V 在技术上延续了 GLM-4.1V-Thinking 的路线,并引入了三维旋转位置编码(3D-RoPE)等创新,显著增强了对三维空间关系的感知与推理能力。通过在预训练、监督微调和强化学习阶段的优化,该模型具备了处理图像、视频、长文档等多种视觉内容的能力,在 41 个公开的多模态基准测试中达到了同级别开源模型的顶尖水平此外,模型还新增了“思考模式”开关,允许用户在快速响应和深度推理之间灵活选择,以平衡效率与效果。',
73
+ displayName: 'GLM-4.5V',
74
+ id: 'zai-org/GLM-4.5V',
75
+ pricing: {
76
+ currency: 'CNY',
77
+ units: [
78
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
79
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
80
+ ],
81
+ },
82
+ releasedAt: '2025-08-11',
83
+ type: 'chat',
84
+ },
64
85
  {
65
86
  abilities: {
66
87
  functionCall: true,
@@ -143,6 +143,10 @@ class DiscoverService {
143
143
  errorCode,
144
144
  ...params
145
145
  }: InstallReportRequest) => {
146
+ // if user don't allow tracing, just not report installation
147
+ const allow = preferenceSelectors.userAllowTrace(useUserStore.getState());
148
+
149
+ if (!allow) return;
146
150
  await this.injectMPToken();
147
151
 
148
152
  const reportData = {
@@ -164,7 +168,8 @@ class DiscoverService {
164
168
  * 上报插件调用结果
165
169
  */
166
170
  reportPluginCall = async (reportData: CallReportRequest) => {
167
- const allow = useUserStore(preferenceSelectors.userAllowTrace);
171
+ // if user don't allow tracing , just not report calling
172
+ const allow = preferenceSelectors.userAllowTrace(useUserStore.getState());
168
173
 
169
174
  if (!allow) return;
170
175