@lobehub/chat 1.118.0 → 1.118.1
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 +33 -0
- package/changelog/v1.json +12 -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/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/features/ChatInput/ActionBar/Model/ControlsForm.tsx +13 -1
- package/src/locales/default/chat.ts +4 -0
- package/src/services/chat.ts +4 -0
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.1",
|
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
|
|
@@ -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
|
},
|
@@ -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(
|