diff --git a/BeWo/ViewModel/Controls/AI/AiChatButtonWithHistoryViewModel.cs b/BeWo/ViewModel/Controls/AI/AiChatButtonWithHistoryViewModel.cs index 130cc35f7..df9f859c1 100644 --- a/BeWo/ViewModel/Controls/AI/AiChatButtonWithHistoryViewModel.cs +++ b/BeWo/ViewModel/Controls/AI/AiChatButtonWithHistoryViewModel.cs @@ -70,30 +70,6 @@ namespace BeWo.ViewModel.Controls.AI FirePropertyChanged(nameof(IsUndoButtonVisible)); } - public void Accept(string str) - { - var idx = CurrentIndex; - var count = History.Count; - - var last_idx = count - 1; - - if (last_idx > idx) - { - History.RemoveRange(idx + 1, last_idx - idx); - } - - if (CurrentValue != History[CurrentIndex]) - { - History.Add(CurrentValue); - CurrentIndex++; - } - - History.Add(str); - CurrentIndex++; - - CurrentValue = str; - } - public void UndoAiAction() { if (CurrentIndex <= 0) @@ -124,12 +100,36 @@ namespace BeWo.ViewModel.Controls.AI var str = sb.ToString(); - Accept(str); + accept(str); } public void ReplaceValue(string str) { - Accept(str); + accept(str); + } + + private void accept(string str) + { + var idx = CurrentIndex; + var count = History.Count; + + var last_idx = count - 1; + + if (last_idx > idx) + { + History.RemoveRange(idx + 1, last_idx - idx); + } + + if (CurrentValue != History[CurrentIndex]) + { + History.Add(CurrentValue); + CurrentIndex++; + } + + History.Add(str); + CurrentIndex++; + + CurrentValue = str; } } } diff --git a/BeWo/ViewModel/ListViewModel/ServiceRecordListVM.cs b/BeWo/ViewModel/ListViewModel/ServiceRecordListVM.cs index 447eac4db..5cef86917 100644 --- a/BeWo/ViewModel/ListViewModel/ServiceRecordListVM.cs +++ b/BeWo/ViewModel/ListViewModel/ServiceRecordListVM.cs @@ -182,20 +182,14 @@ namespace BeWo.ViewModel.ListViewModel private void InitAiStuff() { - AiChatButtonConversationViewModel = new AiChatButtonViewModel(AiActionType.ServiceRecordConversation) - { + AiChatButtonConversationViewModel + = new AiChatButtonViewModel(AiActionType.ServiceRecordConversation); - }; + AiChatButtonDocumentationViewModel + = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "docu"); - AiChatButtonDocumentationViewModel = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "docu") - { - - }; - - AiChatButtonDocumentationEditViewModel = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "edit_docu") - { - - }; + AiChatButtonDocumentationEditViewModel + = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation, this, "edit_docu"); } private void InitAiTranscriptionStuff()