@lobehub/chat 1.97.6 → 1.97.7
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 +25 -0
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/config/aiModels/vertexai.ts +14 -0
- package/src/libs/model-runtime/utils/streams/google-ai.test.ts +0 -4
- package/src/libs/model-runtime/utils/streams/google-ai.ts +2 -3
- package/src/libs/model-runtime/utils/streams/vertex-ai.ts +24 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.97.7](https://github.com/lobehub/lobe-chat/compare/v1.97.6...v1.97.7)
|
6
|
+
|
7
|
+
<sup>Released on **2025-07-10**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Add google search grounding for Vertex AI.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Add google search grounding for Vertex AI, closes [#8313](https://github.com/lobehub/lobe-chat/issues/8313) ([afd5900](https://github.com/lobehub/lobe-chat/commit/afd5900))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.97.6](https://github.com/lobehub/lobe-chat/compare/v1.97.5...v1.97.6)
|
6
31
|
|
7
32
|
<sup>Released on **2025-07-10**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.97.
|
3
|
+
"version": "1.97.7",
|
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",
|
@@ -6,6 +6,7 @@ const vertexaiChatModels: AIChatModelCard[] = [
|
|
6
6
|
abilities: {
|
7
7
|
functionCall: true,
|
8
8
|
reasoning: true,
|
9
|
+
search: true,
|
9
10
|
vision: true,
|
10
11
|
},
|
11
12
|
contextWindowTokens: 1_048_576 + 65_536,
|
@@ -20,6 +21,10 @@ const vertexaiChatModels: AIChatModelCard[] = [
|
|
20
21
|
output: 10, // prompts <= 200k tokens
|
21
22
|
},
|
22
23
|
releasedAt: '2025-06-17',
|
24
|
+
settings: {
|
25
|
+
searchImpl: 'params',
|
26
|
+
searchProvider: 'google',
|
27
|
+
},
|
23
28
|
type: 'chat',
|
24
29
|
},
|
25
30
|
{
|
@@ -65,6 +70,7 @@ const vertexaiChatModels: AIChatModelCard[] = [
|
|
65
70
|
abilities: {
|
66
71
|
functionCall: true,
|
67
72
|
reasoning: true,
|
73
|
+
search: true,
|
68
74
|
vision: true,
|
69
75
|
},
|
70
76
|
contextWindowTokens: 1_048_576 + 65_536,
|
@@ -78,6 +84,10 @@ const vertexaiChatModels: AIChatModelCard[] = [
|
|
78
84
|
output: 2.5,
|
79
85
|
},
|
80
86
|
releasedAt: '2025-06-17',
|
87
|
+
settings: {
|
88
|
+
searchImpl: 'params',
|
89
|
+
searchProvider: 'google',
|
90
|
+
},
|
81
91
|
type: 'chat',
|
82
92
|
},
|
83
93
|
{
|
@@ -117,6 +127,10 @@ const vertexaiChatModels: AIChatModelCard[] = [
|
|
117
127
|
output: 0.4,
|
118
128
|
},
|
119
129
|
releasedAt: '2025-06-17',
|
130
|
+
settings: {
|
131
|
+
searchImpl: 'params',
|
132
|
+
searchProvider: 'google',
|
133
|
+
},
|
120
134
|
type: 'chat',
|
121
135
|
},
|
122
136
|
{
|
@@ -86,9 +86,8 @@ const transformGoogleGenerativeAIStream = (
|
|
86
86
|
}
|
87
87
|
|
88
88
|
// return the grounding
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
const { groundingChunks, webSearchQueries } = candidate.groundingMetadata ?? {};
|
90
|
+
if (groundingChunks) {
|
92
91
|
return [
|
93
92
|
{ data: text, id: context.id, type: 'text' },
|
94
93
|
{
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { GenerateContentResponse } from '@google/genai';
|
2
2
|
|
3
3
|
import { ModelTokensUsage } from '@/types/message';
|
4
|
+
import { GroundingSearch } from '@/types/search';
|
4
5
|
import { nanoid } from '@/utils/uuid';
|
5
6
|
|
6
7
|
import { type GoogleAIStreamOptions } from './google-ai';
|
@@ -95,6 +96,29 @@ const transformVertexAIStream = (
|
|
95
96
|
];
|
96
97
|
}
|
97
98
|
|
99
|
+
// return the grounding
|
100
|
+
const { groundingChunks, webSearchQueries } = candidate.groundingMetadata ?? {};
|
101
|
+
if (groundingChunks) {
|
102
|
+
return [
|
103
|
+
!!part?.text ? { data: part.text, id: context?.id, type: 'text' } : undefined,
|
104
|
+
{
|
105
|
+
data: {
|
106
|
+
citations: groundingChunks?.map((chunk) => ({
|
107
|
+
// google 返回的 uri 是经过 google 自己处理过的 url,因此无法展现真实的 favicon
|
108
|
+
// 需要使用 title 作为替换
|
109
|
+
favicon: chunk.web?.title,
|
110
|
+
title: chunk.web?.title,
|
111
|
+
url: chunk.web?.uri,
|
112
|
+
})),
|
113
|
+
searchQueries: webSearchQueries,
|
114
|
+
} as GroundingSearch,
|
115
|
+
id: context.id,
|
116
|
+
type: 'grounding',
|
117
|
+
},
|
118
|
+
...usageChunks,
|
119
|
+
].filter(Boolean) as StreamProtocolChunk[];
|
120
|
+
}
|
121
|
+
|
98
122
|
if (candidate.finishReason) {
|
99
123
|
if (chunk.usageMetadata) {
|
100
124
|
return [
|