diff --git a/addons/im_livechat/static/src/embed/common/chatbot/chatbot_service.js b/addons/im_livechat/static/src/embed/common/chatbot/chatbot_service.js index b28ea00ed7e..b6009e72331 100644 --- a/addons/im_livechat/static/src/embed/common/chatbot/chatbot_service.js +++ b/addons/im_livechat/static/src/embed/common/chatbot/chatbot_service.js @@ -122,11 +122,19 @@ export class ChatBotService { localStorage.removeItem( `im_livechat.chatbot.state.uuid_${this.livechatService.thread.uuid}` ); - const message = await this.rpc("/chatbot/restart", { - channel_uuid: this.livechatService.thread.uuid, - chatbot_script_id: this.chatbot.scriptId, - }); - this.livechatService.thread?.messages.push({ ...message, body: markup(message.body) }); + const message = this.store.Message.insert( + await this.rpc("/chatbot/restart", { + channel_uuid: this.livechatService.thread.uuid, + chatbot_script_id: this.chatbot.scriptId, + }), + { html: true } + ); + if (!this.livechatService.thread) { + return; + } + if (message.notIn(this.livechatService.thread.messages)) { + this.livechatService.thread.messages.push(message); + } this.currentStep = null; this.start(); }