@@ -199,36 +199,121 @@ Add translations of the modal UI for your language using Starlight’s built-in
199199
200200 ``` json title="src/content/i18n/en.json"
201201 {
202- "docsearch.searchBox.resetButtonTitle" : " Clear the query" ,
203- "docsearch.searchBox.resetButtonAriaLabel" : " Clear the query" ,
204- "docsearch.searchBox.cancelButtonText" : " Cancel" ,
205- "docsearch.searchBox.cancelButtonAriaLabel" : " Cancel" ,
202+ "docsearch.searchBox.clearButtonTitle" : " Clear the query" ,
203+ "docsearch.searchBox.clearButtonAriaLabel" : " Clear the query" ,
204+ "docsearch.searchBox.closeButtonText" : " Close" ,
205+ "docsearch.searchBox.closeButtonAriaLabel" : " Close" ,
206+ "docsearch.searchBox.placeholderText" : " Search docs" ,
207+ "docsearch.searchBox.placeholderTextAskAi" : " Ask AI: " ,
208+ "docsearch.searchBox.placeholderTextAskAiStreaming" : " Answering…" ,
206209 "docsearch.searchBox.searchInputLabel" : " Search" ,
210+ "docsearch.searchBox.backToKeywordSearchButtonText" : " Back to keyword search" ,
211+ "docsearch.searchBox.backToKeywordSearchButtonAriaLabel" : " Back to keyword search" ,
207212
208213 "docsearch.startScreen.recentSearchesTitle" : " Recent" ,
209214 "docsearch.startScreen.noRecentSearchesText" : " No recent searches" ,
210215 "docsearch.startScreen.saveRecentSearchButtonTitle" : " Save this search" ,
211216 "docsearch.startScreen.removeRecentSearchButtonTitle" : " Remove this search from history" ,
212217 "docsearch.startScreen.favoriteSearchesTitle" : " Favorite" ,
213218 "docsearch.startScreen.removeFavoriteSearchButtonTitle" : " Remove this search from favorites" ,
219+ "docsearch.startScreen.recentConversationsTitle" : " Recent conversations" ,
220+ "docsearch.startScreen.removeRecentConversationButtonTitle" : " Remove this conversation from history" ,
214221
215222 "docsearch.errorScreen.titleText" : " Unable to fetch results" ,
216223 "docsearch.errorScreen.helpText" : " You might want to check your network connection." ,
217224
218225 "docsearch.footer.selectText" : " to select" ,
226+ "docsearch.footer.submitQuestionText" : " Submit question" ,
219227 "docsearch.footer.selectKeyAriaLabel" : " Enter key" ,
220228 "docsearch.footer.navigateText" : " to navigate" ,
221229 "docsearch.footer.navigateUpKeyAriaLabel" : " Arrow up" ,
222230 "docsearch.footer.navigateDownKeyAriaLabel" : " Arrow down" ,
223231 "docsearch.footer.closeText" : " to close" ,
232+ "docsearch.footer.backToSearchText" : " Back to search" ,
224233 "docsearch.footer.closeKeyAriaLabel" : " Escape key" ,
225- "docsearch.footer.searchByText " : " Search by" ,
234+ "docsearch.footer.poweredByText " : " Search by" ,
226235
227236 "docsearch.noResultsScreen.noResultsText" : " No results for" ,
228237 "docsearch.noResultsScreen.suggestedQueryText" : " Try searching for" ,
229238 "docsearch.noResultsScreen.reportMissingResultsText" : " Believe this query should return results?" ,
230- "docsearch.noResultsScreen.reportMissingResultsLinkText" : " Let us know."
239+ "docsearch.noResultsScreen.reportMissingResultsLinkText" : " Let us know." ,
240+
241+ "docsearch.resultsScreen.askAiPlaceholder" : " Ask AI: " ,
242+
243+ "docsearch.askAiScreen.disclaimerText" : " Answers are generated by AI and may be inaccurate." ,
244+ "docsearch.askAiScreen.relatedSourcesText" : " Related sources" ,
245+ "docsearch.askAiScreen.thinkingText" : " Thinking…" ,
246+ "docsearch.askAiScreen.copyButtonText" : " Copy" ,
247+ "docsearch.askAiScreen.copyButtonCopiedText" : " Copied!" ,
248+ "docsearch.askAiScreen.copyButtonTitle" : " Copy" ,
249+ "docsearch.askAiScreen.likeButtonTitle" : " Like" ,
250+ "docsearch.askAiScreen.dislikeButtonTitle" : " Dislike" ,
251+ "docsearch.askAiScreen.thanksForFeedbackText" : " Thanks for your feedback!" ,
252+ "docsearch.askAiScreen.preToolCallText" : " Searching…" ,
253+ "docsearch.askAiScreen.duringToolCallText" : " Searching " ,
254+ "docsearch.askAiScreen.afterToolCallText" : " Searched" ,
255+ "docsearch.askAiScreen.aggregatedToolCallText" : " Searched"
231256 }
232257 ```
233258
234259</Steps >
260+
261+ ### Algolia Ask  ; AI
262+
263+ DocSearch v4 introduces an optional ** Ask AI** conversational experience. To enable it, pass the ` askAi ` option to the Starlight DocSearch plugin — either as a plain string (your ** assistant ID** ) or as an object with overrides:
264+
265+ ``` ts title="astro.config.mjs" ins={15-20}
266+ import { defineConfig } from ' astro/config' ;
267+ import starlight from ' @astrojs/starlight' ;
268+ import starlightDocSearch from ' @astrojs/starlight-docsearch' ;
269+
270+ export default defineConfig ({
271+ integrations: [
272+ starlight ({
273+ plugins: [
274+ starlightDocSearch ({
275+ appId: ' YOUR_APP_ID' ,
276+ apiKey: ' YOUR_SEARCH_API_KEY' ,
277+ indexName: ' YOUR_INDEX_NAME' ,
278+ // simplest form — just the assistant ID
279+ // askAi: 'YOUR_ASSISTANT_ID',
280+
281+ // or full form with per-assistant overrides
282+ askAi: {
283+ assistantId: ' YOUR_ASSISTANT_ID' ,
284+ // apiKey, appId & indexName default to the top-level values
285+ // but can be overridden individually if needed
286+ // apiKey: '...',
287+ // appId: '...',
288+ // indexName: '...',
289+ },
290+ }),
291+ ],
292+ }),
293+ ],
294+ });
295+ ```
296+
297+ If you want to stick with keyword search only, simply omit the ` askAi ` property.
298+
299+ #### Translating the Ask AI UI
300+
301+ Ask AI adds a few extra UI texts. Add them to your ` i18n ` JSON alongside the earlier DocSearch strings:
302+
303+ ``` json title="src/content/i18n/en.json"{8}
304+ {
305+ // …previous DocSearch strings…
306+ "docsearch.resultsScreen.askAiPlaceholder" : " Ask AI: " ,
307+ "docsearch.searchBox.placeholderTextAskAi" : " Ask AI: " ,
308+ "docsearch.askAiScreen.disclaimerText" : " Answers are generated by AI and may be inaccurate." ,
309+ "docsearch.askAiScreen.relatedSourcesText" : " Related sources" ,
310+ "docsearch.askAiScreen.thinkingText" : " Thinking…" ,
311+ "docsearch.askAiScreen.copyButtonText" : " Copy" ,
312+ "docsearch.askAiScreen.copyButtonCopiedText" : " Copied!" ,
313+ "docsearch.askAiScreen.thanksForFeedbackText" : " Thanks for your feedback!" ,
314+ "docsearch.footer.submitQuestionText" : " Submit question" ,
315+ "docsearch.footer.backToSearchText" : " Back to search"
316+ }
317+ ```
318+
319+ See the [ Ask AI documentation] ( https://docsearch.algolia.com/docs/v4/askai ) for full details.
0 commit comments