@redocly/theme
Version:
Shared UI components lib
40 lines (36 loc) • 1.56 kB
text/typescript
import type { AiSearchErrorConfig } from '@redocly/theme/core/types';
export enum AiSearchError {
Unauthorized = 'ai_search_unauthorized',
Forbidden = 'ai_search_forbidden',
HttpRequestFailed = 'http_request_in_failed_status',
EmptyResponse = 'empty_response',
ErrorProcessingResponse = 'error_processing_response',
}
export const enum AiSearchConversationRole {
USER = 'user',
ASSISTANT = 'assistant',
}
const defaultErrorConfig: AiSearchErrorConfig = {
headerKey: 'search.ai.error.header',
headerDefault: 'Oops! Something went wrong.',
messageKey: 'search.ai.error.description',
messageDefault:
'We encountered an issue while processing your search. Try again later or refine your query. If the problem persists, please contact Redocly support.',
};
export const AI_SEARCH_ERROR_CONFIG: Record<AiSearchError, AiSearchErrorConfig> = {
[]: {
headerKey: 'search.ai.error.header.forbidden',
headerDefault: 'Feature Unavailable',
messageKey: 'search.ai.error.description.forbidden',
messageDefault: 'AI Search is currently unavailable.',
},
[]: {
headerKey: 'search.ai.error.header.unauthorized',
headerDefault: 'Authentication Required',
messageKey: 'search.ai.error.description.unauthorized',
messageDefault: 'You are not authorized to use AI Search.',
},
[]: defaultErrorConfig,
[]: defaultErrorConfig,
[]: defaultErrorConfig,
} as const;