From 0c8a412fc95ea5207b1397dee7e3b3e30e1d4903 Mon Sep 17 00:00:00 2001 From: boyantonchev Date: Mon, 7 Oct 2024 11:51:11 +0300 Subject: [PATCH] Expose reset function --- .../angular/ttyg/directives/chat-panel.directive.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/angular/ttyg/directives/chat-panel.directive.js b/src/js/angular/ttyg/directives/chat-panel.directive.js index 7b73b29d0..901d47418 100644 --- a/src/js/angular/ttyg/directives/chat-panel.directive.js +++ b/src/js/angular/ttyg/directives/chat-panel.directive.js @@ -169,7 +169,7 @@ function ChatPanelComponent(toastr, $translate, TTYGContextService) { const onChatDeleted = (deletedChat) => { if ($scope.chat && deletedChat.id === $scope.chat.id) { - init(null); + reset(); } }; @@ -200,14 +200,19 @@ function ChatPanelComponent(toastr, $translate, TTYGContextService) { }); }; - const init = (chat) => { - $scope.chat = chat; + const reset = () => { + $scope.chat = undefined; $scope.loadingChat = false; $scope.chatItem = getEmptyChatItem(); $scope.askingChatItem = undefined; focusQuestionInput(); }; + const init = () => { + $scope.chatItem = getEmptyChatItem(); + focusQuestionInput(); + }; + // ========================= // Subscriptions // =========================