Skip to content

Commit 155aac5

Browse files
authored
Merge pull request #78 from ReactiveBayes/fix-gemini-search-widget
Fix Gemini docs search widget: new Vertex AI Search configId
2 parents 0a82752 + dfcb949 commit 155aac5

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

docs/src/assets/chat.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
// In docs/src/assets/chat-widget.js
1+
// "Search with Gemini" widget — Google Vertex AI Search (a.k.a. Agent Search / AI Applications).
2+
//
3+
// How it works: there is NO API key in this repo. The `configId` below points to a search app
4+
// configured in Google Cloud Console -> AI Applications -> (app) -> Integration -> Widget tab.
5+
// That console page controls everything: the indexed data store (a website crawl of the
6+
// RxInfer docs sites), public access authorization, and the domain allowlist (examples.rxinfer.com
7+
// must be allowlisted there or the widget refuses to load).
8+
//
9+
// If this breaks: most likely the GCP project/app behind the configId is gone or its domain
10+
// allowlist changed. Re-create a "Website Content" data store + Search app in AI Applications
11+
// (the app MUST be Enterprise edition - website data stores require it; keep the
12+
// "Advanced LLM features" add-on off), grab the new configId from the Integration page,
13+
// and update it below.
14+
//
15+
// Current setup (June 2026): data store "rxinfer-docs-examples" (website crawl of the
16+
// RxInfer docs sites), Enterprise-edition search app, public access, domain allowlist
17+
// includes examples.rxinfer.com. Shared with the RxInfer.jl docs (same configId there).
218
document.addEventListener('DOMContentLoaded', function() {
319
// Create and append the search widget
4-
const searchWidget = document.createElement('gen-search-widget');
5-
searchWidget.setAttribute('configId', '1bea2ada-cbee-4d63-9154-6e68f77e8aa0');
6-
searchWidget.setAttribute('triggerId', 'searchWidgetTrigger');
7-
document.body.appendChild(searchWidget);
20+
try {
21+
const searchWidget = document.createElement('gen-search-widget');
22+
searchWidget.setAttribute('configId', '25c1f1ae-0f92-4c7c-945d-5aaabdc5c7f1');
23+
searchWidget.setAttribute('triggerId', 'searchWidgetTrigger');
24+
document.body.appendChild(searchWidget);
25+
} catch (e) {
26+
console.warn('Gemini search widget failed to initialize:', e);
27+
}
828

929
// Find the docs search query element
1030
const docsSearchQuery = document.getElementById('documenter-search-query');
@@ -15,7 +35,7 @@ document.addEventListener('DOMContentLoaded', function() {
1535
width: 14.4rem;
1636
`;
1737
aiSearchContainer.classList.add('mx-auto');
18-
38+
1939
// Add "or" text
2040
const orText = document.createElement('div');
2141
orText.textContent = 'or';
@@ -24,23 +44,26 @@ document.addEventListener('DOMContentLoaded', function() {
2444
color: #666;
2545
font-size: 0.9em;
2646
`;
27-
47+
2848
aiSearchContainer.appendChild(orText);
2949

3050
// Create and append the trigger input
3151
const searchTrigger = document.createElement('input');
3252
searchTrigger.setAttribute('placeholder', 'Search with Gemini');
3353
searchTrigger.setAttribute('id', 'searchWidgetTrigger');
3454
searchTrigger.classList.add('docs-search-query','input','is-rounded','is-small','is-clickable','my-2','py-1','px-2');
35-
55+
3656
aiSearchContainer.appendChild(searchTrigger);
3757
docsSearchQuery.parentNode.insertBefore(aiSearchContainer, docsSearchQuery.nextSibling);
3858

39-
59+
4060
}
4161

4262
// Load the Google Gen AI SDK
4363
const script = document.createElement('script');
4464
script.src = 'https://cloud.google.com/ai/gen-app-builder/client?hl=en_US';
65+
script.onerror = function() {
66+
console.warn('Gemini search widget: failed to load the Google Gen App Builder SDK');
67+
};
4568
document.head.appendChild(script);
4669
});

0 commit comments

Comments
 (0)