valaxy-addon-algolia
English | 简体中文
Add Algolia DocSearch to a Valaxy site.
[!NOTE] The addon currently supports DocSearch. Algolia generally approves DocSearch applications for technical documentation sites.
Installation
pnpm add -D valaxy-addon-algoliaUsage
Configure the addon in valaxy.config.ts:
import { defineValaxyConfig } from 'valaxy'
import { addonAlgolia } from 'valaxy-addon-algolia'
export default defineValaxyConfig({
addons: [
addonAlgolia({
appId: '',
apiKey: '',
indexName: '',
}),
],
})Ask AI with DocSearch 5
Ask AI is optional. Without askAi, Valaxy loads the keyword-only DocSearch entry. With a published Agent Studio agent, both the addon search box (including Yun) and Press load the AI-capable entry:
addonAlgolia({
appId: 'YOUR_APP_ID',
apiKey: 'YOUR_SEARCH_ONLY_API_KEY',
indexName: 'YOUR_INDEX_NAME',
askAi: {
agentId: 'YOUR_PUBLISHED_AGENT_ID',
// Press only: open AI conversations in a side panel.
sidePanel: true,
},
})You can also use askAi: 'YOUR_PUBLISHED_AGENT_ID' for the modal. Omit askAi to keep AI disabled. Never put an Algolia admin key or an LLM provider secret in the site configuration.
Migrate from DocSearch 4
DocSearch 5 uses Agent Studio exclusively. A legacy Ask AI assistant ID is not an Agent Studio agent ID; renaming the property alone does not migrate the backend.
- In the Algolia dashboard, open the application’s Ask AI assistant and choose Migrate to Agent Studio. If you never enabled Ask AI, there is no assistant to migrate: create an agent in Agent Studio instead, or continue using keyword search.
- Review the agent’s prompt, model and search indices, then publish it. Check the applicable Agent Studio terms, LLM configuration and usage charges before enabling it.
- Copy the new published agent ID and replace
askAi.assistantIdwithaskAi.agentId. For string shorthand, replace the old ID with the new one as well. - Keep the existing keyword-search
indexNameandsearchParameters; Valaxy converts them to DocSearch 5’sindicesformat. For AI,askAi.indicesoptionally selects indices, andaskAi.searchParameterstakes per-index overrides such as{ docs: { filters: 'lang:en' } }. AI filters usefilters, notfacetFilters. - Verify an actual AI response on the site. Opening the search modal alone does not verify agent publishing or API-key permissions.
Legacy object configurations without agentId fall back to keyword search with a console warning. See the official Agent Studio migration guide.