@lobehub/chat 1.88.1 → 1.88.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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.88.2](https://github.com/lobehub/lobe-chat/compare/v1.88.1...v1.88.2)
6
+
7
+ <sup>Released on **2025-05-24**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Add live search support for xAI.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Add live search support for xAI, closes [#7907](https://github.com/lobehub/lobe-chat/issues/7907) ([dff4b7b](https://github.com/lobehub/lobe-chat/commit/dff4b7b))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 1.88.1](https://github.com/lobehub/lobe-chat/compare/v1.88.0...v1.88.1)
6
31
 
7
32
  <sup>Released on **2025-05-24**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Add live search support for xAI."
6
+ ]
7
+ },
8
+ "date": "2025-05-24",
9
+ "version": "1.88.2"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.88.1",
3
+ "version": "1.88.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",
@@ -5,91 +5,91 @@ const xaiChatModels: AIChatModelCard[] = [
5
5
  {
6
6
  abilities: {
7
7
  functionCall: true,
8
+ search: true,
8
9
  },
9
10
  contextWindowTokens: 131_072,
10
11
  description:
11
12
  '旗舰级模型,擅长数据提取、编程和文本摘要等企业级应用,拥有金融、医疗、法律和科学等领域的深厚知识。',
12
- displayName: 'Grok 3 Beta',
13
+ displayName: 'Grok 3',
13
14
  enabled: true,
14
- id: 'grok-3-beta',
15
+ id: 'grok-3',
15
16
  pricing: {
16
17
  input: 3,
17
18
  output: 15,
18
19
  },
19
20
  releasedAt: '2025-04-03',
21
+ settings: {
22
+ searchImpl: 'params',
23
+ },
20
24
  type: 'chat',
21
25
  },
22
26
  {
23
27
  abilities: {
24
28
  functionCall: true,
29
+ search: true,
25
30
  },
26
31
  contextWindowTokens: 131_072,
27
32
  description:
28
33
  '旗舰级模型,擅长数据提取、编程和文本摘要等企业级应用,拥有金融、医疗、法律和科学等领域的深厚知识。',
29
- displayName: 'Grok 3 Beta (Fast mode)',
30
- id: 'grok-3-fast-beta',
34
+ displayName: 'Grok 3 (Fast mode)',
35
+ id: 'grok-3-fast',
31
36
  pricing: {
32
37
  input: 5,
33
38
  output: 25,
34
39
  },
35
40
  releasedAt: '2025-04-03',
41
+ settings: {
42
+ searchImpl: 'params',
43
+ },
36
44
  type: 'chat',
37
45
  },
38
46
  {
39
47
  abilities: {
40
48
  functionCall: true,
41
49
  reasoning: true,
50
+ search: true,
42
51
  },
43
52
  contextWindowTokens: 131_072,
44
53
  description:
45
54
  '轻量级模型,回话前会先思考。运行快速、智能,适用于不需要深层领域知识的逻辑任务,并能获取原始的思维轨迹。',
46
- displayName: 'Grok 3 Mini Beta',
55
+ displayName: 'Grok 3 Mini',
47
56
  enabled: true,
48
- id: 'grok-3-mini-beta',
57
+ id: 'grok-3-mini',
49
58
  pricing: {
50
59
  input: 0.3,
51
60
  output: 0.5,
52
61
  },
53
62
  releasedAt: '2025-04-03',
63
+ settings: {
64
+ searchImpl: 'params',
65
+ },
54
66
  type: 'chat',
55
67
  },
56
68
  {
57
69
  abilities: {
58
70
  functionCall: true,
59
71
  reasoning: true,
72
+ search: true,
60
73
  },
61
74
  contextWindowTokens: 131_072,
62
75
  description:
63
76
  '轻量级模型,回话前会先思考。运行快速、智能,适用于不需要深层领域知识的逻辑任务,并能获取原始的思维轨迹。',
64
- displayName: 'Grok 3 Mini Beta (Fast mode)',
65
- id: 'grok-3-mini-fast-beta',
77
+ displayName: 'Grok 3 Mini (Fast mode)',
78
+ id: 'grok-3-mini-fast',
66
79
  pricing: {
67
80
  input: 0.6,
68
81
  output: 4,
69
82
  },
70
83
  releasedAt: '2025-04-03',
71
- type: 'chat',
72
- },
73
- {
74
- abilities: {
75
- functionCall: true,
76
- vision: true,
77
- },
78
- contextWindowTokens: 32_768,
79
- description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
80
- displayName: 'Grok 2 Vision 1212',
81
- enabled: true,
82
- id: 'grok-2-vision-1212',
83
- pricing: {
84
- input: 2,
85
- output: 10,
84
+ settings: {
85
+ searchImpl: 'params',
86
86
  },
87
- releasedAt: '2024-12-12',
88
87
  type: 'chat',
89
88
  },
90
89
  {
91
90
  abilities: {
92
91
  functionCall: true,
92
+ search: true,
93
93
  },
94
94
  contextWindowTokens: 131_072,
95
95
  description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
@@ -100,34 +100,29 @@ const xaiChatModels: AIChatModelCard[] = [
100
100
  output: 10,
101
101
  },
102
102
  releasedAt: '2024-12-12',
103
- type: 'chat',
104
- },
105
- {
106
- abilities: {
107
- functionCall: true,
108
- },
109
- contextWindowTokens: 131_072,
110
- description: '拥有与 Grok 2 相当的性能,但具有更高的效率、速度和功能。',
111
- displayName: 'Grok Beta',
112
- id: 'grok-beta', // legacy
113
- pricing: {
114
- input: 5,
115
- output: 15,
103
+ settings: {
104
+ searchImpl: 'params',
116
105
  },
117
106
  type: 'chat',
118
107
  },
119
108
  {
120
109
  abilities: {
121
110
  functionCall: true,
111
+ search: true,
122
112
  vision: true,
123
113
  },
124
- contextWindowTokens: 8192,
125
- description: '最新的图像理解模型,可以处理各种各样的视觉信息,包括文档、图表、截图和照片等。',
126
- displayName: 'Grok Vision Beta',
127
- id: 'grok-vision-beta', // legacy
114
+ contextWindowTokens: 32_768,
115
+ description: '该模型在准确性、指令遵循和多语言能力方面有所改进。',
116
+ displayName: 'Grok 2 Vision 1212',
117
+ enabled: true,
118
+ id: 'grok-2-vision-1212',
128
119
  pricing: {
129
- input: 5,
130
- output: 15,
120
+ input: 2,
121
+ output: 10,
122
+ },
123
+ releasedAt: '2024-12-12',
124
+ settings: {
125
+ searchImpl: 'params',
131
126
  },
132
127
  type: 'chat',
133
128
  },
@@ -10,8 +10,4 @@ testProvider({
10
10
  defaultBaseURL: 'https://api.x.ai/v1',
11
11
  chatDebugEnv: 'DEBUG_XAI_CHAT_COMPLETION',
12
12
  chatModel: 'grok',
13
-
14
- test: {
15
- skipAPICall: true,
16
- },
17
13
  });
@@ -10,16 +10,36 @@ export interface XAIModelCard {
10
10
  export const LobeXAI = LobeOpenAICompatibleFactory({
11
11
  baseURL: 'https://api.x.ai/v1',
12
12
  chatCompletion: {
13
- // xAI API does not support stream_options: { include_usage: true }
14
- excludeUsage: true,
15
13
  handlePayload: (payload) => {
16
- const { frequency_penalty, model, presence_penalty, ...rest } = payload;
14
+ const { enabledSearch, frequency_penalty, model, presence_penalty, ...rest } = payload;
17
15
 
18
16
  return {
19
17
  ...rest,
20
18
  frequency_penalty: model.includes('grok-3-mini') ? undefined : frequency_penalty,
21
19
  model,
22
20
  presence_penalty: model.includes('grok-3-mini') ? undefined : presence_penalty,
21
+ stream: true,
22
+ ...(enabledSearch && {
23
+ search_parameters: {
24
+ max_search_results: Math.min(Math.max(parseInt(process.env.XAI_MAX_SEARCH_RESULTS ?? '15', 10), 1), 30),
25
+ mode: 'auto',
26
+ return_citations: true,
27
+ sources: [
28
+ {
29
+ safe_search: process.env.XAI_SAFE_SEARCH === '1',
30
+ type: 'news',
31
+ },
32
+ /*
33
+ { type: 'rss' },
34
+ */
35
+ {
36
+ safe_search: process.env.XAI_SAFE_SEARCH === '1',
37
+ type: 'web',
38
+ },
39
+ { type: 'x' },
40
+ ],
41
+ },
42
+ }),
23
43
  } as any;
24
44
  },
25
45
  },