UIContextType -> AiActionType
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using BS.Shared;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.XtraPrinting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -19,12 +22,15 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
set => SetProperty(ref currentValue, value, nameof(CurrentValue));
|
||||
}
|
||||
|
||||
public override bool IsHistoryEnabled => true;
|
||||
|
||||
public bool IsUndoButtonVisible => CurrentIndex > 0;
|
||||
public bool IsRedoButtonVisible => CurrentIndex < History.Count - 1;
|
||||
|
||||
public override bool IsHistoryEnabled => true;
|
||||
public DelegateCommand UndoAiActionCommand { get; protected set; }
|
||||
public DelegateCommand RedoAiActionCommand { get; protected set; }
|
||||
|
||||
public AiChatButtonWithHistoryViewModel() : base()
|
||||
public AiChatButtonWithHistoryViewModel(AiActionType aiActionType) : base(aiActionType)
|
||||
{
|
||||
History = new List<string>();
|
||||
CurrentIndex = 0;
|
||||
@@ -32,17 +38,19 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
{
|
||||
new AiMenuItemTemplate()
|
||||
{
|
||||
Command = new DevExpress.Mvvm.DelegateCommand<AiConversationMessageVM>(x => Accept1(x.Message)),
|
||||
Command = new DelegateCommand<AiConversationMessageVM>(x => AddValue(x.Message)),
|
||||
Icon = null,
|
||||
Name = "Akzeptieren"
|
||||
Name = "Anfügen"
|
||||
},
|
||||
new AiMenuItemTemplate()
|
||||
{
|
||||
Command = new DevExpress.Mvvm.DelegateCommand<AiConversationMessageVM>(x => Accept2(x.Message)),
|
||||
Command = new DelegateCommand<AiConversationMessageVM>(x => ReplaceValue(x.Message)),
|
||||
Icon = null,
|
||||
Name = "Ersetzen"
|
||||
},
|
||||
};
|
||||
UndoAiActionCommand= new DelegateCommand(UndoAiAction);
|
||||
RedoAiActionCommand= new DelegateCommand(RedoAiAction);
|
||||
}
|
||||
|
||||
public void ClearHistory()
|
||||
@@ -97,14 +105,24 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
CurrentValue = History[CurrentIndex];
|
||||
}
|
||||
|
||||
public void Accept1(string s)
|
||||
public void AddValue(string s)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("Antwort:");
|
||||
sb.AppendLine(s);
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Original:");
|
||||
sb.AppendLine(CurrentValue);
|
||||
|
||||
var str = sb.ToString();
|
||||
|
||||
Accept(str);
|
||||
}
|
||||
|
||||
public void Accept2(string s)
|
||||
public void ReplaceValue(string str)
|
||||
{
|
||||
|
||||
Accept(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user