Skip to content

Commit

Permalink
Expose reset function
Browse files Browse the repository at this point in the history
  • Loading branch information
boyan-tonchev authored and svilenvelikov committed Oct 7, 2024
1 parent 4f75f5a commit 0c8a412
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/js/angular/ttyg/directives/chat-panel.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function ChatPanelComponent(toastr, $translate, TTYGContextService) {

const onChatDeleted = (deletedChat) => {
if ($scope.chat && deletedChat.id === $scope.chat.id) {
init(null);
reset();
}
};

Expand Down Expand Up @@ -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
// =========================
Expand Down

0 comments on commit 0c8a412

Please sign in to comment.