diff --git a/packages/ui-stencil/src/components/orama-chat-box/orama-chat-box.tsx b/packages/ui-stencil/src/components/orama-chat-box/orama-chat-box.tsx index ecc3873d..aa9bd20f 100644 --- a/packages/ui-stencil/src/components/orama-chat-box/orama-chat-box.tsx +++ b/packages/ui-stencil/src/components/orama-chat-box/orama-chat-box.tsx @@ -38,12 +38,7 @@ export class ChatBox { return ( // * Note: only dark theme supported at the moment - + ) } diff --git a/packages/ui-stencil/src/services/ChatService.ts b/packages/ui-stencil/src/services/ChatService.ts index 1fa04a20..c4e6bfc2 100644 --- a/packages/ui-stencil/src/services/ChatService.ts +++ b/packages/ui-stencil/src/services/ChatService.ts @@ -49,22 +49,20 @@ export class ChatService { }) } - // TODO: WE may want to reveive ask props as a Service prop instead of enforcing it here - return this.answerSession.ask({ term: term, related: { howMany: 3, format: 'question' } }) - // TODO: ABORT/ERROR/STOP should emmit onStateChange event. Keeping the lines below as a reference - // .catch((error) => { - // chatContext.interactions = chatContext.interactions.map((interaction, index) => { - // if (index === chatContext.interactions.length - 1) { - // return { - // ...interaction, - // status: TAnswerStatus.error, - // } - // } - // return interaction - // }) - // console.error(error) - // }) + // TODO: WE may want to reveive ask props as a Service prop instead of enforcing it here + return this.answerSession.ask({ term: term, related: { howMany: 3, format: 'question' } }).catch((error) => { + chatContext.interactions = chatContext.interactions.map((interaction, index) => { + if (index === chatContext.interactions.length - 1) { + return { + ...interaction, + status: TAnswerStatus.error, + } + } + return interaction + }) + console.error(error) + }) } abortAnswer = () => {