You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(search): upgrade search to DocSearch v4-beta (#4843)
BREAKING CHANGE: Uses DocSearch v4 beta. No change is required if you're not customizing the styles of navbar search button or modal. DocSearch AI features are in private beta, you can apply for them at https://forms.gle/iyfb5pC2CiiwszUKA
---------
Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/en/guide/getting-started.md
-16Lines changed: 0 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,22 +39,6 @@ $ bun add -D vitepress
39
39
40
40
:::
41
41
42
-
::: details Getting missing peer deps warnings?
43
-
If using PNPM, you will notice a missing peer warning for `@docsearch/js`. This does not prevent VitePress from working. If you wish to suppress this warning, add the following to your `package.json`:
44
-
45
-
```json
46
-
"pnpm": {
47
-
"peerDependencyRules": {
48
-
"ignoreMissing": [
49
-
"@algolia/client-search",
50
-
"search-insights"
51
-
]
52
-
}
53
-
}
54
-
```
55
-
56
-
:::
57
-
58
42
::: tip NOTE
59
43
60
44
VitePress is an ESM-only package. Don't use `require()` to import it, and make sure your nearest `package.json` contains `"type": "module"`, or change the file extension of your relevant files like `.vitepress/config.js` to `.mjs`/`.mts`. Refer to [Vite's troubleshooting guide](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) for more details. Also, inside async CJS contexts, you can use `await import('vitepress')` instead.
[These options](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) can be overridden. Refer official Algolia docs to learn more about them.
276
307
308
+
### Algolia Ask AI Support {#ask-ai}
309
+
310
+
If you would like to include **Ask AI**, pass the `askAi` option (or any of the partial fields) inside `options`:
311
+
312
+
```ts
313
+
import { defineConfig } from'vitepress'
314
+
315
+
exportdefaultdefineConfig({
316
+
themeConfig: {
317
+
search: {
318
+
provider: 'algolia',
319
+
options: {
320
+
appId: '...',
321
+
apiKey: '...',
322
+
indexName: '...',
323
+
// askAi: "YOUR-ASSISTANT-ID"
324
+
// OR
325
+
askAi: {
326
+
// at minimum you must provide the assistantId you received from Algolia
327
+
assistantId: 'XXXYYY',
328
+
// optional overrides – if omitted, the top-level appId/apiKey/indexName values are reused
329
+
// apiKey: '...',
330
+
// appId: '...',
331
+
// indexName: '...'
332
+
}
333
+
}
334
+
}
335
+
}
336
+
})
337
+
```
338
+
339
+
::: warning Note
340
+
If want to default to keyword search and do not want to use Ask AI, just omit the `askAi` property
341
+
:::
342
+
343
+
The translations for the Ask AI UI live under `options.translations.modal.askAiScreen` and `options.translations.resultsScreen` — see the [type definitions](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) for all keys.
344
+
277
345
### Crawler Config
278
346
279
347
Here is an example config based on what this site uses:
Copy file name to clipboardExpand all lines: docs/es/guide/getting-started.md
-16Lines changed: 0 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,22 +35,6 @@ $ bun add -D vitepress
35
35
36
36
:::
37
37
38
-
::: details Recibiendo avisos sobre dependencias ausentes?
39
-
Si usa PNPM, percibirá un aviso de ausencia de `@docsearch/js`. Esto no evita que VitePress funcione. Si desea eliminar este aviso, adicione lo siguiente en su `package.json`:
40
-
41
-
```json
42
-
"pnpm": {
43
-
"peerDependencyRules": {
44
-
"ignoreMissing": [
45
-
"@algolia/client-search",
46
-
"search-insights"
47
-
]
48
-
}
49
-
}
50
-
```
51
-
52
-
:::
53
-
54
38
::: tip NOTA
55
39
56
40
VitePress es un paquete apenas para ESM. No use `require()` para importarlo, y asegurese de que el `package.json` más cercano contiene `"type": "module"`, o cambie la extensión de archivo de sus archivos relevantes como `.vitepress/config.js` a `.mjs`/`.mts`. Consulte la [Guía de resolución de problemas Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) para más detalles. Además de eso, dentro de contextos de JavaScript asíncronos, puede usar `await import('vitepress')`.
Si deseas incluir **Ask AI**, pasa la opción `askAi` (o alguno de sus campos parciales) dentro de `options`:
293
+
294
+
```ts
295
+
options: {
296
+
appId: '...',
297
+
apiKey: '...',
298
+
indexName: '...',
299
+
// askAi: 'TU-ASSISTANT-ID'
300
+
askAi: {
301
+
assistantId: 'XXXYYY'
302
+
}
303
+
}
304
+
```
305
+
306
+
::: warning Nota
307
+
Si prefieres solo la búsqueda por palabra clave y no la Ask AI, simplemente omite `askAi`.
308
+
:::
309
+
264
310
[Estas opciones](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts) se pueden superponer. Consulte la documentación oficial de Algolia para obtener más información sobre ellos.
0 commit comments