@lobehub/chat 1.118.0 → 1.118.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/.env.example +8 -0
- package/CHANGELOG.md +58 -0
- package/changelog/v1.json +21 -0
- package/locales/ar/chat.json +6 -1
- package/locales/ar/error.json +8 -8
- package/locales/ar/models.json +21 -0
- package/locales/ar/providers.json +3 -0
- package/locales/bg-BG/chat.json +6 -1
- package/locales/bg-BG/error.json +8 -8
- package/locales/bg-BG/models.json +21 -0
- package/locales/bg-BG/providers.json +3 -0
- package/locales/de-DE/chat.json +6 -1
- package/locales/de-DE/error.json +7 -7
- package/locales/de-DE/models.json +21 -0
- package/locales/de-DE/providers.json +3 -0
- package/locales/en-US/chat.json +6 -1
- package/locales/en-US/error.json +4 -4
- package/locales/en-US/models.json +21 -0
- package/locales/en-US/providers.json +3 -0
- package/locales/es-ES/chat.json +6 -1
- package/locales/es-ES/error.json +9 -9
- package/locales/es-ES/models.json +21 -0
- package/locales/es-ES/providers.json +3 -0
- package/locales/fa-IR/chat.json +6 -1
- package/locales/fa-IR/error.json +9 -9
- package/locales/fa-IR/models.json +21 -0
- package/locales/fa-IR/providers.json +3 -0
- package/locales/fr-FR/chat.json +6 -1
- package/locales/fr-FR/error.json +9 -9
- package/locales/fr-FR/models.json +21 -0
- package/locales/fr-FR/providers.json +3 -0
- package/locales/it-IT/chat.json +6 -1
- package/locales/it-IT/error.json +7 -7
- package/locales/it-IT/models.json +21 -0
- package/locales/it-IT/providers.json +3 -0
- package/locales/ja-JP/chat.json +6 -1
- package/locales/ja-JP/error.json +8 -8
- package/locales/ja-JP/models.json +21 -0
- package/locales/ja-JP/providers.json +3 -0
- package/locales/ko-KR/chat.json +6 -1
- package/locales/ko-KR/error.json +8 -8
- package/locales/ko-KR/models.json +21 -0
- package/locales/ko-KR/providers.json +3 -0
- package/locales/nl-NL/chat.json +6 -1
- package/locales/nl-NL/error.json +8 -8
- package/locales/nl-NL/models.json +21 -0
- package/locales/nl-NL/providers.json +3 -0
- package/locales/pl-PL/chat.json +6 -1
- package/locales/pl-PL/error.json +9 -9
- package/locales/pl-PL/models.json +21 -0
- package/locales/pl-PL/providers.json +3 -0
- package/locales/pt-BR/chat.json +6 -1
- package/locales/pt-BR/error.json +8 -8
- package/locales/pt-BR/models.json +21 -0
- package/locales/pt-BR/providers.json +3 -0
- package/locales/ru-RU/chat.json +6 -1
- package/locales/ru-RU/error.json +7 -7
- package/locales/ru-RU/models.json +21 -0
- package/locales/ru-RU/providers.json +3 -0
- package/locales/tr-TR/chat.json +6 -1
- package/locales/tr-TR/error.json +9 -9
- package/locales/tr-TR/models.json +21 -0
- package/locales/tr-TR/providers.json +3 -0
- package/locales/vi-VN/chat.json +6 -1
- package/locales/vi-VN/models.json +21 -0
- package/locales/vi-VN/providers.json +3 -0
- package/locales/zh-CN/chat.json +6 -1
- package/locales/zh-CN/models.json +21 -0
- package/locales/zh-CN/providers.json +3 -0
- package/locales/zh-TW/chat.json +6 -1
- package/locales/zh-TW/error.json +4 -4
- package/locales/zh-TW/models.json +21 -0
- package/locales/zh-TW/providers.json +3 -0
- package/next.config.ts +22 -6
- package/package.json +1 -1
- package/packages/model-runtime/src/google/index.ts +17 -3
- package/packages/model-runtime/src/types/chat.ts +4 -0
- package/packages/model-runtime/src/xai/index.ts +1 -1
- package/packages/types/src/agent/chatConfig.ts +1 -0
- package/packages/types/src/aiModel.ts +2 -1
- package/src/config/aiModels/google.ts +8 -6
- package/src/config/aiModels/xai.ts +25 -0
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +13 -1
- package/src/locales/default/chat.ts +4 -0
- package/src/services/chat.ts +4 -0
@@ -74,6 +74,9 @@
|
|
74
74
|
"DeepSeek-V3": {
|
75
75
|
"description": "DeepSeek-V3 是一款由深度求索公司自研的MoE模型。DeepSeek-V3 多項評測成績超越了 Qwen2.5-72B 和 Llama-3.1-405B 等其他開源模型,並在性能上和世界頂尖的閉源模型 GPT-4o 以及 Claude-3.5-Sonnet 不分伯仲。"
|
76
76
|
},
|
77
|
+
"DeepSeek-V3-1": {
|
78
|
+
"description": "DeepSeek V3.1:下一代推理模型,提升了複雜推理與鏈路思考能力,適合需要深入分析的任務。"
|
79
|
+
},
|
77
80
|
"DeepSeek-V3-Fast": {
|
78
81
|
"description": "模型供應商為:sophnet平台。DeepSeek V3 Fast 是 DeepSeek V3 0324 版本的高TPS極速版,滿血非量化,代碼與數學能力更強,響應更快!"
|
79
82
|
},
|
@@ -170,6 +173,9 @@
|
|
170
173
|
"Llama-3.2-90B-Vision-Instruct\t": {
|
171
174
|
"description": "適用於視覺理解代理應用的高級圖像推理能力。"
|
172
175
|
},
|
176
|
+
"Meta-Llama-3-3-70B-Instruct": {
|
177
|
+
"description": "Llama 3.3 70B:通用性強的 Transformer 模型,適用於對話和生成任務。"
|
178
|
+
},
|
173
179
|
"Meta-Llama-3.1-405B-Instruct": {
|
174
180
|
"description": "Llama 3.1指令調優的文本模型,針對多語言對話用例進行了優化,在許多可用的開源和封閉聊天模型中,在常見行業基準上表現優異。"
|
175
181
|
},
|
@@ -188,6 +194,9 @@
|
|
188
194
|
"Meta-Llama-3.3-70B-Instruct": {
|
189
195
|
"description": "Llama 3.3 是 Llama 系列最先進的多語言開源大型語言模型,以極低成本體驗媲美 405B 模型的性能。基於 Transformer 結構,並透過監督微調(SFT)和人類反饋強化學習(RLHF)提升有用性和安全性。其指令調優版本專為多語言對話優化,在多項行業基準上表現優於眾多開源和封閉聊天模型。知識截止日期為 2023 年 12 月"
|
190
196
|
},
|
197
|
+
"Meta-Llama-4-Maverick-17B-128E-Instruct-FP8": {
|
198
|
+
"description": "Llama 4 Maverick:基於 Mixture-of-Experts 的大規模模型,提供高效的專家啟動策略以在推理中表現優異。"
|
199
|
+
},
|
191
200
|
"MiniMax-M1": {
|
192
201
|
"description": "全新自研推理模型。全球領先:80K思維鏈 x 1M輸入,效果比肩海外頂尖模型。"
|
193
202
|
},
|
@@ -377,6 +386,9 @@
|
|
377
386
|
"Qwen3-235B": {
|
378
387
|
"description": "Qwen3-235B-A22B,MoE(混合專家模型)模型,引入了「混合推理模式」,支援用戶在「思考模式」和「非思考模式」之間無縫切換,支援119種語言和方言理解與推理,並具備強大的工具調用能力,在綜合能力、程式碼與數學、多語言能力、知識與推理等多項基準測試中,都能與DeepSeek R1、OpenAI o1、o3-mini、Grok 3和谷歌Gemini 2.5 Pro等目前市場上的主流大型模型競爭。"
|
379
388
|
},
|
389
|
+
"Qwen3-235B-A22B-Instruct-2507-FP8": {
|
390
|
+
"description": "Qwen3 235B A22B Instruct 2507:面向高級推理與對話指令優化的模型,混合專家架構以在大規模參數下保持推理效率。"
|
391
|
+
},
|
380
392
|
"Qwen3-32B": {
|
381
393
|
"description": "Qwen3-32B,稠密模型(Dense Model),引入了「混合推理模式」,支援用戶在「思考模式」和「非思考模式」之間無縫切換,由於模型架構改進、訓練資料增加以及更有效的訓練方法,整體性能與Qwen2.5-72B表現相當。"
|
382
394
|
},
|
@@ -1364,6 +1376,12 @@
|
|
1364
1376
|
"google/gemini-2.5-flash": {
|
1365
1377
|
"description": "Gemini 2.5 Flash 是 Google 最先進的主力模型,專為高階推理、編碼、數學和科學任務而設計。它包含內建的「思考」能力,使其能夠提供具有更高準確性和細緻上下文處理的回應。\n\n注意:此模型有兩個變體:思考和非思考。輸出定價根據思考能力是否啟用而有顯著差異。如果您選擇標準變體(不帶「:thinking」後綴),模型將明確避免生成思考令牌。\n\n要利用思考能力並接收思考令牌,您必須選擇「:thinking」變體,這將產生較高的思考輸出定價。\n\n此外,Gemini 2.5 Flash 可透過「推理最大令牌數」參數進行配置,如文件中所述 (https://openrouter.ai/docs/use-cases/reasoning-tokens#max-tokens-for-reasoning)。"
|
1366
1378
|
},
|
1379
|
+
"google/gemini-2.5-flash-image-preview": {
|
1380
|
+
"description": "Gemini 2.5 Flash 實驗模型,支援圖像生成"
|
1381
|
+
},
|
1382
|
+
"google/gemini-2.5-flash-image-preview:free": {
|
1383
|
+
"description": "Gemini 2.5 Flash 實驗模型,支援圖像生成"
|
1384
|
+
},
|
1367
1385
|
"google/gemini-2.5-flash-preview": {
|
1368
1386
|
"description": "Gemini 2.5 Flash 是 Google 最先進的主力模型,專為高級推理、編碼、數學和科學任務而設計。它包含內建的「思考」能力,使其能夠提供具有更高準確性和細緻上下文處理的回應。\n\n注意:此模型有兩個變體:思考和非思考。輸出定價根據思考能力是否啟用而有顯著差異。如果您選擇標準變體(不帶「:thinking」後綴),模型將明確避免生成思考令牌。\n\n要利用思考能力並接收思考令牌,您必須選擇「:thinking」變體,這將產生更高的思考輸出定價。\n\n此外,Gemini 2.5 Flash 可通過「推理最大令牌數」參數進行配置,如文檔中所述 (https://openrouter.ai/docs/use-cases/reasoning-tokens#max-tokens-for-reasoning)。"
|
1369
1387
|
},
|
@@ -1533,6 +1551,9 @@
|
|
1533
1551
|
"gpt-oss": {
|
1534
1552
|
"description": "GPT-OSS 20B 是 OpenAI 發布的開源大型語言模型,採用 MXFP4 量化技術,適合在高端消費級 GPU 或 Apple Silicon Mac 上運行。該模型在對話生成、程式碼撰寫和推理任務方面表現出色,支援函數呼叫和工具使用。"
|
1535
1553
|
},
|
1554
|
+
"gpt-oss-120b": {
|
1555
|
+
"description": "GPT-OSS-120B MXFP4 量化的 Transformer 結構,在資源受限時仍能保持強勁性能。"
|
1556
|
+
},
|
1536
1557
|
"gpt-oss:120b": {
|
1537
1558
|
"description": "GPT-OSS 120B 是 OpenAI 發布的大型開源語言模型,採用 MXFP4 量化技術,為旗艦級模型。需要多 GPU 或高效能工作站環境運行,在複雜推理、程式碼生成和多語言處理方面具備卓越性能,支援高級函數呼叫和工具整合。"
|
1538
1559
|
},
|
@@ -11,6 +11,9 @@
|
|
11
11
|
"aihubmix": {
|
12
12
|
"description": "AiHubMix 透過統一的 API 介面提供對多種 AI 模型的存取。"
|
13
13
|
},
|
14
|
+
"akashchat": {
|
15
|
+
"description": "Akash 是一個無需許可的雲端資源市場,與傳統雲端供應商相比,其定價具有競爭力。"
|
16
|
+
},
|
14
17
|
"anthropic": {
|
15
18
|
"description": "Anthropic 是一家專注於人工智慧研究和開發的公司,提供了一系列先進的語言模型,如 Claude 3.5 Sonnet、Claude 3 Sonnet、Claude 3 Opus 和 Claude 3 Haiku。這些模型在智能、速度和成本之間取得了理想的平衡,適用於從企業級工作負載到快速響應的各種應用場景。Claude 3.5 Sonnet 作為其最新模型,在多項評估中表現優異,同時保持了較高的性價比。"
|
16
19
|
},
|
package/next.config.ts
CHANGED
@@ -9,6 +9,7 @@ const buildWithDocker = process.env.DOCKER === 'true';
|
|
9
9
|
const isDesktop = process.env.NEXT_PUBLIC_IS_DESKTOP_APP === '1';
|
10
10
|
const enableReactScan = !!process.env.REACT_SCAN_MONITOR_API_KEY;
|
11
11
|
const isUsePglite = process.env.NEXT_PUBLIC_CLIENT_DB === 'pglite';
|
12
|
+
const shouldUseCSP = process.env.ENABLED_CSP === '1';
|
12
13
|
|
13
14
|
// if you need to proxy the api endpoint to remote server
|
14
15
|
|
@@ -41,14 +42,29 @@ const nextConfig: NextConfig = {
|
|
41
42
|
webVitalsAttribution: ['CLS', 'LCP'],
|
42
43
|
},
|
43
44
|
async headers() {
|
45
|
+
const securityHeaders = [
|
46
|
+
{
|
47
|
+
key: 'x-robots-tag',
|
48
|
+
value: 'all',
|
49
|
+
},
|
50
|
+
];
|
51
|
+
|
52
|
+
if (shouldUseCSP) {
|
53
|
+
securityHeaders.push(
|
54
|
+
{
|
55
|
+
key: 'X-Frame-Options',
|
56
|
+
value: 'DENY',
|
57
|
+
},
|
58
|
+
{
|
59
|
+
key: 'Content-Security-Policy',
|
60
|
+
value: "frame-ancestors 'none';",
|
61
|
+
},
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
44
65
|
return [
|
45
66
|
{
|
46
|
-
headers:
|
47
|
-
{
|
48
|
-
key: 'x-robots-tag',
|
49
|
-
value: 'all',
|
50
|
-
},
|
51
|
-
],
|
67
|
+
headers: securityHeaders,
|
52
68
|
source: '/:path*',
|
53
69
|
},
|
54
70
|
{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.118.
|
3
|
+
"version": "1.118.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",
|
@@ -484,14 +484,28 @@ export class LobeGoogleAI implements LobeRuntimeAI {
|
|
484
484
|
tools: ChatCompletionTool[] | undefined,
|
485
485
|
payload?: ChatStreamPayload,
|
486
486
|
): GoogleFunctionCallTool[] | undefined {
|
487
|
-
|
488
|
-
|
487
|
+
const hasToolCalls = payload?.messages?.some((m) => m.tool_calls?.length);
|
488
|
+
const hasSearch = payload?.enabledSearch;
|
489
|
+
const hasUrlContext = payload?.urlContext;
|
490
|
+
const hasFunctionTools = tools && tools.length > 0;
|
491
|
+
|
492
|
+
// 如果已经有 tool_calls,优先处理 function declarations
|
493
|
+
if (hasToolCalls && hasFunctionTools) {
|
489
494
|
return this.buildFunctionDeclarations(tools);
|
490
495
|
}
|
491
|
-
|
496
|
+
|
497
|
+
// 构建并返回搜索相关工具(搜索工具不能与 FunctionCall 同时使用)
|
498
|
+
if (hasUrlContext && hasSearch) {
|
499
|
+
return [{ urlContext: {} }, { googleSearch: {} }];
|
500
|
+
}
|
501
|
+
if (hasUrlContext) {
|
502
|
+
return [{ urlContext: {} }];
|
503
|
+
}
|
504
|
+
if (hasSearch) {
|
492
505
|
return [{ googleSearch: {} }];
|
493
506
|
}
|
494
507
|
|
508
|
+
// 最后考虑 function declarations
|
495
509
|
return this.buildFunctionDeclarations(tools);
|
496
510
|
}
|
497
511
|
|
@@ -6,7 +6,7 @@ export interface XAIModelCard {
|
|
6
6
|
id: string;
|
7
7
|
}
|
8
8
|
|
9
|
-
export const GrokReasoningModels = new Set(['grok-3-mini', 'grok-4']);
|
9
|
+
export const GrokReasoningModels = new Set(['grok-3-mini', 'grok-4', 'grok-code']);
|
10
10
|
|
11
11
|
export const isGrokReasoningModel = (model: string) =>
|
12
12
|
Array.from(GrokReasoningModels).some((id) => model.includes(id));
|
@@ -42,7 +42,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
42
42
|
},
|
43
43
|
releasedAt: '2025-06-17',
|
44
44
|
settings: {
|
45
|
-
extendParams: ['thinkingBudget'],
|
45
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
46
46
|
searchImpl: 'params',
|
47
47
|
searchProvider: 'google',
|
48
48
|
},
|
@@ -86,7 +86,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
86
86
|
},
|
87
87
|
releasedAt: '2025-06-05',
|
88
88
|
settings: {
|
89
|
-
extendParams: ['thinkingBudget'],
|
89
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
90
90
|
searchImpl: 'params',
|
91
91
|
searchProvider: 'google',
|
92
92
|
},
|
@@ -157,7 +157,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
157
157
|
},
|
158
158
|
releasedAt: '2025-06-17',
|
159
159
|
settings: {
|
160
|
-
extendParams: ['thinkingBudget'],
|
160
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
161
161
|
searchImpl: 'params',
|
162
162
|
searchProvider: 'google',
|
163
163
|
},
|
@@ -184,7 +184,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
184
184
|
},
|
185
185
|
releasedAt: '2025-05-20',
|
186
186
|
settings: {
|
187
|
-
extendParams: ['thinkingBudget'],
|
187
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
188
188
|
searchImpl: 'params',
|
189
189
|
searchProvider: 'google',
|
190
190
|
},
|
@@ -233,7 +233,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
233
233
|
},
|
234
234
|
releasedAt: '2025-07-22',
|
235
235
|
settings: {
|
236
|
-
extendParams: ['thinkingBudget'],
|
236
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
237
237
|
searchImpl: 'params',
|
238
238
|
searchProvider: 'google',
|
239
239
|
},
|
@@ -261,7 +261,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
261
261
|
},
|
262
262
|
releasedAt: '2025-06-11',
|
263
263
|
settings: {
|
264
|
-
extendParams: ['thinkingBudget'],
|
264
|
+
extendParams: ['thinkingBudget', 'urlContext'],
|
265
265
|
searchImpl: 'params',
|
266
266
|
searchProvider: 'google',
|
267
267
|
},
|
@@ -288,6 +288,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
288
288
|
},
|
289
289
|
releasedAt: '2025-02-05',
|
290
290
|
settings: {
|
291
|
+
extendParams: ['urlContext'],
|
291
292
|
searchImpl: 'params',
|
292
293
|
searchProvider: 'google',
|
293
294
|
},
|
@@ -314,6 +315,7 @@ const googleChatModels: AIChatModelCard[] = [
|
|
314
315
|
},
|
315
316
|
releasedAt: '2025-02-05',
|
316
317
|
settings: {
|
318
|
+
extendParams: ['urlContext'],
|
317
319
|
searchImpl: 'params',
|
318
320
|
searchProvider: 'google',
|
319
321
|
},
|
@@ -2,6 +2,31 @@ import { AIChatModelCard, AIImageModelCard } from '@/types/aiModel';
|
|
2
2
|
|
3
3
|
// https://docs.x.ai/docs/models
|
4
4
|
const xaiChatModels: AIChatModelCard[] = [
|
5
|
+
{
|
6
|
+
abilities: {
|
7
|
+
functionCall: true,
|
8
|
+
reasoning: true,
|
9
|
+
},
|
10
|
+
contextWindowTokens: 256_000,
|
11
|
+
description:
|
12
|
+
'我们很高兴推出 grok-code-fast-1,这是一款快速且经济高效的推理模型,在代理编码方面表现出色。',
|
13
|
+
displayName: 'Grok Code Fast 1',
|
14
|
+
enabled: true,
|
15
|
+
id: 'grok-code-fast-1',
|
16
|
+
pricing: {
|
17
|
+
units: [
|
18
|
+
{ name: 'textInput_cacheRead', rate: 0.02, strategy: 'fixed', unit: 'millionTokens' },
|
19
|
+
{ name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
|
20
|
+
{ name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
|
21
|
+
],
|
22
|
+
},
|
23
|
+
releasedAt: '2025-08-28',
|
24
|
+
// settings: {
|
25
|
+
// reasoning_effort is not supported by grok-code. Specifying reasoning_effort parameter will get an error response.
|
26
|
+
// extendParams: ['reasoningEffort'],
|
27
|
+
// },
|
28
|
+
type: 'chat',
|
29
|
+
},
|
5
30
|
{
|
6
31
|
abilities: {
|
7
32
|
functionCall: true,
|
@@ -123,13 +123,25 @@ const ControlsForm = memo(() => {
|
|
123
123
|
children: <ThinkingBudgetSlider />,
|
124
124
|
label: t('extendParams.reasoningBudgetToken.title'),
|
125
125
|
layout: 'vertical',
|
126
|
-
minWidth:
|
126
|
+
minWidth: 470,
|
127
127
|
name: 'thinkingBudget',
|
128
128
|
style: {
|
129
129
|
paddingBottom: 0,
|
130
130
|
},
|
131
131
|
tag: 'thinkingBudget',
|
132
132
|
},
|
133
|
+
{
|
134
|
+
children: <Switch />,
|
135
|
+
desc: t('extendParams.urlContext.desc'),
|
136
|
+
label: t('extendParams.urlContext.title'),
|
137
|
+
layout: 'horizontal',
|
138
|
+
minWidth: undefined,
|
139
|
+
name: 'urlContext',
|
140
|
+
style: {
|
141
|
+
width: 445,
|
142
|
+
},
|
143
|
+
tag: 'urlContext',
|
144
|
+
},
|
133
145
|
{
|
134
146
|
children: <ThinkingSlider />,
|
135
147
|
label: t('extendParams.thinking.title'),
|
package/src/services/chat.ts
CHANGED
@@ -297,6 +297,10 @@ class ChatService {
|
|
297
297
|
) {
|
298
298
|
extendParams.thinkingBudget = chatConfig.thinkingBudget;
|
299
299
|
}
|
300
|
+
|
301
|
+
if (modelExtendParams!.includes('urlContext') && chatConfig.urlContext) {
|
302
|
+
extendParams.urlContext = chatConfig.urlContext;
|
303
|
+
}
|
300
304
|
}
|
301
305
|
|
302
306
|
return this.getChatCompletion(
|