Skip to content

Commit 8823387

Browse files
committed
Add and enable SEARCH_OR_ASK_AI feature flag for edge environment
1 parent cf6e824 commit 8823387

File tree

6 files changed

+14
-3
lines changed

6 files changed

+14
-3
lines changed

config/assembler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ environments:
2525
enabled: false
2626
feature_flags:
2727
LAZY_LOAD_NAVIGATION: true
28+
SEARCH_OR_ASK_AI: true
2829
dev:
2930
uri: http://localhost:4000
3031
content_source: current

src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public bool DisableGitHubEditLink
3232
set => _featureFlags["disable-github-edit-link"] = value;
3333
}
3434

35+
public bool SearchOrAskAiEnabled
36+
{
37+
get => IsEnabled("search-or-ask-ai");
38+
set => _featureFlags["search-or-ask-ai"] = value;
39+
}
40+
3541
private bool IsEnabled(string key)
3642
{
3743
var envKey = $"FEATURE_{key.ToUpperInvariant().Replace('-', '_')}";

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/AskAi/useLlmGateway.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const useLlmGateway = (props: Props): UseLlmGatewayResponse => {
142142
)
143143

144144
const { sendMessage, abort } = useFetchEventSource<AskAiRequest>({
145-
apiEndpoint: '/_api/v1/ask-ai/stream',
145+
apiEndpoint: '/docs/_api/v1/ask-ai/stream',
146146
onMessage,
147147
onError: (error) => {
148148
setError(error)

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/Search/useSearchQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const useSearchQuery = () => {
2525
queryKey: ['search', { searchTerm: debouncedSearchTerm }],
2626
queryFn: async () => {
2727
const response = await fetch(
28-
'/_api/v1/search?q=' + encodeURIComponent(debouncedSearchTerm)
28+
'/docs/_api/v1/search?q=' + encodeURIComponent(debouncedSearchTerm)
2929
)
3030
if (!response.ok) {
3131
throw new Error(

src/Elastic.Documentation.Site/Layout/_SecondaryNav.cshtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
}
1515
<a href="@Model.Link("/")" class="text-lg leading-[1em] hover:text-blue-elastic active:text-blue-elastic-100">Docs</a>
1616
</div>
17+
@if (Model.Features.SearchOrAskAiEnabled)
18+
{
19+
<search-or-ask-ai></search-or-ask-ai>
20+
}
1721
<ul class="flex gap-6">
1822
<li class="text-nowrap hover:text-blue-elastic active:text-blue-elastic-100">
1923
<a

src/tooling/docs-builder/Http/DocumentationWebHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private void SetUpRoutes()
135135
ServeApiFile(holder, slug, ctx));
136136

137137

138-
var apiV1 = _webApplication.MapGroup("/_api/v1");
138+
var apiV1 = _webApplication.MapGroup("/docs/_api/v1");
139139
apiV1.MapElasticDocsApiEndpoints();
140140

141141
_ = _webApplication.MapGet("{**slug}", (string slug, ReloadableGeneratorState holder, Cancel ctx) =>

0 commit comments

Comments
 (0)