Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions apps/docs/src/app/components/docsearch/docsearch.directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { afterNextRender, DestroyRef, Directive, inject } from '@angular/core';
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
import docsearch, { DocSearchInstance, DocSearchProps } from '@docsearch/js';
import type { DocSearchAskAiModalTranslations } from '@docsearch/react';
import { KBQ_WINDOW, KbqThemeService } from '@koobiq/components/core';
import { combineLatest } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
Expand Down Expand Up @@ -29,7 +30,11 @@ type DeepRequired<T> = T extends AnyFunction
}
: T;

const TRANSLATION_RU: DeepRequired<NonNullable<DocSearchProps['translations']>> = {
type DocSearchTranslations = Omit<NonNullable<DocSearchProps['translations']>, 'modal'> & {
modal?: DocSearchAskAiModalTranslations;
};

const TRANSLATION_RU: DeepRequired<DocSearchTranslations> = {
button: {
buttonText: 'Поиск',
buttonAriaLabel: 'Поиск'
Expand Down Expand Up @@ -84,6 +89,14 @@ const TRANSLATION_RU: DeepRequired<NonNullable<DocSearchProps['translations']>>
closeKeyAriaLabel: 'Клавиша Escape',
poweredByText: 'Работает на'
},
facets: {
defaultValueLabel: 'Все',
facetMenuTriggerAriaLabel: 'выбрано',
clearAllLabel: 'Очистить все',
facetsAriaLabel: 'Фильтры поиска',
selectedFacetsAriaLabel: 'Выбранные фильтры поиска',
clearFacetAriaLabel: 'Очистить фильтр:'
},
noResultsScreen: {
noResultsText: 'Нет результатов для',
suggestedQueryText: 'Попробуйте поискать',
Expand All @@ -92,29 +105,49 @@ const TRANSLATION_RU: DeepRequired<NonNullable<DocSearchProps['translations']>>
},
resultsScreen: {
askAiPlaceholder: 'Спросить ИИ-ассистента:',
noResultsAskAiPlaceholder: 'Спросить ИИ-ассистента вместо этого:'
noResultsAskAiPlaceholder: 'Спросить ИИ-ассистента вместо этого:',
resultsSectionTitle: 'Результаты поиска',
askAiResultsTitle: 'ИИ-ассистент',
resultBadgeLabelText: 'Категория',
recentConversationTimestampFallback: 'Некоторое время назад'
},
askAiScreen: {
disclaimerText: 'Ответы ИИ-ассистента могут быть неточными. Проверяйте важную информацию.',
relatedSourcesText: 'Источники',
relatedSourcesText: 'Источник',
relatedSourcesTextPlural: 'Источники',
suggestedPromptsTitleText: 'Возможные вопросы',
thinkingText: 'Думаю…',
copyButtonText: 'Копировать',
copyButtonCopiedText: 'Скопировано',
copyButtonTitle: 'Копировать ответ',
likeButtonTitle: 'Полезный ответ',
dislikeButtonTitle: 'Бесполезный ответ',
thanksForFeedbackText: 'Спасибо за отзыв!',
feedbackPanelTitle: 'Что было не так? (необязательно)',
feedbackDetailsPlaceholder: 'Добавьте подробности…',
feedbackDisclaimerText: 'Не указывайте персональные данные.',
feedbackSubmitButtonText: 'Отправить',
feedbackCloseButtonTitle: 'Закрыть',
feedbackTagIncorrect: 'Неверный или неполный ответ',
feedbackTagNotWhatIAsked: 'Ответ не на мой вопрос',
feedbackTagSlowOrBuggy: 'Медленная работа или ошибка',
feedbackTagStyleOrTone: 'Стиль или тон ответа',
feedbackTagSafetyOrLegal: 'Безопасность или юридические риски',
feedbackTagOther: 'Другое',
preToolCallText: 'Ищу',
duringToolCallText: 'Ищу',
afterToolCallText: 'Найдено по запросу',
savedMemoryToolResultText: 'Сохранено в память',
memoryToolResultText: 'Использована память',
stoppedStreamingText: 'Генерация ответа остановлена',
errorTitleText: 'Не удалось получить ответ',
threadDepthExceededMessage: 'Диалог завершён для сохранения точности ответов.',
startNewConversationButtonText: 'Начать новый диалог'
}
}
};

const TRANSLATIONS: Record<DocsLocale, DocSearchProps['translations']> = {
const TRANSLATIONS: Record<DocsLocale, DocSearchTranslations> = {
[DocsLocale.Ru]: TRANSLATION_RU,
[DocsLocale.En]: {}
};
Expand Down Expand Up @@ -175,8 +208,7 @@ export class DocsDocsearchDirective extends DocsLocaleState {
transformItems: this.transformItems,
translations: TRANSLATIONS[locale],
askAi: {
assistantId: 'f6ddad78-2e0d-4f11-8cf0-d7e34c354d0e',
agentStudio: true
agentId: 'f6ddad78-2e0d-4f11-8cf0-d7e34c354d0e'
}
});
});
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"@angular/core": "20.3.29",
"@angular/forms": "20.3.29",
"@angular/platform-browser": "20.3.29",
"@docsearch/css": "^4.7.0",
"@docsearch/js": "^4.7.0",
"@docsearch/css": "^5.0.3",
"@docsearch/js": "^5.0.3",
"@fontsource/inter": "^5.2.8",
"@fontsource/jetbrains-mono": "^5.2.6",
"@koobiq/ag-grid-angular-theme": "^34.5.1",
Expand Down Expand Up @@ -64,6 +64,7 @@
"@commitlint/cli": "^21.2.2",
"@commitlint/config-conventional": "^21.2.2",
"@cspell/dict-ru_ru": "^2.3.2",
"@docsearch/react": "^5.0.3",
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
"@eslint/js": "^9.39.5",
"@koobiq/design-tokens": "^3.19.0",
Expand Down
Loading