/**
 * Enumeration of error codes for Server-Sent Events (SSE) related to generated answers.
 */
export var GeneratedAnswerSseErrorCode;
(function (GeneratedAnswerSseErrorCode) {
    GeneratedAnswerSseErrorCode[GeneratedAnswerSseErrorCode["SseMaxDurationExceeded"] = 1000] = "SseMaxDurationExceeded";
    GeneratedAnswerSseErrorCode[GeneratedAnswerSseErrorCode["SseFollowUpNotSupported"] = 1001] = "SseFollowUpNotSupported";
    GeneratedAnswerSseErrorCode[GeneratedAnswerSseErrorCode["ConversationNotFound"] = 1002] = "ConversationNotFound";
    GeneratedAnswerSseErrorCode[GeneratedAnswerSseErrorCode["SseModelsNotAvailable"] = 1003] = "SseModelsNotAvailable";
    GeneratedAnswerSseErrorCode[GeneratedAnswerSseErrorCode["SseInternalError"] = 1004] = "SseInternalError";
})(GeneratedAnswerSseErrorCode || (GeneratedAnswerSseErrorCode = {}));
const generatedAnswerSseErrorMap = {
    'KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED': GeneratedAnswerSseErrorCode.SseMaxDurationExceeded,
    'KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED': GeneratedAnswerSseErrorCode.SseFollowUpNotSupported,
    'KNOWLEDGE:NOT_FOUND': GeneratedAnswerSseErrorCode.ConversationNotFound,
    'KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE': GeneratedAnswerSseErrorCode.SseModelsNotAvailable,
    'KNOWLEDGE:SSE_INTERNAL_ERROR': GeneratedAnswerSseErrorCode.SseInternalError,
};
/**
 * Maps backend error codes to frontend error codes for generated answer SSE errors.
 */
export function mapRunErrorCode(code) {
    if (!code)
        return GeneratedAnswerSseErrorCode.SseInternalError;
    return (generatedAnswerSseErrorMap[code] ??
        GeneratedAnswerSseErrorCode.SseInternalError);
}
