diff --git a/assistant/widget.mdx b/assistant/widget.mdx index 905d59213..b352afbc2 100644 --- a/assistant/widget.mdx +++ b/assistant/widget.mdx @@ -132,6 +132,35 @@ Changing `identity` starts a new conversation. Changing the widget ID or API end You can supply `supportEmail` and `starterQuestions` during initialization and change them later with `update()`. These values apply to the current embed and do not inherit from your Mintlify dashboard. +## Scope retrieval by language or version + +Use `filter` to restrict what the assistant retrieves when your docs are organized by language or [versions](/organize/navigation#versions). Omit a field to search across every value for it. + +```js +await window.MintlifyAssistant.init({ + id: "YOUR_WIDGET_ID", + filter: { + language: "en", + version: "v2", + }, +}); +``` + +`language` must be a [supported language code](/organize/settings-reference#navigation-global-languages), such as `en`, `es`, `fr`, or `zh-Hans`. `version` matches the version name configured in your dashboard. + +Change filters at runtime with `update()` when the visitor switches language or version in your application: + +```js +await window.MintlifyAssistant.update({ + filter: { + language: "fr", + version: null, + }, +}); +``` + +Pass `null` on a field to clear that filter, or `filter: null` to clear both. + ## Configuration reference ### `AssistantConfig` @@ -149,6 +178,7 @@ Pass this object to `init()`. | `labels` | [`AssistantLabels`](#assistantlabels) | Customer-facing text overrides. | | `supportEmail` | string | Sets the support address shown in the widget toolbar for this embed. | | `starterQuestions` | string[] | Sets up to three empty-state prompts for this embed. | +| `filter` | [`AssistantFilter`](#assistantfilter) | Restricts retrieval to a docs language and version. | | `hooks` | [`AssistantHooks`](#assistanthooks) | Event and error observers. | ### `AssistantAppearance` @@ -168,6 +198,13 @@ Pass this object to `init()`. Arbitrary CSS and neutral-palette overrides are not supported. The closed Shadow DOM protects both your application and the widget from cross-site style regressions. +### `AssistantFilter` + +| Option | Type | Description | +| ---------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `language` | string or `null` | Restricts retrieval to a [supported language code](/organize/settings-reference#navigation-global-languages), such as `en`. Omit to search all languages. | +| `version` | string or `null` | Restricts retrieval to a docs version, such as `v2`. Omit to search all versions. | + ### `AssistantLabels` | Option | Values | Description | @@ -225,6 +262,7 @@ Pass this object to `update()`. Every field is optional, and `null` restores its | `labels` | [`AssistantLabels`](#assistantlabels) or `null` | Deep-patches customer-facing text. | | `supportEmail` | string or `null` | Changes the support address. Pass `null` to remove it. | | `starterQuestions` | string[] or `null` | Changes up to three prompts. Pass `null` to restore an empty list. | +| `filter` | [`AssistantFilter`](#assistantfilter) or `null` | Deep-patches retrieval filters. Pass `null` to clear all filters. | | `hooks` | [`AssistantHooks`](#assistanthooks) or `null` | Deep-patches event and error observers. | ## Browser API diff --git a/es/assistant/widget.mdx b/es/assistant/widget.mdx index fb090eaa3..180b68ba5 100644 --- a/es/assistant/widget.mdx +++ b/es/assistant/widget.mdx @@ -144,6 +144,37 @@ Cambiar `identity` inicia una nueva conversación. Cambiar el ID del widget o el Puedes proporcionar `supportEmail` y `starterQuestions` durante la inicialización y cambiarlos más tarde con `update()`. Estos valores se aplican al embed actual y no se heredan desde tu panel de Mintlify. +