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>
pull/4861/head
Dylan Tientcheu 1 month ago committed by GitHub
parent 3c51b22ac9
commit ac61abe7d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -115,7 +115,8 @@ export default defineConfig({
options: {
appId: '8J64VVRP8K',
apiKey: '52f578a92b88ad6abde815aae2b0ad7c',
indexName: 'vitepress'
indexName: 'vitepress',
askAi: 'YaVSonfX5bS8'
}
},

@ -39,22 +39,6 @@ $ bun add -D vitepress
:::
::: details Getting missing peer deps warnings?
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`:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip NOTE
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.

@ -233,10 +233,16 @@ export default defineConfig({
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
clearButtonTitle: '清除查询条件',
clearButtonAriaLabel: '清除查询条件',
closeButtonText: '关闭',
closeButtonAriaLabel: '关闭',
placeholderText: '搜索文档',
placeholderTextAskAi: '向 AI 提问:',
placeholderTextAskAiStreaming: '回答中...',
searchInputLabel: '搜索',
backToKeywordSearchButtonText: '返回关键字搜索',
backToKeywordSearchButtonAriaLabel: '返回关键字搜索'
},
startScreen: {
recentSearchesTitle: '搜索历史',
@ -244,23 +250,48 @@ export default defineConfig({
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
removeFavoriteSearchButtonTitle: '从收藏中移除',
recentConversationsTitle: '最近的对话',
removeRecentConversationButtonTitle: '从历史记录中删除对话'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
},
resultsScreen: {
askAiPlaceholder: '向 AI 提问: '
},
askAiScreen: {
disclaimerText: '答案由 AI 生成,可能不准确,请自行验证。',
relatedSourcesText: '相关来源',
thinkingText: '思考中...',
copyButtonText: '复制',
copyButtonCopiedText: '已复制!',
copyButtonTitle: '复制',
likeButtonTitle: '赞',
dislikeButtonTitle: '踩',
thanksForFeedbackText: '感谢你的反馈!',
preToolCallText: '搜索中...',
duringToolCallText: '搜索 ',
afterToolCallText: '已搜索'
},
footer: {
selectText: '选择',
submitQuestionText: '提交问题',
selectKeyAriaLabel: 'Enter 键',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上箭头',
navigateDownKeyAriaLabel: '向下箭头',
closeText: '关闭',
backToSearchText: '返回搜索',
closeKeyAriaLabel: 'Esc 键',
poweredByText: '搜索提供者'
}
}
}
@ -274,6 +305,43 @@ export default defineConfig({
[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.
### Algolia Ask AI Support {#ask-ai}
If you would like to include **Ask AI**, pass the `askAi` option (or any of the partial fields) inside `options`:
```ts
import { defineConfig } from 'vitepress'
export default defineConfig({
themeConfig: {
search: {
provider: 'algolia',
options: {
appId: '...',
apiKey: '...',
indexName: '...',
// askAi: "YOUR-ASSISTANT-ID"
// OR
askAi: {
// at minimum you must provide the assistantId you received from Algolia
assistantId: 'XXXYYY',
// optional overrides if omitted, the top-level appId/apiKey/indexName values are reused
// apiKey: '...',
// appId: '...',
// indexName: '...'
}
}
}
}
})
```
::: warning Note
If want to default to keyword search and do not want to use Ask AI, just omit the `askAi` property
:::
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.
### Crawler Config
Here is an example config based on what this site uses:

@ -186,10 +186,17 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: 'Limpiar búsqueda',
resetButtonAriaLabel: 'Limpiar búsqueda',
cancelButtonText: 'Cancelar',
cancelButtonAriaLabel: 'Cancelar'
clearButtonTitle: 'Limpiar búsqueda',
clearButtonAriaLabel: 'Limpiar búsqueda',
closeButtonText: 'Cerrar',
closeButtonAriaLabel: 'Cerrar',
placeholderText: undefined,
placeholderTextAskAi: undefined,
placeholderTextAskAiStreaming: 'Respondiendo...',
backToKeywordSearchButtonText:
'Volver a la búsqueda por palabras clave',
backToKeywordSearchButtonAriaLabel:
'Volver a la búsqueda por palabras clave'
},
startScreen: {
recentSearchesTitle: 'Historial de búsqueda',
@ -197,24 +204,52 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
saveRecentSearchButtonTitle: 'Guardar en el historial de búsqueda',
removeRecentSearchButtonTitle: 'Borrar del historial de búsqueda',
favoriteSearchesTitle: 'Favoritos',
removeFavoriteSearchButtonTitle: 'Borrar de favoritos'
removeFavoriteSearchButtonTitle: 'Borrar de favoritos',
recentConversationsTitle: 'Conversaciones recientes',
removeRecentConversationButtonTitle:
'Eliminar esta conversación del historial'
},
errorScreen: {
titleText: 'No fue posible obtener resultados',
helpText: 'Verifique su conexión de red'
},
footer: {
selectText: 'Seleccionar',
navigateText: 'Navegar',
closeText: 'Cerrar',
searchByText: 'Busqueda por'
},
noResultsScreen: {
noResultsText: 'No fue posible encontrar resultados',
suggestedQueryText: 'Puede intentar una nueva búsqueda',
reportMissingResultsText:
'Deberian haber resultados para esa consulta?',
'¿Deberían haber resultados para esta consulta?',
reportMissingResultsLinkText: 'Click para enviar feedback'
},
resultsScreen: {
askAiPlaceholder: 'Preguntar a la IA: '
},
askAiScreen: {
disclaimerText:
'Las respuestas son generadas por IA y pueden contener errores. Verifica las respuestas.',
relatedSourcesText: 'Fuentes relacionadas',
thinkingText: 'Pensando...',
copyButtonText: 'Copiar',
copyButtonCopiedText: '¡Copiado!',
copyButtonTitle: 'Copiar',
likeButtonTitle: 'Me gusta',
dislikeButtonTitle: 'No me gusta',
thanksForFeedbackText: '¡Gracias por tu opinión!',
preToolCallText: 'Buscando...',
duringToolCallText: 'Buscando ',
afterToolCallText: 'Búsqueda de',
aggregatedToolCallText: 'Búsqueda de'
},
footer: {
selectText: 'Seleccionar',
submitQuestionText: 'Enviar pregunta',
selectKeyAriaLabel: 'Tecla Enter',
navigateText: 'Navegar',
navigateUpKeyAriaLabel: 'Flecha arriba',
navigateDownKeyAriaLabel: 'Flecha abajo',
closeText: 'Cerrar',
backToSearchText: 'Volver a la búsqueda',
closeKeyAriaLabel: 'Tecla Escape',
poweredByText: 'Búsqueda por'
}
}
}

@ -35,22 +35,6 @@ $ bun add -D vitepress
:::
::: details Recibiendo avisos sobre dependencias ausentes?
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`:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip NOTA
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')`.

@ -216,16 +216,19 @@ export default defineConfig({
zh: {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
button: { buttonText: '搜索文档', buttonAriaLabel: '搜索文档' },
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
clearButtonTitle: '清除查询条件',
clearButtonAriaLabel: '清除查询条件',
closeButtonText: '关闭',
closeButtonAriaLabel: '关闭',
placeholderText: '搜索文档',
placeholderTextAskAi: '向 AI 提问:',
placeholderTextAskAiStreaming: '回答中...',
searchInputLabel: '搜索',
backToKeywordSearchButtonText: '返回关键字搜索',
backToKeywordSearchButtonAriaLabel: '返回关键字搜索'
},
startScreen: {
recentSearchesTitle: '搜索历史',
@ -233,23 +236,46 @@ export default defineConfig({
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
removeFavoriteSearchButtonTitle: '从收藏中移除',
recentConversationsTitle: '最近的对话',
removeRecentConversationButtonTitle: '从历史记录中删除对话'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
},
resultsScreen: { askAiPlaceholder: '向 AI 提问: ' },
askAiScreen: {
disclaimerText: '答案由 AI 生成,可能不准确,请自行验证。',
relatedSourcesText: '相关来源',
thinkingText: '思考中...',
copyButtonText: '复制',
copyButtonCopiedText: '已复制!',
copyButtonTitle: '复制',
likeButtonTitle: '赞',
dislikeButtonTitle: '踩',
thanksForFeedbackText: '感谢你的反馈!',
preToolCallText: '搜索中...',
duringToolCallText: '搜索 ',
afterToolCallText: '已搜索'
},
footer: {
selectText: '选择',
submitQuestionText: '提交问题',
selectKeyAriaLabel: 'Enter 键',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上箭头',
navigateDownKeyAriaLabel: '向下箭头',
closeText: '关闭',
backToSearchText: '返回搜索',
closeKeyAriaLabel: 'Esc 键',
poweredByText: '搜索提供者'
}
}
}
@ -261,6 +287,26 @@ export default defineConfig({
})
```
### Algolia Ask AI Support {#ask-ai}
Si deseas incluir **Ask AI**, pasa la opción `askAi` (o alguno de sus campos parciales) dentro de `options`:
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
// askAi: 'TU-ASSISTANT-ID'
askAi: {
assistantId: 'XXXYYY'
}
}
```
::: warning Nota
Si prefieres solo la búsqueda por palabra clave y no la Ask AI, simplemente omite `askAi`.
:::
[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.
### Configuración _Crawler_ {#crawler-config}

@ -188,31 +188,67 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: 'آغاز مجدد جستجو',
resetButtonAriaLabel: 'آغاز مجدد جستجو',
cancelButtonText: 'لغو',
cancelButtonAriaLabel: 'لغو'
clearButtonTitle: 'پاک کردن جستجو',
clearButtonAriaLabel: 'پاک کردن جستجو',
closeButtonText: 'بستن',
closeButtonAriaLabel: 'بستن',
placeholderText: 'جستجوی مستندات',
placeholderTextAskAi: 'از هوش مصنوعی بپرسید: ',
placeholderTextAskAiStreaming: 'در حال پاسخ...',
searchInputLabel: 'جستجو',
backToKeywordSearchButtonText: 'بازگشت به جستجوی کلیدواژه',
backToKeywordSearchButtonAriaLabel: 'بازگشت به جستجوی کلیدواژه'
},
startScreen: {
recentSearchesTitle: 'جستجو‌های اخیر',
noRecentSearchesText: 'تاریخچه جستجویی یافت نشد.',
saveRecentSearchButtonTitle: 'ذخیره تاریخچه جستجو',
removeRecentSearchButtonTitle: 'حذف تاریخچه جستجو',
favoriteSearchesTitle: 'موارد دلخواه',
removeFavoriteSearchButtonTitle: 'حذف مورد دلخواه'
recentSearchesTitle: 'جستجوهای اخیر',
noRecentSearchesText: 'هیچ جستجوی اخیر',
saveRecentSearchButtonTitle: 'ذخیره در تاریخچه جستجو',
removeRecentSearchButtonTitle: 'حذف از تاریخچه جستجو',
favoriteSearchesTitle: 'علاقه‌مندی‌ها',
removeFavoriteSearchButtonTitle: 'حذف از علاقه‌مندی‌ها',
recentConversationsTitle: 'گفتگوهای اخیر',
removeRecentConversationButtonTitle: 'حذف این گفتگو از تاریخچه'
},
errorScreen: {
titleText: 'نتیجه‌ای یافت نشد برای',
titleText: 'عدم امکان دریافت نتایج',
helpText: 'اتصال شبکه خود را بررسی کنید'
},
noResultsScreen: {
noResultsText: 'هیچ نتیجه‌ای یافت نشد',
suggestedQueryText: 'می‌توانید جستجوی دیگری امتحان کنید',
reportMissingResultsText: 'فکر می‌کنید باید نتیجه‌ای نمایش داده شود؟',
reportMissingResultsLinkText: 'برای ارسال بازخورد کلیک کنید'
},
resultsScreen: {
askAiPlaceholder: 'از هوش مصنوعی بپرسید: '
},
askAiScreen: {
disclaimerText:
'پاسخ‌ها توسط هوش مصنوعی تولید می‌شوند و ممکن است خطا داشته باشند. لطفاً بررسی کنید.',
relatedSourcesText: 'منابع مرتبط',
thinkingText: 'در حال پردازش...',
copyButtonText: 'کپی',
copyButtonCopiedText: 'کپی شد!',
copyButtonTitle: 'کپی',
likeButtonTitle: 'پسندیدم',
dislikeButtonTitle: 'نپسندیدم',
thanksForFeedbackText: 'از بازخورد شما سپاسگزاریم!',
preToolCallText: 'در حال جستجو...',
duringToolCallText: 'در حال جستجو برای ',
afterToolCallText: 'جستجو انجام شد',
aggregatedToolCallText: 'جستجو انجام شد'
},
footer: {
selectText: 'انتخاب',
navigateText: 'رفتن',
submitQuestionText: 'ارسال پرسش',
selectKeyAriaLabel: 'کلید Enter',
navigateText: 'حرکت',
navigateUpKeyAriaLabel: 'کلید جهت بالا',
navigateDownKeyAriaLabel: 'کلید جهت پایین',
closeText: 'بستن',
searchByText: ' جستجو با '
},
noResultsScreen: {
noResultsText: 'نتیجه‌ای یافت نشد برای'
backToSearchText: 'بازگشت به جستجو',
closeKeyAriaLabel: 'کلید Escape',
poweredByText: 'جستجو توسط'
}
}
}

@ -39,23 +39,6 @@ $ bun add -D vitepress
:::
::: details درباره peer dependency های ناموجود هشدار دریافت می‌کنید؟
اگر از PNPM استفاده می‌کنید، متوجه هشدار peer dependency برای `@docsearch/js` خواهید شد. این مسئله جلوی عملکرد ویت‌پرس را نمی‌گیرد. اگر می‌خواهید این هشدار را نادیده بگیرید، موارد زیر را به `package.json` خود اضافه کنید:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip نکته
ویت‌پرس یک بسته فقط ESM است. از `require()` برای وارد کردن آن استفاده نکنید و اطمینان حاصل کنید که نزدیک‌ترین `package.json` شما شامل `"type": "module"` است، یا پسوند فایل‌های مربوطه خود مانند `.vitepress/config.js` را به `.mjs`/`.mts` تغییر دهید. برای جزئیات بیشتر به [راهنمای عیب‌یابی Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) مراجعه کنید. همچنین، در زمینه‌های async CJS می‌توانید از `await import('vitepress')` استفاده کنید.

@ -212,9 +212,7 @@ export default defineConfig({
import { defineConfig } from 'vitepress'
export default defineConfig({
themeConfig:
{
themeConfig: {
search: {
provider: 'algolia',
options: {
@ -223,40 +221,40 @@ export default defineConfig({
indexName: '...',
locales: {
zh: {
placeholder: 'جستجو در مستندات',
placeholder: '搜索文档',
translations: {
button: {
buttonText: 'جستجو در مستندات',
buttonAriaLabel: 'جستجو در مستندات'
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
searchBox: {
resetButtonTitle: 'پاک کردن شرایط جستجو',
resetButtonAriaLabel: 'پاک کردن شرایط جستجو',
cancelButtonText: 'لغو',
cancelButtonAriaLabel: 'لغو'
resetButtonTitle: '清除搜索条件',
resetButtonAriaLabel: '清除搜索条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
},
startScreen: {
recentSearchesTitle: 'تاریخچه جستجو',
noRecentSearchesText: 'هیچ تاریخچه جستجویی وجود ندارد',
saveRecentSearchButtonTitle: 'ذخیره در تاریخچه جستجو',
removeRecentSearchButtonTitle: 'حذف از تاریخچه جستجو'
recentSearchesTitle: '最近搜索',
noRecentSearchesText: '没有最近搜索',
saveRecentSearchButtonTitle: '保存到最近搜索',
removeRecentSearchButtonTitle: '从最近搜索中删除'
},
errorScreen: {
titleText: 'نمایش نتایج امکان‌پذیر نیست',
helpText: 'شما ممکن است نیاز به بررسی اتصال اینترنت خود داشته باشید'
titleText: '无法显示结果',
helpText: '您可能需要检查您的互联网连接'
},
footer: {
selectText: 'انتخاب',
navigateText: 'جابجایی',
closeText: 'بستن',
searchByText: 'جستجو توسط'
selectText: '选择',
navigateText: '导航',
closeText: '关闭',
searchByText: '搜索由'
},
noResultsScreen: {
noResultsText: 'نتیجه‌ای پیدا نشد',
suggestedQueryText: 'می‌توانید امتحان کنید',
reportMissingResultsText: 'فکر می‌کنید باید نتایجی وجود داشته باشد؟',
reportMissingResultsLinkText: 'برای بازخورد کلیک کنید'
noResultsText: '没有找到结果',
suggestedQueryText: '您可以尝试',
reportMissingResultsText: '您认为应该有结果吗?',
reportMissingResultsLinkText: '点击这里报告'
}
}
}
@ -377,3 +375,22 @@ new Crawler({
}
})
```
### پشتیبانی Algolia Ask AI {#ask-ai}
برای فعال‌سازی **Ask AI** کافی است گزینه `askAi` را اضافه کنید:
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
askAi: {
assistantId: 'XXXYYY'
}
}
```
::: warning نکته
اگر فقط به جستجوی کلمات کلیدی نیاز دارید، `askAi` را اضافه نکنید.
:::

@ -228,10 +228,16 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: '검색 지우기',
resetButtonAriaLabel: '검색 지우기',
cancelButtonText: '취소',
cancelButtonAriaLabel: '취소'
clearButtonTitle: '검색 지우기',
clearButtonAriaLabel: '검색 지우기',
closeButtonText: '닫기',
closeButtonAriaLabel: '닫기',
placeholderText: '문서 검색',
placeholderTextAskAi: 'AI에게 물어보기: ',
placeholderTextAskAiStreaming: '답변 작성 중...',
searchInputLabel: '검색',
backToKeywordSearchButtonText: '키워드 검색으로 돌아가기',
backToKeywordSearchButtonAriaLabel: '키워드 검색으로 돌아가기'
},
startScreen: {
recentSearchesTitle: '검색 기록',
@ -239,23 +245,50 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
saveRecentSearchButtonTitle: '검색 기록에 저장',
removeRecentSearchButtonTitle: '검색 기록에서 삭제',
favoriteSearchesTitle: '즐겨찾기',
removeFavoriteSearchButtonTitle: '즐겨찾기에서 삭제'
removeFavoriteSearchButtonTitle: '즐겨찾기에서 삭제',
recentConversationsTitle: '최근 대화',
removeRecentConversationButtonTitle: '대화를 기록에서 삭제'
},
errorScreen: {
titleText: '결과를 가져올 수 없습니다',
helpText: '네트워크 연결을 확인하세요'
},
noResultsScreen: {
noResultsText: '결과를 찾을 수 없습니다',
suggestedQueryText: '다른 검색어를 시도해 보세요',
reportMissingResultsText: '결과가 있어야 한다고 생각하나요?',
reportMissingResultsLinkText: '피드백 보내기'
},
resultsScreen: {
askAiPlaceholder: 'AI에게 물어보기: '
},
askAiScreen: {
disclaimerText:
'AI가 생성한 답변으로 오류가 있을 수 있습니다. 반드시 확인하세요.',
relatedSourcesText: '관련 소스',
thinkingText: '생각 중...',
copyButtonText: '복사',
copyButtonCopiedText: '복사됨!',
copyButtonTitle: '복사',
likeButtonTitle: '좋아요',
dislikeButtonTitle: '싫어요',
thanksForFeedbackText: '피드백 감사합니다!',
preToolCallText: '검색 중...',
duringToolCallText: '검색 중 ',
afterToolCallText: '검색 완료',
aggregatedToolCallText: '검색 완료'
},
footer: {
selectText: '선택',
submitQuestionText: '질문 보내기',
selectKeyAriaLabel: 'Enter 키',
navigateText: '탐색',
navigateUpKeyAriaLabel: '위쪽 화살표',
navigateDownKeyAriaLabel: '아래쪽 화살표',
closeText: '닫기',
searchByText: '검색 기준'
},
noResultsScreen: {
noResultsText: '결과를 찾을 수 없습니다',
suggestedQueryText: '새로운 검색을 시도할 수 있습니다',
reportMissingResultsText: '해당 검색어에 대한 결과가 있어야 합니까?',
reportMissingResultsLinkText: '피드백 보내기 클릭'
backToSearchText: '검색으로 돌아가기',
closeKeyAriaLabel: 'Esc 키',
poweredByText: '제공: '
}
}
}

@ -40,22 +40,6 @@ $ bun add -D vitepress
:::
::: details "missing peer deps" 경고가 표시되나요?
PNPM을 사용하는 경우 `@docsearch/js`에 대한 "missing peer deps" 경고가 표시됩니다. 이는 VitePress가 작동하는 것을 방해하지 않습니다. 이 경고를 억제하려면 `package.json`에 다음을 추가합니다:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip 참고
VitePress는 ESM 전용 패키지입니다. `require()`를 사용하여 가져오지 마시고, `package.json``"type": "module"`이 포함되어 있는지 확인하거나, 관련 파일(예: `.vitepress/config.js`)의 확장자를 `.mjs`/`.mts`로 변경하세요. 자세한 내용은 [Vite 문제 해결 가이드](http://vitejs.dev/ko/guide/troubleshooting.html#this-package-is-esm-only)를 참고하세요. 또한, 비동기 CJS 컨텍스트에서는 `await import('vitepress')`를 사용할 수 있습니다.

@ -377,3 +377,20 @@ new Crawler({
}
})
```
### Algolia Ask AI 지원 {#ask-ai}
**Ask AI** 기능을 사용하려면 `askAi` 옵션을 추가하세요:
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
askAi: { assistantId: 'XXXYYY' }
}
```
::: warning 참고
Ask AI를 사용하지 않으려면 `askAi` 옵션을 생략하면 됩니다.
:::

@ -16,6 +16,6 @@
"postcss-rtlcss": "^5.7.1",
"vitepress": "workspace:*",
"vitepress-plugin-group-icons": "^1.6.1",
"vitepress-plugin-llms": "^1.7.0"
"vitepress-plugin-llms": "^1.7.1"
}
}

@ -183,35 +183,69 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: 'Limpar pesquisa',
resetButtonAriaLabel: 'Limpar pesquisa',
cancelButtonText: 'Cancelar',
cancelButtonAriaLabel: 'Cancelar'
clearButtonTitle: 'Limpar pesquisa',
clearButtonAriaLabel: 'Limpar pesquisa',
closeButtonText: 'Fechar',
closeButtonAriaLabel: 'Fechar',
placeholderText: 'Pesquisar documentos',
placeholderTextAskAi: 'Pergunte à IA: ',
placeholderTextAskAiStreaming: 'Respondendo...',
searchInputLabel: 'Pesquisar',
backToKeywordSearchButtonText: 'Voltar à pesquisa por palavras-chave',
backToKeywordSearchButtonAriaLabel:
'Voltar à pesquisa por palavras-chave'
},
startScreen: {
recentSearchesTitle: 'Histórico de Pesquisa',
recentSearchesTitle: 'Histórico de pesquisa',
noRecentSearchesText: 'Nenhuma pesquisa recente',
saveRecentSearchButtonTitle: 'Salvar no histórico de pesquisas',
removeRecentSearchButtonTitle: 'Remover do histórico de pesquisas',
favoriteSearchesTitle: 'Favoritos',
removeFavoriteSearchButtonTitle: 'Remover dos favoritos'
removeFavoriteSearchButtonTitle: 'Remover dos favoritos',
recentConversationsTitle: 'Conversas recentes',
removeRecentConversationButtonTitle:
'Remover esta conversa do histórico'
},
errorScreen: {
titleText: 'Não foi possível obter resultados',
helpText: 'Verifique a sua conexão de rede'
helpText: 'Verifique sua conexão de rede'
},
noResultsScreen: {
noResultsText: 'Nenhum resultado encontrado',
suggestedQueryText: 'Você pode tentar uma nova consulta',
reportMissingResultsText: 'Acha que deveria haver resultados?',
reportMissingResultsLinkText: 'Clique para enviar feedback'
},
resultsScreen: {
askAiPlaceholder: 'Pergunte à IA: '
},
askAiScreen: {
disclaimerText:
'As respostas são geradas por IA e podem conter erros. Verifique as respostas.',
relatedSourcesText: 'Fontes relacionadas',
thinkingText: 'Pensando...',
copyButtonText: 'Copiar',
copyButtonCopiedText: 'Copiado!',
copyButtonTitle: 'Copiar',
likeButtonTitle: 'Curtir',
dislikeButtonTitle: 'Não curtir',
thanksForFeedbackText: 'Obrigado pelo feedback!',
preToolCallText: 'Pesquisando...',
duringToolCallText: 'Pesquisando ',
afterToolCallText: 'Pesquisa concluída',
aggregatedToolCallText: 'Pesquisa concluída'
},
footer: {
selectText: 'Selecionar',
submitQuestionText: 'Enviar pergunta',
selectKeyAriaLabel: 'Tecla Enter',
navigateText: 'Navegar',
navigateUpKeyAriaLabel: 'Seta para cima',
navigateDownKeyAriaLabel: 'Seta para baixo',
closeText: 'Fechar',
searchByText: 'Pesquisa por'
},
noResultsScreen: {
noResultsText: 'Não foi possível encontrar resultados',
suggestedQueryText: 'Você pode tentar uma nova consulta',
reportMissingResultsText:
'Deveriam haver resultados para essa consulta?',
reportMissingResultsLinkText: 'Clique para enviar feedback'
backToSearchText: 'Voltar à pesquisa',
closeKeyAriaLabel: 'Tecla Escape',
poweredByText: 'Pesquisa por'
}
}
}

@ -39,22 +39,6 @@ $ bun add -D vitepress
:::
::: details Está recebendo avisos sobre dependências correspondentes ausentes?
Se usar PNPM, você perceberá um aviso de ausência de `@docsearch/js`. Isso não evita que o VitePress funcione. Se você deseja suprimir este aviso, adicione o seguinte no seu `package.json`:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip NOTA
VitePress é um pacote apenas para ESM. Não use `require()` para importá-lo, e certifique de que o `package.json` mais próximo contém `"type": "module"`, ou mude a extensão do arquivo de seus arquivos releavantes como `.vitepress/config.js` para `.mjs`/`.mts`. Refira-se ao [Guia de resolução de problemas Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) para mais detalhes. Além disso, dentro de contextos de JavaScript comum assíncronos, você pode usar `await import('vitepress')`.

@ -370,3 +370,20 @@ new Crawler({
}
})
```
### Suporte ao Algolia Ask AI {#ask-ai}
Se quiser incluir o **Ask AI**, adicione `askAi` em `options`:
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
askAi: { assistantId: 'XXXYYY' }
}
```
::: warning Nota
Caso queira apenas a pesquisa por palavra-chave, omita `askAi`.
:::

@ -183,10 +183,18 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: 'Сбросить поиск',
resetButtonAriaLabel: 'Сбросить поиск',
cancelButtonText: 'Отменить поиск',
cancelButtonAriaLabel: 'Отменить поиск'
clearButtonTitle: 'Очистить поиск',
clearButtonAriaLabel: 'Очистить поиск',
closeButtonText: 'Закрыть',
closeButtonAriaLabel: 'Закрыть',
placeholderText: 'Поиск в документации',
placeholderTextAskAi: 'Спросите у ИИ: ',
placeholderTextAskAiStreaming: 'Формируется ответ...',
searchInputLabel: 'Поиск',
backToKeywordSearchButtonText:
'Вернуться к поиску по ключевым словам',
backToKeywordSearchButtonAriaLabel:
'Вернуться к поиску по ключевым словам'
},
startScreen: {
recentSearchesTitle: 'История поиска',
@ -194,24 +202,50 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
saveRecentSearchButtonTitle: 'Сохранить в истории поиска',
removeRecentSearchButtonTitle: 'Удалить из истории поиска',
favoriteSearchesTitle: 'Избранное',
removeFavoriteSearchButtonTitle: 'Удалить из избранного'
removeFavoriteSearchButtonTitle: 'Удалить из избранного',
recentConversationsTitle: 'Недавние беседы',
removeRecentConversationButtonTitle: 'Удалить эту беседу из истории'
},
errorScreen: {
titleText: 'Невозможно получить результаты',
helpText: 'Вам может потребоваться проверить подключение к Интернету'
helpText: 'Проверьте подключение к Интернету'
},
noResultsScreen: {
noResultsText: 'Ничего не найдено',
suggestedQueryText: 'Попробуйте изменить запрос',
reportMissingResultsText: 'Считаете, что результаты должны быть?',
reportMissingResultsLinkText: 'Сообщить об этом'
},
resultsScreen: {
askAiPlaceholder: 'Спросите у ИИ: '
},
askAiScreen: {
disclaimerText:
'Ответы генерируются ИИ и могут содержать ошибки. Проверяйте информацию.',
relatedSourcesText: 'Связанные источники',
thinkingText: 'Обработка...',
copyButtonText: 'Копировать',
copyButtonCopiedText: 'Скопировано!',
copyButtonTitle: 'Копировать',
likeButtonTitle: 'Нравится',
dislikeButtonTitle: 'Не нравится',
thanksForFeedbackText: 'Спасибо за отзыв!',
preToolCallText: 'Поиск...',
duringToolCallText: 'Поиск ',
afterToolCallText: 'Поиск завершён',
aggregatedToolCallText: 'Поиск завершён'
},
footer: {
selectText: 'выбрать',
submitQuestionText: 'Отправить вопрос',
selectKeyAriaLabel: 'Клавиша Enter',
navigateText: 'перейти',
navigateUpKeyAriaLabel: 'Стрелка вверх',
navigateDownKeyAriaLabel: 'Стрелка вниз',
closeText: 'закрыть',
searchByText: 'поставщик поиска'
},
noResultsScreen: {
noResultsText: 'Нет результатов для',
suggestedQueryText: 'Вы можете попытаться узнать',
reportMissingResultsText:
'Считаете, что поиск даёт ложные результаты?',
reportMissingResultsLinkText: 'Нажмите на кнопку «Обратная связь»'
backToSearchText: 'Вернуться к поиску',
closeKeyAriaLabel: 'Клавиша Esc',
poweredByText: 'поиск от'
}
}
}

@ -39,22 +39,6 @@ $ bun add -D vitepress
:::
::: details Получаете предупреждения об отсутствующих зависимостях?
Если вы используете PNPM, вы заметите предупреждение об отсутствующем пакете `@docsearch/js`. Это не мешает работе VitePress. Если вы хотите подавить это предупреждение, добавьте следующее в ваш `package.json`:
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip ПРИМЕЧАНИЕ
VitePress — это пакет, предназначенный только для ESM. Не используйте `require()` для импорта, и убедитесь, что ближайший `package.json` содержит `"type": "module"`, или измените расширение соответствующих файлов, например, `.vitepress/config.js` на `.mjs`/`.mts`. Более подробную информацию см. в [Руководстве по устранению неполадок Vite](https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only). Кроме того, внутри асинхронных контекстов CJS можно использовать `await import('vitepress')` вместо этого.

@ -384,3 +384,20 @@ new Crawler({
}
})
```
### Поддержка Algolia Ask AI {#ask-ai}
Чтобы включить **Ask AI**, добавьте параметр `askAi`:
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
askAi: { assistantId: 'XXXYYY' }
}
```
::: warning Примечание
Если нужна только поисковая строка, просто опустите `askAi`.
:::

@ -176,10 +176,16 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
clearButtonTitle: '清除查询条件',
clearButtonAriaLabel: '清除查询条件',
closeButtonText: '关闭',
closeButtonAriaLabel: '关闭',
placeholderText: '搜索文档',
placeholderTextAskAi: '向 AI 提问:',
placeholderTextAskAiStreaming: '回答中...',
searchInputLabel: '搜索',
backToKeywordSearchButtonText: '返回关键字搜索',
backToKeywordSearchButtonAriaLabel: '返回关键字搜索'
},
startScreen: {
recentSearchesTitle: '搜索历史',
@ -187,23 +193,49 @@ function searchOptions(): Partial<DefaultTheme.AlgoliaSearchOptions> {
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
removeFavoriteSearchButtonTitle: '从收藏中移除',
recentConversationsTitle: '最近的对话',
removeRecentConversationButtonTitle: '从历史记录中删除对话'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
},
resultsScreen: {
askAiPlaceholder: '向 AI 提问: '
},
askAiScreen: {
disclaimerText: '答案由 AI 生成,可能不准确,请自行验证。',
relatedSourcesText: '相关来源',
thinkingText: '思考中...',
copyButtonText: '复制',
copyButtonCopiedText: '已复制!',
copyButtonTitle: '复制',
likeButtonTitle: '赞',
dislikeButtonTitle: '踩',
thanksForFeedbackText: '感谢你的反馈!',
preToolCallText: '搜索中...',
duringToolCallText: '搜索 ',
afterToolCallText: '已搜索',
aggregatedToolCallText: '已搜索'
},
footer: {
selectText: '选择',
submitQuestionText: '提交问题',
selectKeyAriaLabel: 'Enter 键',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上箭头',
navigateDownKeyAriaLabel: '向下箭头',
closeText: '关闭',
backToSearchText: '返回搜索',
closeKeyAriaLabel: 'Esc 键',
poweredByText: '搜索提供者'
}
}
}

@ -39,22 +39,6 @@ $ bun add -D vitepress
:::
::: details 遇到了 missing peer deps 警告?
如果使用 PNPM会注意到对 `@docsearch/js` 的 missing peer deps 警告。这不会影响 VitePress 运行。如果希望禁止显示此警告,请将以下内容添加到 `package.json`
```json
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights"
]
}
}
```
:::
::: tip 注意
VitePress 是仅 ESM 的软件包。不要使用 `require()` 导入它,并确保最新的 `package.json` 包含 `"type": "module"`,或者更改相关文件的文件扩展名,例如 `.vitepress/config.js``.mjs`/`.mts`。更多详情请参考 [Vite 故障排除指南](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only)。此外,在异步 CJS 上下文中,可以使用 `await import('vitepress')` 代替。

@ -216,16 +216,19 @@ export default defineConfig({
zh: {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
button: { buttonText: '搜索文档', buttonAriaLabel: '搜索文档' },
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
clearButtonTitle: '清除查询条件',
clearButtonAriaLabel: '清除查询条件',
closeButtonText: '关闭',
closeButtonAriaLabel: '关闭',
placeholderText: '搜索文档',
placeholderTextAskAi: '向 AI 提问:',
placeholderTextAskAiStreaming: '回答中...',
searchInputLabel: '搜索',
backToKeywordSearchButtonText: '返回关键字搜索',
backToKeywordSearchButtonAriaLabel: '返回关键字搜索'
},
startScreen: {
recentSearchesTitle: '搜索历史',
@ -233,23 +236,46 @@ export default defineConfig({
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
removeFavoriteSearchButtonTitle: '从收藏中移除',
recentConversationsTitle: '最近的对话',
removeRecentConversationButtonTitle: '从历史记录中删除对话'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者'
helpText: '请检查网络连接'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
},
resultsScreen: { askAiPlaceholder: '向 AI 提问: ' },
askAiScreen: {
disclaimerText: '答案由 AI 生成,可能不准确,请自行验证。',
relatedSourcesText: '相关来源',
thinkingText: '思考中...',
copyButtonText: '复制',
copyButtonCopiedText: '已复制!',
copyButtonTitle: '复制',
likeButtonTitle: '赞',
dislikeButtonTitle: '踩',
thanksForFeedbackText: '感谢你的反馈!',
preToolCallText: '搜索中...',
duringToolCallText: '搜索 ',
afterToolCallText: '已搜索'
},
footer: {
selectText: '选择',
submitQuestionText: '提交问题',
selectKeyAriaLabel: 'Enter 键',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上箭头',
navigateDownKeyAriaLabel: '向下箭头',
closeText: '关闭',
backToSearchText: '返回搜索',
closeKeyAriaLabel: 'Esc 键',
poweredByText: '搜索提供者'
}
}
}
@ -261,6 +287,25 @@ export default defineConfig({
})
```
### Algolia Ask AI 支持 {#ask-ai}
如果需要启用 **Ask AI**,只需在 `options` 中添加 `askAi`
```ts
options: {
appId: '...',
apiKey: '...',
indexName: '...',
askAi: {
assistantId: 'XXXYYY'
}
}
```
::: warning 提示
若仅需关键词搜索,可省略 `askAi`
:::
[这些选项](https://github.com/vuejs/vitepress/blob/main/types/docsearch.d.ts)可以被覆盖。请参阅 Algolia 官方文档以了解更多信息。
### 爬虫配置 {#crawler-config}

@ -95,23 +95,23 @@
"*": "prettier --experimental-cli --ignore-unknown --write"
},
"dependencies": {
"@docsearch/css": "^3.9.0",
"@docsearch/js": "^3.9.0",
"@iconify-json/simple-icons": "^1.2.42",
"@shikijs/core": "^3.7.0",
"@shikijs/transformers": "^3.7.0",
"@shikijs/types": "^3.7.0",
"@docsearch/css": "^4.0.0-beta.5",
"@docsearch/js": "^4.0.0-beta.5",
"@iconify-json/simple-icons": "^1.2.44",
"@shikijs/core": "^3.8.1",
"@shikijs/transformers": "^3.8.1",
"@shikijs/types": "^3.8.1",
"@vitejs/plugin-vue": "^6.0.0",
"@vue/devtools-api": "^7.7.7",
"@vue/shared": "^3.5.17",
"@vue/shared": "^3.5.18",
"@vueuse/core": "^13.5.0",
"@vueuse/integrations": "^13.5.0",
"focus-trap": "^7.6.5",
"mark.js": "8.11.1",
"minisearch": "^7.1.2",
"shiki": "^3.7.0",
"vite": "^7.0.3",
"vue": "^3.5.17"
"shiki": "^3.8.1",
"vite": "^7.0.6",
"vue": "^3.5.18"
},
"devDependencies": {
"@clack/prompts": "^1.0.0-alpha.1",
@ -139,15 +139,15 @@
"@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^3.0.1",
"@types/minimist": "^1.2.5",
"@types/node": "^24.0.10",
"@types/picomatch": "^4.0.0",
"@types/node": "^24.1.0",
"@types/picomatch": "^4.0.1",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"chokidar": "^4.0.3",
"conventional-changelog-cli": "^5.0.0",
"cross-spawn": "^7.0.6",
"debug": "^4.4.1",
"esbuild": "^0.25.6",
"esbuild": "^0.25.8",
"execa": "^9.6.0",
"fs-extra": "^11.3.0",
"get-port": "^7.1.0",
@ -165,20 +165,21 @@
"minimist": "^1.2.8",
"nanoid": "^5.1.5",
"ora": "^8.2.0",
"oxc-minify": "^0.75.1",
"oxc-minify": "^0.78.0",
"p-map": "^7.0.3",
"package-directory": "^8.1.0",
"path-to-regexp": "^6.3.0",
"picocolors": "^1.1.1",
"picomatch": "^4.0.2",
"package-directory": "^8.1.0",
"playwright-chromium": "^1.53.2",
"picomatch": "^4.0.3",
"playwright-chromium": "^1.54.1",
"polka": "^1.0.0-next.28",
"postcss": "^8.5.6",
"postcss-prefix-selector": "^2.1.1",
"prettier": "^3.6.2",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^6.0.1",
"rollup": "^4.44.2",
"rollup": "^4.45.1",
"rollup-plugin-dts": "6.1.1",
"rollup-plugin-esbuild": "^6.2.1",
"semver": "^7.7.2",
@ -187,13 +188,13 @@
"sitemap": "^8.0.0",
"tinyglobby": "^0.2.14",
"typescript": "^5.8.3",
"vitest": "^4.0.0-beta.2",
"vue-tsc": "^3.0.1",
"wait-on": "^8.0.3"
"vitest": "^4.0.0-beta.4",
"vue-tsc": "^3.0.4",
"wait-on": "^8.0.4"
},
"peerDependencies": {
"markdown-it-mathjax3": "^4",
"oxc-minify": "^0.75.1",
"oxc-minify": "^0.78.0",
"postcss": "^8"
},
"peerDependenciesMeta": {
@ -207,15 +208,8 @@
"optional": true
}
},
"packageManager": "pnpm@10.12.4",
"packageManager": "pnpm@10.13.1",
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights",
"postcss"
]
},
"overrides": {
"ora>string-width": "^5",
"vite": "npm:rolldown-vite@latest"

File diff suppressed because it is too large Load Diff

@ -12,8 +12,6 @@ const props = defineProps<{
const router = useRouter()
const { site, localeIndex, lang } = useData()
type DocSearchProps = Parameters<typeof docsearch>[0]
onMounted(update)
watch(localeIndex, update)
@ -31,37 +29,54 @@ async function update() {
).filter((f) => !f.startsWith('lang:')),
`lang:${lang.value}`
]
// Rebuild the askAi prop as an object:
// If the askAi prop is a string, treat it as the assistantId and use
// the default indexName, apiKey and appId from the main options.
// If the askAi prop is an object, spread its explicit values.
const askAiProp = options.askAi
const isAskAiString = typeof askAiProp === 'string'
const askAi = askAiProp
? {
indexName: isAskAiString ? options.indexName : askAiProp.indexName,
apiKey: isAskAiString ? options.apiKey : askAiProp.apiKey,
appId: isAskAiString ? options.appId : askAiProp.appId,
assistantId: isAskAiString ? askAiProp : askAiProp.assistantId,
// Re-use the merged facetFilters from the search parameters so that
// Ask AI uses the same language filtering as the regular search.
searchParameters: facetFilters.length ? { facetFilters } : undefined
}
: undefined
initialize({
...options,
searchParameters: {
...options.searchParameters,
facetFilters
}
},
askAi
})
}
function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
const options = Object.assign<
{},
DefaultTheme.AlgoliaSearchOptions,
Partial<DocSearchProps>
>({}, userOptions, {
const options = Object.assign({}, userOptions, {
container: '#docsearch',
navigator: {
navigate({ itemUrl }) {
router.go(itemUrl)
navigate(item: { itemUrl: string }) {
router.go(item.itemUrl)
}
},
transformItems(items) {
transformItems(items: { url: string }[]) {
return items.map((item) => {
return Object.assign({}, item, {
url: getRelativePath(item.url)
})
})
}
}) as DocSearchProps
})
docsearch(options)
}

@ -2,12 +2,7 @@
import '@docsearch/css'
import { onKeyStroke } from '@vueuse/core'
import type { DefaultTheme } from 'vitepress/theme'
import {
defineAsyncComponent,
onMounted,
onUnmounted,
ref
} from 'vue'
import { defineAsyncComponent, onMounted, onUnmounted, ref } from 'vue'
import { useData } from '../composables/data'
import VPNavBarSearchButton from './VPNavBarSearchButton.vue'
@ -174,21 +169,4 @@ const provider = __ALGOLIA__ ? 'algolia' : __VP_LOCAL_SEARCH__ ? 'local' : ''
padding-left: 32px;
}
}
.dark .DocSearch-Footer {
border-top: 1px solid var(--vp-c-divider);
}
.DocSearch-Form {
border: 1px solid var(--vp-c-brand-1);
background-color: var(--vp-c-white);
}
.dark .DocSearch-Form {
background-color: var(--vp-c-default-soft);
}
.DocSearch-Screen-Icon > svg {
margin: auto;
}
</style>

@ -2,7 +2,7 @@
import type { ButtonTranslations } from '../../../../types/local-search'
import { createSearchTranslate } from '../support/translation'
// Button-Translations
// button translations
const defaultTranslations: { button: ButtonTranslations } = {
button: {
buttonText: 'Search',
@ -14,200 +14,123 @@ const translate = createSearchTranslate(defaultTranslations)
</script>
<template>
<button type="button" class="DocSearch DocSearch-Button" :aria-label="translate('button.buttonAriaLabel')">
<button
type="button"
:aria-label="translate('button.buttonAriaLabel')"
aria-keyshortcuts="/ control+k meta+k"
class="DocSearch DocSearch-Button"
>
<span class="DocSearch-Button-Container">
<span class="vp-icon DocSearch-Search-Icon"></span>
<span class="vpi-search DocSearch-Search-Icon"></span>
<span class="DocSearch-Button-Placeholder">{{ translate('button.buttonText') }}</span>
</span>
<span class="DocSearch-Button-Keys">
<kbd class="DocSearch-Button-Key"></kbd>
<kbd class="DocSearch-Button-Key">K</kbd>
<kbd class="DocSearch-Button-Key"></kbd>
</span>
</button>
</template>
<style>
[class*='DocSearch'] {
--docsearch-primary-color: var(--vp-c-brand-1);
--docsearch-highlight-color: var(--docsearch-primary-color);
--docsearch-text-color: var(--vp-c-text-1);
--docsearch-background-color: var(--vp-c-bg-soft);
--docsearch-container-background: var(--vp-backdrop-bg-color);
--docsearch-focus-color: var(--vp-c-brand-1);
--docsearch-footer-background: var(--vp-c-bg);
--docsearch-highlight-color: var(--vp-c-brand-1);
--docsearch-hit-background: var(--vp-c-default-soft);
--docsearch-hit-color: var(--vp-c-text-1);
--docsearch-hit-highlight-color: var(--vp-c-brand-soft);
--docsearch-icon-color: var(--vp-c-text-2);
--docsearch-key-background: transparent;
--docsearch-key-color: var(--vp-c-text-2);
--docsearch-modal-background: var(--vp-c-bg-soft);
--docsearch-muted-color: var(--vp-c-text-2);
--docsearch-searchbox-shadow: none;
--docsearch-searchbox-background: transparent;
--docsearch-primary-color: var(--vp-c-brand-1);
--docsearch-searchbox-focus-background: transparent;
--docsearch-key-gradient: transparent;
--docsearch-key-shadow: none;
--docsearch-modal-background: var(--vp-c-bg-soft);
--docsearch-footer-background: var(--vp-c-bg);
--docsearch-secondary-text-color: var(--vp-c-text-2);
--docsearch-soft-primary-color: var(--vp-c-brand-soft);
--docsearch-subtle-color: var(--vp-c-divider);
--docsearch-success-color: var(--vp-c-brand-soft);
--docsearch-text-color: var(--vp-c-text-1);
}
.dark [class*='DocSearch'] {
--docsearch-modal-shadow: none;
--docsearch-footer-shadow: none;
--docsearch-logo-color: var(--vp-c-text-2);
--docsearch-hit-background: var(--vp-c-default-soft);
--docsearch-hit-color: var(--vp-c-text-2);
--docsearch-hit-shadow: none;
}
.DocSearch-Button {
display: flex;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
width: 48px;
height: 55px;
background: transparent;
transition: border-color 0.25s;
}
.DocSearch-Button:hover {
background: transparent;
.DocSearch-Clear {
padding: 0 8px;
}
.DocSearch-Button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
.DocSearch-Commands-Key {
padding: 4px;
border: 1px solid var(--docsearch-subtle-color);
border-radius: 4px;
}
.DocSearch-Button-Key--pressed {
transform: none;
box-shadow: none;
.DocSearch-Hit a:focus-visible {
outline: 2px solid var(--docsearch-focus-color);
}
.DocSearch-Button:focus:not(:focus-visible) {
outline: none !important;
}
@media (min-width: 768px) {
.DocSearch-Button {
justify-content: flex-start;
border: 1px solid transparent;
border-radius: 8px;
padding: 0 10px 0 12px;
width: 100%;
height: 40px;
background-color: var(--vp-c-bg-alt);
}
.DocSearch-Button:hover {
border-color: var(--vp-c-brand-1);
background: var(--vp-c-bg-alt);
}
}
.DocSearch-Button .DocSearch-Button-Container {
display: flex;
align-items: center;
}
.DocSearch-Button .DocSearch-Search-Icon {
position: relative;
width: 16px;
height: 16px;
color: var(--vp-c-text-1);
.DocSearch-Logo [class^='cls-'] {
fill: currentColor;
transition: color 0.5s;
}
.DocSearch-Button:hover .DocSearch-Search-Icon {
color: var(--vp-c-text-1);
}
@media (min-width: 768px) {
.DocSearch-Button .DocSearch-Search-Icon {
top: 1px;
margin-right: 8px;
width: 14px;
height: 14px;
color: var(--vp-c-text-2);
}
}
.DocSearch-Button .DocSearch-Button-Placeholder {
display: none;
margin-top: 2px;
padding: 0 16px 0 0;
font-size: 13px;
font-weight: 500;
color: var(--vp-c-text-2);
transition: color 0.5s;
.DocSearch-Button {
--docsearch-muted-color: var(--docsearch-text-color);
--docsearch-searchbox-background: transparent;
width: auto;
padding: 2px 12px;
border: none;
border-radius: 8px;
}
.DocSearch-Button:hover .DocSearch-Button-Placeholder {
color: var(--vp-c-text-1);
.DocSearch-Search-Icon {
color: inherit !important;
width: 20px;
height: 20px;
}
@media (min-width: 768px) {
.DocSearch-Button .DocSearch-Button-Placeholder {
display: inline-block;
.DocSearch-Button {
--docsearch-muted-color: var(--docsearch-secondary-text-color);
--docsearch-searchbox-background: var(--vp-c-bg-alt);
}
}
.DocSearch-Button .DocSearch-Button-Keys {
/*rtl:ignore*/
direction: ltr;
display: none;
min-width: auto;
}
@media (min-width: 768px) {
.DocSearch-Button .DocSearch-Button-Keys {
display: flex;
align-items: center;
.DocSearch-Search-Icon {
width: 15px;
height: 15px;
}
}
.DocSearch-Button .DocSearch-Button-Key {
display: block;
margin: 2px 0 0 0;
border: 1px solid var(--vp-c-divider);
/*rtl:begin:ignore*/
border-right: none;
border-radius: 4px 0 0 4px;
padding-left: 6px;
/*rtl:end:ignore*/
min-width: 0;
width: auto;
height: 22px;
line-height: 22px;
font-family: var(--vp-font-family-base);
font-size: 12px;
font-weight: 500;
transition: color 0.5s, border-color 0.5s;
}
.DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key {
/*rtl:begin:ignore*/
border-right: 1px solid var(--vp-c-divider);
border-left: none;
border-radius: 0 4px 4px 0;
padding-left: 2px;
padding-right: 6px;
/*rtl:end:ignore*/
}
.DocSearch-Button .DocSearch-Button-Key:first-child {
font-size: 0 !important;
.DocSearch-Button-Placeholder {
font-size: 13px;
}
}
.DocSearch-Button .DocSearch-Button-Key:first-child:after {
content: 'Ctrl';
.DocSearch-Button-Keys {
min-width: auto;
margin: 0;
padding: 4px 6px;
background-color: var(--docsearch-key-background);
border: 1px solid var(--docsearch-subtle-color);
border-radius: 4px;
font-size: 12px;
letter-spacing: normal;
color: var(--docsearch-muted-color);
line-height: 1;
color: var(--docsearch-key-color);
}
.mac .DocSearch-Button .DocSearch-Button-Key:first-child:after {
content: '\2318';
.DocSearch-Button-Keys > * {
display: none;
}
.DocSearch-Button .DocSearch-Button-Key:first-child > * {
display: none;
.DocSearch-Button-Keys:after {
/*rtl:ignore*/
direction: ltr;
content: 'Ctrl K';
}
.DocSearch-Search-Icon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke-width='1.6' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='m14.386 14.386 4.088 4.088-4.088-4.088A7.533 7.533 0 1 1 3.733 3.733a7.533 7.533 0 0 1 10.653 10.653z'/%3E%3C/svg%3E");
.mac .DocSearch-Button-Keys:after {
content: '\2318 K';
}
</style>

@ -23,19 +23,19 @@
/* internal icons - used under ISC from https://lucide.dev/ */
.vpi-align-left {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M21 6H3M15 12H3M17 18H3'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12H3m14 6H3M21 6H3'/%3E%3C/svg%3E");
}
.vpi-arrow-right,
.vpi-arrow-down,
.vpi-arrow-left,
.vpi-arrow-up {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14m-7-7l7 7l-7 7'/%3E%3C/svg%3E");
}
.vpi-chevron-right,
.vpi-chevron-down,
.vpi-chevron-left,
.vpi-chevron-up {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 18l6-6l-6-6'/%3E%3C/svg%3E");
}
.vpi-chevron-down,
.vpi-arrow-down {
@ -53,41 +53,41 @@
transform: rotate(-90deg);
}
.vpi-square-pen {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z'/%3E%3C/g%3E%3C/svg%3E");
}
.vpi-plus {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h14M12 5v14'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14m-7-7v14'/%3E%3C/svg%3E");
}
.vpi-sun {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/g%3E%3C/svg%3E");
}
.vpi-moon {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 3a6 6 0 0 0 9 9a9 9 0 1 1-9-9'/%3E%3C/svg%3E");
}
.vpi-more-horizontal {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/g%3E%3C/svg%3E");
}
.vpi-languages {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m5 8 6 6M4 14l6-6 2-3M2 5h12M7 2h1M22 22l-5-10-5 10M14 18h6'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 8l6 6m-7 0l6-6l2-3M2 5h12M7 2h1m14 20l-5-10l-5 10m2-4h6'/%3E%3C/svg%3E");
}
.vpi-heart {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2c-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E");
}
.vpi-search {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'%3E%3Cpath d='m21 21l-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8' stroke-width='1.4'/%3E%3C/g%3E%3C/svg%3E");
}
.vpi-layout-list {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='7' height='7' x='3' y='3' rx='1'/%3E%3Crect width='7' height='7' x='3' y='14' rx='1'/%3E%3Cpath d='M14 4h7M14 9h7M14 15h7M14 20h7'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='7' height='7' x='3' y='3' rx='1'/%3E%3Crect width='7' height='7' x='3' y='14' rx='1'/%3E%3Cpath d='M14 4h7m-7 5h7m-7 6h7m-7 5h7'/%3E%3C/g%3E%3C/svg%3E");
}
.vpi-delete {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M20 5H9l-7 7 7 7h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2ZM18 9l-6 6M12 9l6 6'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm2 4l6 6m0-6l-6 6'/%3E%3C/svg%3E");
}
.vpi-corner-down-left {
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 10-5 5 5 5'/%3E%3Cpath d='M20 4v7a4 4 0 0 1-4 4H4'/%3E%3C/svg%3E");
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M20 4v7a4 4 0 0 1-4 4H4'/%3E%3Cpath d='m9 10l-5 5l5 5'/%3E%3C/g%3E%3C/svg%3E");
}
:root {
/* clipboard */
--vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/svg%3E");
--vp-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/g%3E%3C/svg%3E");
/* clipboard-copy */
--vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='m9 14 2 2 4-4'/%3E%3C/svg%3E");
--vp-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M16 4h2a2 2 0 0 1 2 2v4m1 4H11'/%3E%3Cpath d='m15 10l-4 4l4 4'/%3E%3C/g%3E%3C/svg%3E");
}

@ -2,6 +2,7 @@ import path from 'node:path'
import c from 'picocolors'
import {
mergeConfig,
normalizePath,
searchForWorkspaceRoot,
type Plugin,
type ResolvedConfig,
@ -16,9 +17,9 @@ import {
resolveAliases
} from './alias'
import {
isAdditionalConfigFile,
resolvePages,
resolveUserConfig,
isAdditionalConfigFile,
type SiteConfig
} from './config'
import { disposeMdItInstance } from './markdown/markdown'
@ -42,6 +43,8 @@ declare module 'vite' {
}
const themeRE = /\/\.vitepress\/theme\/index\.(m|c)?(j|t)s$/
const docsearchRE = /\/@docsearch\/css\/dist\/style.css(?:$|\?)/
const hashRE = /\.([-\w]+)\.js$/
const staticInjectMarkerRE = /\bcreateStaticVNode\((?:(".*")|('.*')), (\d+)\)/g
const staticStripRE = /['"`]__VP_STATIC_START__[^]*?__VP_STATIC_END__['"`]/g
@ -190,9 +193,13 @@ export async function createVitePressPlugin(
},
async transform(code, id) {
if (docsearchRE.test(normalizePath(id))) {
return code.replaceAll('[data-theme=dark]', '.dark')
}
if (id.endsWith('.vue')) {
return processClientJS(code, id)
} else if (id.endsWith('.md')) {
}
if (id.endsWith('.md')) {
// transform .md files into vueSrc so plugin-vue can handle it
const { vueSrc, deadLinks, includes, pageData } = await markdownToVue(
code,

@ -8,6 +8,7 @@ export interface DocSearchProps {
initialQuery?: string
insights?: boolean
translations?: DocSearchTranslations
askAi?: DocSearchAskAi | string
}
export interface SearchOptions {
@ -101,25 +102,35 @@ export interface ModalTranslations extends ScreenStateTranslations {
export interface ScreenStateTranslations {
errorScreen?: ErrorScreenTranslations
startScreen?: StartScreenTranslations
resultsScreen?: ResultsScreenTranslations
noResultsScreen?: NoResultsScreenTranslations
askAiScreen?: AskAiScreenTranslations
}
export interface SearchBoxTranslations {
resetButtonTitle?: string
resetButtonAriaLabel?: string
cancelButtonText?: string
cancelButtonAriaLabel?: string
clearButtonTitle?: string
clearButtonAriaLabel?: string
closeButtonText?: string
closeButtonAriaLabel?: string
placeholderText?: string
placeholderTextAskAi?: string
searchInputLabel?: string
placeholderTextAskAiStreaming?: string
backToKeywordSearchButtonText?: string
backToKeywordSearchButtonAriaLabel?: string
}
export interface FooterTranslations {
selectText?: string
submitQuestionText?: string
selectKeyAriaLabel?: string
navigateText?: string
navigateUpKeyAriaLabel?: string
backToSearchText?: string
navigateDownKeyAriaLabel?: string
closeText?: string
closeKeyAriaLabel?: string
searchByText?: string
poweredByText?: string
}
export interface ErrorScreenTranslations {
@ -134,6 +145,12 @@ export interface StartScreenTranslations {
removeRecentSearchButtonTitle?: string
favoriteSearchesTitle?: string
removeFavoriteSearchButtonTitle?: string
recentConversationsTitle?: string
removeRecentConversationButtonTitle?: string
}
export interface ResultsScreenTranslations {
askAiPlaceholder?: string
}
export interface NoResultsScreenTranslations {
@ -142,3 +159,47 @@ export interface NoResultsScreenTranslations {
reportMissingResultsText?: string
reportMissingResultsLinkText?: string
}
export interface AskAiScreenTranslations {
disclaimerText?: string
relatedSourcesText?: string
thinkingText?: string
copyButtonText?: string
copyButtonCopiedText?: string
copyButtonTitle?: string
likeButtonTitle?: string
dislikeButtonTitle?: string
thanksForFeedbackText?: string
preToolCallText?: string
duringToolCallText?: string
afterToolCallText?: string
aggregatedToolCallText?: string
}
export interface DocSearchAskAi {
/**
* The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
* If not provided, the index name will be used.
*/
indexName?: string
/**
* The API key to use for the ask AI feature. Your assistant will use this API key to search the index.
* If not provided, the API key will be used.
*/
apiKey?: string
/**
* The app ID to use for the ask AI feature. Your assistant will use this app ID to search the index.
* If not provided, the app ID will be used.
*/
appId?: string
/**
* The assistant ID to use for the ask AI feature.
*/
assistantId: string | null
/**
* The search parameters to use for the ask AI feature.
*/
searchParameters?: {
facetFilters?: SearchOptions['facetFilters']
}
}

Loading…
Cancel
Save