ag-common 0.0.779 → 0.0.780
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.
|
@@ -136,14 +136,23 @@ const geminiPromptDirect = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
exports.geminiPromptDirect = geminiPromptDirect;
|
|
139
|
-
// if url contains "vertexaisearch.cloud.google.com", follow redirect
|
|
140
139
|
const resolveGroundedUrl = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
-
if (url.includes('vertexaisearch.cloud.google.com')) {
|
|
140
|
+
if (!url.includes('vertexaisearch.cloud.google.com')) {
|
|
141
|
+
(0, log_1.debug)('not a grounded url', url);
|
|
142
|
+
return url;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
(0, log_1.debug)('resolving grounded url', url);
|
|
142
146
|
const response = yield fetch(url);
|
|
143
|
-
const redirectUrl = response.headers.get('Location');
|
|
147
|
+
const redirectUrl = response.headers.get('Location') || response.headers.get('location');
|
|
144
148
|
if (redirectUrl) {
|
|
149
|
+
(0, log_1.debug)('resolved grounded url', url, redirectUrl);
|
|
145
150
|
return redirectUrl;
|
|
146
151
|
}
|
|
152
|
+
(0, log_1.debug)('no redirect found, returning original url', url);
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
(0, log_1.debug)('error resolving grounded url', url, e);
|
|
147
156
|
}
|
|
148
157
|
return url;
|
|
149
158
|
});
|
package/package.json
CHANGED