@lobehub/chat 1.65.1 → 1.66.0

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.
@@ -2,6 +2,9 @@ import { AIChatModelCard } from '@/types/aiModel';
2
2
 
3
3
  const sparkChatModels: AIChatModelCard[] = [
4
4
  {
5
+ abilities: {
6
+ search: true,
7
+ },
5
8
  contextWindowTokens: 8192,
6
9
  description:
7
10
  'Spark Lite 是一款轻量级大语言模型,具备极低的延迟与高效的处理能力,完全免费开放,支持实时在线搜索功能。其快速响应的特性使其在低算力设备上的推理应用和模型微调中表现出色,为用户带来出色的成本效益和智能体验,尤其在知识问答、内容生成及搜索场景下表现不俗。',
@@ -9,9 +12,15 @@ const sparkChatModels: AIChatModelCard[] = [
9
12
  enabled: true,
10
13
  id: 'lite',
11
14
  maxOutput: 4096,
15
+ settings: {
16
+ searchImpl: 'internal',
17
+ },
12
18
  type: 'chat',
13
19
  },
14
20
  {
21
+ abilities: {
22
+ search: true,
23
+ },
15
24
  contextWindowTokens: 8192,
16
25
  description:
17
26
  'Spark Pro 是一款为专业领域优化的高性能大语言模型,专注数学、编程、医疗、教育等多个领域,并支持联网搜索及内置天气、日期等插件。其优化后模型在复杂知识问答、语言理解及高层次文本创作中展现出色表现和高效性能,是适合专业应用场景的理想选择。',
@@ -19,9 +28,15 @@ const sparkChatModels: AIChatModelCard[] = [
19
28
  enabled: true,
20
29
  id: 'generalv3',
21
30
  maxOutput: 8192,
31
+ settings: {
32
+ searchImpl: 'internal',
33
+ },
22
34
  type: 'chat',
23
35
  },
24
36
  {
37
+ abilities: {
38
+ search: true,
39
+ },
25
40
  contextWindowTokens: 131_072,
26
41
  description:
27
42
  'Spark Pro 128K 配置了特大上下文处理能力,能够处理多达128K的上下文信息,特别适合需通篇分析和长期逻辑关联处理的长文内容,可在复杂文本沟通中提供流畅一致的逻辑与多样的引用支持。',
@@ -29,11 +44,15 @@ const sparkChatModels: AIChatModelCard[] = [
29
44
  enabled: true,
30
45
  id: 'pro-128k',
31
46
  maxOutput: 4096,
47
+ settings: {
48
+ searchImpl: 'internal',
49
+ },
32
50
  type: 'chat',
33
51
  },
34
52
  {
35
53
  abilities: {
36
54
  functionCall: true,
55
+ search: true,
37
56
  },
38
57
  contextWindowTokens: 8192,
39
58
  description:
@@ -42,11 +61,15 @@ const sparkChatModels: AIChatModelCard[] = [
42
61
  enabled: true,
43
62
  id: 'generalv3.5',
44
63
  maxOutput: 8192,
64
+ settings: {
65
+ searchImpl: 'internal',
66
+ },
45
67
  type: 'chat',
46
68
  },
47
69
  {
48
70
  abilities: {
49
71
  functionCall: true,
72
+ search: true,
50
73
  },
51
74
  contextWindowTokens: 32_768,
52
75
  description:
@@ -55,11 +78,15 @@ const sparkChatModels: AIChatModelCard[] = [
55
78
  enabled: true,
56
79
  id: 'max-32k',
57
80
  maxOutput: 8192,
81
+ settings: {
82
+ searchImpl: 'internal',
83
+ },
58
84
  type: 'chat',
59
85
  },
60
86
  {
61
87
  abilities: {
62
88
  functionCall: true,
89
+ search: true,
63
90
  },
64
91
  contextWindowTokens: 8192,
65
92
  description:
@@ -68,6 +95,9 @@ const sparkChatModels: AIChatModelCard[] = [
68
95
  enabled: true,
69
96
  id: '4.0Ultra',
70
97
  maxOutput: 8192,
98
+ settings: {
99
+ searchImpl: 'internal',
100
+ },
71
101
  type: 'chat',
72
102
  },
73
103
  ];
@@ -6,6 +6,7 @@ const stepfunChatModels: AIChatModelCard[] = [
6
6
  {
7
7
  abilities: {
8
8
  functionCall: true,
9
+ search: true,
9
10
  },
10
11
  contextWindowTokens: 8000,
11
12
  description: '高速模型,适合实时对话。',
@@ -17,11 +18,15 @@ const stepfunChatModels: AIChatModelCard[] = [
17
18
  input: 1,
18
19
  output: 4,
19
20
  },
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: 8000,
27
32
  description: '小型模型,适合轻量级任务。',
@@ -33,11 +38,15 @@ const stepfunChatModels: AIChatModelCard[] = [
33
38
  input: 5,
34
39
  output: 20,
35
40
  },
41
+ settings: {
42
+ searchImpl: 'params',
43
+ },
36
44
  type: 'chat',
37
45
  },
38
46
  {
39
47
  abilities: {
40
48
  functionCall: true,
49
+ search: true,
41
50
  },
42
51
  contextWindowTokens: 32_000,
43
52
  description: '支持中等长度的对话,适用于多种应用场景。',
@@ -49,11 +58,15 @@ const stepfunChatModels: AIChatModelCard[] = [
49
58
  input: 15,
50
59
  output: 70,
51
60
  },
61
+ settings: {
62
+ searchImpl: 'params',
63
+ },
52
64
  type: 'chat',
53
65
  },
54
66
  {
55
67
  abilities: {
56
68
  functionCall: true,
69
+ search: true,
57
70
  },
58
71
  contextWindowTokens: 128_000,
59
72
  description: '平衡性能与成本,适合一般场景。',
@@ -65,11 +78,15 @@ const stepfunChatModels: AIChatModelCard[] = [
65
78
  input: 40,
66
79
  output: 200,
67
80
  },
81
+ settings: {
82
+ searchImpl: 'params',
83
+ },
68
84
  type: 'chat',
69
85
  },
70
86
  {
71
87
  abilities: {
72
88
  functionCall: true,
89
+ search: true,
73
90
  },
74
91
  contextWindowTokens: 256_000,
75
92
  description: '具备超长上下文处理能力,尤其适合长文档分析。',
@@ -80,11 +97,15 @@ const stepfunChatModels: AIChatModelCard[] = [
80
97
  input: 95,
81
98
  output: 300,
82
99
  },
100
+ settings: {
101
+ searchImpl: 'params',
102
+ },
83
103
  type: 'chat',
84
104
  },
85
105
  {
86
106
  abilities: {
87
107
  functionCall: true,
108
+ search: true,
88
109
  },
89
110
  contextWindowTokens: 16_000,
90
111
  description: '支持大规模上下文交互,适合复杂对话场景。',
@@ -96,11 +117,15 @@ const stepfunChatModels: AIChatModelCard[] = [
96
117
  input: 38,
97
118
  output: 120,
98
119
  },
120
+ settings: {
121
+ searchImpl: 'params',
122
+ },
99
123
  type: 'chat',
100
124
  },
101
125
  {
102
126
  abilities: {
103
127
  functionCall: true,
128
+ search: true,
104
129
  },
105
130
  contextWindowTokens: 8000,
106
131
  description:
@@ -114,11 +139,15 @@ const stepfunChatModels: AIChatModelCard[] = [
114
139
  output: 2,
115
140
  },
116
141
  releasedAt: '2025-01-14',
142
+ settings: {
143
+ searchImpl: 'params',
144
+ },
117
145
  type: 'chat',
118
146
  },
119
147
  {
120
148
  abilities: {
121
149
  functionCall: true,
150
+ search: true,
122
151
  },
123
152
  contextWindowTokens: 16_000,
124
153
  description: 'step-2模型的实验版本,包含最新的特性,滚动更新中。不推荐在正式生产环境使用。',
@@ -131,11 +160,15 @@ const stepfunChatModels: AIChatModelCard[] = [
131
160
  output: 120,
132
161
  },
133
162
  releasedAt: '2025-01-15',
163
+ settings: {
164
+ searchImpl: 'params',
165
+ },
134
166
  type: 'chat',
135
167
  },
136
168
  {
137
169
  abilities: {
138
170
  functionCall: true,
171
+ search: true,
139
172
  vision: true,
140
173
  },
141
174
  contextWindowTokens: 8000,
@@ -148,11 +181,15 @@ const stepfunChatModels: AIChatModelCard[] = [
148
181
  input: 5,
149
182
  output: 20,
150
183
  },
184
+ settings: {
185
+ searchImpl: 'params',
186
+ },
151
187
  type: 'chat',
152
188
  },
153
189
  {
154
190
  abilities: {
155
191
  functionCall: true,
192
+ search: true,
156
193
  vision: true,
157
194
  },
158
195
  contextWindowTokens: 32_000,
@@ -164,11 +201,15 @@ const stepfunChatModels: AIChatModelCard[] = [
164
201
  input: 15,
165
202
  output: 70,
166
203
  },
204
+ settings: {
205
+ searchImpl: 'params',
206
+ },
167
207
  type: 'chat',
168
208
  },
169
209
  {
170
210
  abilities: {
171
211
  functionCall: true,
212
+ search: true,
172
213
  vision: true,
173
214
  },
174
215
  contextWindowTokens: 32_000,
@@ -182,6 +223,9 @@ const stepfunChatModels: AIChatModelCard[] = [
182
223
  output: 70,
183
224
  },
184
225
  releasedAt: '2025-01-22',
226
+ settings: {
227
+ searchImpl: 'params',
228
+ },
185
229
  type: 'chat',
186
230
  },
187
231
  {
@@ -20,6 +20,7 @@ const zhipuChatModels: AIChatModelCard[] = [
20
20
  {
21
21
  abilities: {
22
22
  functionCall: true,
23
+ search: true,
23
24
  },
24
25
  contextWindowTokens: 128_000,
25
26
  description: 'GLM-4-Flash 是处理简单任务的理想选择,速度最快且免费。',
@@ -31,11 +32,15 @@ const zhipuChatModels: AIChatModelCard[] = [
31
32
  input: 0,
32
33
  output: 0,
33
34
  },
35
+ settings: {
36
+ searchImpl: 'params',
37
+ },
34
38
  type: 'chat',
35
39
  },
36
40
  {
37
41
  abilities: {
38
42
  functionCall: true,
43
+ search: true,
39
44
  },
40
45
  contextWindowTokens: 128_000,
41
46
  description: 'GLM-4-FlashX 是Flash的增强版本,超快推理速度。',
@@ -47,11 +52,15 @@ const zhipuChatModels: AIChatModelCard[] = [
47
52
  input: 0.1,
48
53
  output: 0.1,
49
54
  },
55
+ settings: {
56
+ searchImpl: 'params',
57
+ },
50
58
  type: 'chat',
51
59
  },
52
60
  {
53
61
  abilities: {
54
62
  functionCall: true,
63
+ search: true,
55
64
  },
56
65
  contextWindowTokens: 1_024_000,
57
66
  description: 'GLM-4-Long 支持超长文本输入,适合记忆型任务与大规模文档处理。',
@@ -62,11 +71,15 @@ const zhipuChatModels: AIChatModelCard[] = [
62
71
  input: 1,
63
72
  output: 1,
64
73
  },
74
+ settings: {
75
+ searchImpl: 'params',
76
+ },
65
77
  type: 'chat',
66
78
  },
67
79
  {
68
80
  abilities: {
69
81
  functionCall: true,
82
+ search: true,
70
83
  },
71
84
  contextWindowTokens: 128_000,
72
85
  description: 'GLM-4-Air 是性价比高的版本,性能接近GLM-4,提供快速度和实惠的价格。',
@@ -78,11 +91,15 @@ const zhipuChatModels: AIChatModelCard[] = [
78
91
  input: 1,
79
92
  output: 1,
80
93
  },
94
+ settings: {
95
+ searchImpl: 'params',
96
+ },
81
97
  type: 'chat',
82
98
  },
83
99
  {
84
100
  abilities: {
85
101
  functionCall: true,
102
+ search: true,
86
103
  },
87
104
  contextWindowTokens: 8192,
88
105
  description: 'GLM-4-AirX 提供 GLM-4-Air 的高效版本,推理速度可达其2.6倍。',
@@ -94,11 +111,15 @@ const zhipuChatModels: AIChatModelCard[] = [
94
111
  input: 10,
95
112
  output: 10,
96
113
  },
114
+ settings: {
115
+ searchImpl: 'params',
116
+ },
97
117
  type: 'chat',
98
118
  },
99
119
  {
100
120
  abilities: {
101
121
  functionCall: true,
122
+ search: true,
102
123
  },
103
124
  contextWindowTokens: 128_000,
104
125
  description:
@@ -110,11 +131,15 @@ const zhipuChatModels: AIChatModelCard[] = [
110
131
  input: 100,
111
132
  output: 100,
112
133
  },
134
+ settings: {
135
+ searchImpl: 'params',
136
+ },
113
137
  type: 'chat',
114
138
  },
115
139
  {
116
140
  abilities: {
117
141
  functionCall: true,
142
+ search: true,
118
143
  },
119
144
  contextWindowTokens: 128_000,
120
145
  description: 'GLM-4-Plus 作为高智能旗舰,具备强大的处理长文本和复杂任务的能力,性能全面提升。',
@@ -126,11 +151,15 @@ const zhipuChatModels: AIChatModelCard[] = [
126
151
  input: 50,
127
152
  output: 50,
128
153
  },
154
+ settings: {
155
+ searchImpl: 'params',
156
+ },
129
157
  type: 'chat',
130
158
  },
131
159
  {
132
160
  abilities: {
133
161
  functionCall: true,
162
+ search: true,
134
163
  },
135
164
  contextWindowTokens: 128_000,
136
165
  description: 'GLM-4-0520 是最新模型版本,专为高度复杂和多样化任务设计,表现卓越。',
@@ -141,11 +170,15 @@ const zhipuChatModels: AIChatModelCard[] = [
141
170
  input: 100,
142
171
  output: 100,
143
172
  },
173
+ settings: {
174
+ searchImpl: 'params',
175
+ },
144
176
  type: 'chat',
145
177
  },
146
178
  {
147
179
  abilities: {
148
180
  functionCall: true,
181
+ search: true,
149
182
  },
150
183
  contextWindowTokens: 128_000,
151
184
  description: 'GLM-4 是发布于2024年1月的旧旗舰版本,目前已被更强的 GLM-4-0520 取代。',
@@ -156,6 +189,9 @@ const zhipuChatModels: AIChatModelCard[] = [
156
189
  input: 100,
157
190
  output: 100,
158
191
  },
192
+ settings: {
193
+ searchImpl: 'params',
194
+ },
159
195
  type: 'chat',
160
196
  },
161
197
  {
@@ -13,13 +13,13 @@ import { ChatMessage } from '@/types/message';
13
13
 
14
14
  import Arguments from './Arguments';
15
15
 
16
- const CustomRender = memo<
17
- ChatMessage & {
18
- requestArgs?: string;
19
- setShowPluginRender: (show: boolean) => void;
20
- showPluginRender: boolean;
21
- }
22
- >(
16
+ interface CustomRenderProps extends ChatMessage {
17
+ requestArgs?: string;
18
+ setShowPluginRender: (value: boolean) => void;
19
+ showPluginRender: boolean;
20
+ }
21
+
22
+ const CustomRender = memo<CustomRenderProps>(
23
23
  ({
24
24
  id,
25
25
  content,
@@ -7,7 +7,6 @@ import { Center, Flexbox } from 'react-layout-kit';
7
7
 
8
8
  import { ProductLogo } from '@/components/Branding';
9
9
 
10
- // @ts-expect-error
11
10
  const MobileSwitchLoading: DynamicOptions['loading'] = memo(() => {
12
11
  const { t } = useTranslation('common');
13
12
  return (
@@ -13,9 +13,22 @@ export const LobeAi360AI = LobeOpenAICompatibleFactory({
13
13
  baseURL: 'https://api.360.cn/v1',
14
14
  chatCompletion: {
15
15
  handlePayload: (payload) => {
16
+ const { enabledSearch, tools, ...rest } = payload;
17
+
18
+ const ai360Tools = enabledSearch ? [
19
+ ...(tools || []),
20
+ {
21
+ type: "web_search",
22
+ web_search: {
23
+ search_mode: "auto",
24
+ },
25
+ }
26
+ ] : tools;
27
+
16
28
  return {
17
- ...payload,
18
- stream: !payload.tools,
29
+ ...rest,
30
+ stream: !ai360Tools,
31
+ tools: ai360Tools,
19
32
  } as any;
20
33
  },
21
34
  },
@@ -1,5 +1,3 @@
1
- import OpenAI from 'openai';
2
-
3
1
  import { ChatStreamPayload, ModelProvider } from '../types';
4
2
  import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
5
3
 
@@ -17,14 +15,26 @@ export const LobeBaichuanAI = LobeOpenAICompatibleFactory({
17
15
  baseURL: 'https://api.baichuan-ai.com/v1',
18
16
  chatCompletion: {
19
17
  handlePayload: (payload: ChatStreamPayload) => {
20
- const { temperature, ...rest } = payload;
18
+ const { enabledSearch, temperature, tools, ...rest } = payload;
19
+
20
+ const baichuanTools = enabledSearch ? [
21
+ ...(tools || []),
22
+ {
23
+ type: "web_search",
24
+ web_search: {
25
+ enable: true,
26
+ search_mode: process.env.BAICHUAN_SEARCH_MODE || "performance_first", // performance_first or quality_first
27
+ },
28
+ }
29
+ ] : tools;
21
30
 
22
31
  return {
23
32
  ...rest,
24
33
  // [baichuan] frequency_penalty must be between 1 and 2.
25
34
  frequency_penalty: undefined,
26
35
  temperature: temperature !== undefined ? temperature / 2 : undefined,
27
- } as OpenAI.ChatCompletionCreateParamsStreaming;
36
+ tools: baichuanTools,
37
+ } as any;
28
38
  },
29
39
  },
30
40
  debug: {
@@ -9,6 +9,24 @@ export interface HunyuanModelCard {
9
9
 
10
10
  export const LobeHunyuanAI = LobeOpenAICompatibleFactory({
11
11
  baseURL: 'https://api.hunyuan.cloud.tencent.com/v1',
12
+ chatCompletion: {
13
+ handlePayload: (payload) => {
14
+ const { enabledSearch, ...rest } = payload;
15
+
16
+ return {
17
+ ...rest,
18
+ ...(enabledSearch && {
19
+ /*
20
+ citation: true,
21
+ enable_multimedia: true,
22
+ search_info: true
23
+ */
24
+ enable_enhancement: true,
25
+ enable_speed_search: process.env.HUNYUAN_ENABLE_SPEED_SEARCH === '1',
26
+ }),
27
+ } as any;
28
+ },
29
+ },
12
30
  debug: {
13
31
  chatCompletion: () => process.env.DEBUG_HUNYUAN_CHAT_COMPLETION === '1',
14
32
  },
@@ -12,23 +12,14 @@ export const LobeMinimaxAI = LobeOpenAICompatibleFactory({
12
12
  baseURL: 'https://api.minimax.chat/v1',
13
13
  chatCompletion: {
14
14
  handlePayload: (payload) => {
15
- const { temperature, top_p, ...params } = payload;
15
+ const { max_tokens, temperature, top_p, ...params } = payload;
16
16
 
17
17
  return {
18
18
  ...params,
19
19
  frequency_penalty: undefined,
20
- max_tokens: payload.max_tokens !== undefined ? payload.max_tokens : getMinimaxMaxOutputs(payload.model),
20
+ max_tokens: max_tokens !== undefined ? max_tokens : getMinimaxMaxOutputs(payload.model),
21
21
  presence_penalty: undefined,
22
- stream: true,
23
22
  temperature: temperature === undefined || temperature <= 0 ? undefined : temperature / 2,
24
- tools: params.tools?.map((tool) => ({
25
- function: {
26
- description: tool.function.description,
27
- name: tool.function.name,
28
- parameters: JSON.stringify(tool.function.parameters),
29
- },
30
- type: 'function',
31
- })),
32
23
  top_p: top_p !== undefined && top_p > 0 && top_p <= 1 ? top_p : undefined,
33
24
  } as any;
34
25
  },
@@ -1,5 +1,3 @@
1
- import OpenAI from 'openai';
2
-
3
1
  import { ChatStreamPayload, ModelProvider } from '../types';
4
2
  import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
5
3
 
@@ -13,12 +11,23 @@ export const LobeMoonshotAI = LobeOpenAICompatibleFactory({
13
11
  baseURL: 'https://api.moonshot.cn/v1',
14
12
  chatCompletion: {
15
13
  handlePayload: (payload: ChatStreamPayload) => {
16
- const { temperature, ...rest } = payload;
14
+ const { enabledSearch, temperature, tools, ...rest } = payload;
15
+
16
+ const moonshotTools = enabledSearch ? [
17
+ ...(tools || []),
18
+ {
19
+ function: {
20
+ name: "$web_search",
21
+ },
22
+ type: "builtin_function",
23
+ }
24
+ ] : tools;
17
25
 
18
26
  return {
19
27
  ...rest,
20
28
  temperature: temperature !== undefined ? temperature / 2 : undefined,
21
- } as OpenAI.ChatCompletionCreateParamsStreaming;
29
+ tools: moonshotTools,
30
+ } as any;
22
31
  },
23
32
  },
24
33
  debug: {
@@ -50,6 +50,10 @@ export const LobeQwenAI = LobeOpenAICompatibleFactory({
50
50
  ...(enabledSearch && {
51
51
  enable_search: enabledSearch,
52
52
  search_options: {
53
+ /*
54
+ enable_citation: true,
55
+ enable_source: true,
56
+ */
53
57
  search_strategy: process.env.QWEN_SEARCH_STRATEGY || 'standard', // standard or pro
54
58
  },
55
59
  }),
@@ -11,9 +11,22 @@ export const LobeStepfunAI = LobeOpenAICompatibleFactory({
11
11
  baseURL: 'https://api.stepfun.com/v1',
12
12
  chatCompletion: {
13
13
  handlePayload: (payload) => {
14
+ const { enabledSearch, tools, ...rest } = payload;
15
+
16
+ const stepfunTools = enabledSearch ? [
17
+ ...(tools || []),
18
+ {
19
+ function: {
20
+ description: "use web_search to search information on the internet",
21
+ },
22
+ type: "web_search",
23
+ }
24
+ ] : tools;
25
+
14
26
  return {
15
- ...payload,
16
- stream: !payload.tools,
27
+ ...rest,
28
+ stream: !stepfunTools,
29
+ tools: stepfunTools,
17
30
  } as any;
18
31
  },
19
32
  },
@@ -1,6 +1,4 @@
1
- import OpenAI from 'openai';
2
-
3
- import { ChatStreamPayload, ModelProvider } from '../types';
1
+ import { ModelProvider } from '../types';
4
2
  import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';
5
3
 
6
4
  import type { ChatModelCard } from '@/types/llm';
@@ -14,9 +12,21 @@ export interface ZhipuModelCard {
14
12
  export const LobeZhipuAI = LobeOpenAICompatibleFactory({
15
13
  baseURL: 'https://open.bigmodel.cn/api/paas/v4',
16
14
  chatCompletion: {
17
- handlePayload: ({ max_tokens, model, temperature, top_p, ...payload }: ChatStreamPayload) =>
18
- ({
19
- ...payload,
15
+ handlePayload: (payload) => {
16
+ const { enabledSearch, max_tokens, model, temperature, tools, top_p, ...rest } = payload;
17
+
18
+ const zhipuTools = enabledSearch ? [
19
+ ...(tools || []),
20
+ {
21
+ type: "web_search",
22
+ web_search: {
23
+ enable: true,
24
+ },
25
+ }
26
+ ] : tools;
27
+
28
+ return {
29
+ ...rest,
20
30
  max_tokens:
21
31
  max_tokens === undefined ? undefined :
22
32
  (model.includes('glm-4v') && Math.min(max_tokens, 1024)) ||
@@ -24,6 +34,7 @@ export const LobeZhipuAI = LobeOpenAICompatibleFactory({
24
34
  max_tokens,
25
35
  model,
26
36
  stream: true,
37
+ tools: zhipuTools,
27
38
  ...(model === 'glm-4-alltools'
28
39
  ? {
29
40
  temperature:
@@ -36,7 +47,8 @@ export const LobeZhipuAI = LobeOpenAICompatibleFactory({
36
47
  temperature: temperature !== undefined ? temperature / 2 : undefined,
37
48
  top_p,
38
49
  }),
39
- }) as OpenAI.ChatCompletionCreateParamsStreaming,
50
+ } as any;
51
+ },
40
52
  },
41
53
  constructorOptions: {
42
54
  defaultHeaders: {
@@ -72,6 +72,20 @@ describe('parseModelString', () => {
72
72
  });
73
73
  });
74
74
 
75
+ it('token and search', () => {
76
+ const result = parseModelString('qwen-max-latest=Qwen Max<32768:search>');
77
+
78
+ expect(result.add[0]).toEqual({
79
+ displayName: 'Qwen Max',
80
+ abilities: {
81
+ search: true,
82
+ },
83
+ id: 'qwen-max-latest',
84
+ contextWindowTokens: 32_768,
85
+ type: 'chat',
86
+ });
87
+ });
88
+
75
89
  it('multi models', () => {
76
90
  const result = parseModelString(
77
91
  'gemini-1.5-flash-latest=Gemini 1.5 Flash<16000:vision>,gpt-4-all=ChatGPT Plus<128000:fc:vision:file>',