UNPKG

lavva.exalushome

Version:

Library implementing communication and abstraction layers for ExalusHome system

44 lines 1.63 kB
import { ControllerChat } from "./ChatImplementations/ControllerChat/ControllerChat"; import { FamillyChat } from "./ChatImplementations/FamillyChat/FamillyChat"; import { GptChat } from "./ChatImplementations/GptChat/GptChat"; import { ChatType } from "./IChatService"; export class ChatService { constructor() { this._services = { ControllerChat: new ControllerChat(), GptChat: new GptChat(), FamillyChat: new FamillyChat(), }; } GetServiceName() { return ChatService.ServiceName; } GetChatImplementation(chatType) { switch (chatType) { case ChatType.ControllerChat: return this._services.ControllerChat; case ChatType.FamilyChat: return this._services.FamillyChat; case ChatType.GptChat: return this._services.GptChat; default: throw new ChatNotImplementedException(`Chat with type ${chatType} not implemented!`); } } } ChatService.ServiceName = "ChatService"; export var ChatServiceErrorCode; (function (ChatServiceErrorCode) { ChatServiceErrorCode["OtherError"] = "OtherError"; ChatServiceErrorCode["FatalError"] = "FatalError"; ChatServiceErrorCode["Error"] = "Error"; ChatServiceErrorCode["NoData"] = "NoData"; })(ChatServiceErrorCode || (ChatServiceErrorCode = {})); class ChatNotImplementedException extends Error { constructor(message) { super(message); this.message = message; this.name = "ChatNotImplementedException"; } } //# sourceMappingURL=ChatService.js.map