Remove clone feature

This commit is contained in:
2026-07-31 11:34:33 +02:00
parent c87d7043ef
commit d2f46ef5b4
10 changed files with 1 additions and 297 deletions

View File

@@ -104,10 +104,6 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.AiRoutineType))]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversationWithMessage(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, BS.Shared.DataContracts.Feature.AI.AiViewContextDC view_context, string message);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CloneAiConversation", ReplyAction="http://tempuri.org/IAiEnhancedService/CloneAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CloneAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CloneAiConversation(long conversation_oid, System.Nullable<long> message_oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/UpdateAiConversationDisplayname", ReplyAction="http://tempuri.org/IAiEnhancedService/UpdateAiConversationDisplaynameResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/UpdateAiConversationDisplaynameBeWoFaultFau" +
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -344,11 +340,6 @@ namespace BeWo.ServiceProxy
return base.Channel.CreateAiConversationWithMessage(conversation, view_context, message);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CloneAiConversation(long conversation_oid, System.Nullable<long> message_oid)
{
return base.Channel.CloneAiConversation(conversation_oid, message_oid);
}
public long UpdateAiConversationDisplayname(long oid, long version, string displayname)
{
return base.Channel.UpdateAiConversationDisplayname(oid, version, displayname);

View File

@@ -548,37 +548,9 @@ ToolTip="Kopieren">
</Grid>
</DataTemplate>
<DataTemplate x:Key="CheckboxAssistentMessageTemplate">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox
Margin="4"
VerticalAlignment="Center"
IsChecked="{Binding IsChecked, Mode=TwoWay}" />
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource AssistentMessageTemplate}" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="CheckboxUserMessageTemplate">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox
Margin="4"
VerticalAlignment="Center"
IsChecked="{Binding IsChecked}" />
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource UserMessageTemplate}" />
</StackPanel>
</DataTemplate>
<templateselectors:AiConversationMessageTemplateSelector
x:Key="AiConversationMessageTemplateSelector"
AssistentMessageTemplate="{StaticResource AssistentMessageTemplate}"
SystemMessageTemplate="{StaticResource SystemMessageTemplate}"
UserMessageTemplate="{StaticResource UserMessageTemplate}" />
<templateselectors:AiConversationMessageTemplateSelector
x:Key="AiConversationCloneMessageTemplateSelector"
AssistentMessageTemplate="{StaticResource CheckboxAssistentMessageTemplate}"
SystemMessageTemplate="{StaticResource SystemMessageTemplate}"
UserMessageTemplate="{StaticResource UserMessageTemplate}" />
</ResourceDictionary>

View File

@@ -489,11 +489,6 @@
Margin="4,0,0,0"
Command="{Binding RenameCommand}"
Content="Umbennen" />
<Button
x:Name="btnClone"
Margin="4,0,0,0"
Command="{Binding OpenCloneCommand}"
Content="Klonen" />
<Button
x:Name="btnDelete"
Margin="4,0,0,0"
@@ -576,65 +571,6 @@
ItemsSource="{Binding Models}"
SelectedItem="{Binding Config.SelectedModel, Mode=TwoWay}" />
</Grid>-->
</Popup>
<Popup
x:Name="popup_conversation_clone"
IsOpen="{Binding IsCloneOpen}"
Loaded="popup_conversation_clone_Loaded"
Placement="Center"
StaysOpen="False">
<Border
Width="400"
Height="600"
Padding="0"
Background="{DynamicResource NavigationContentBrush}"
BorderThickness="1"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<ListView
x:Name="listbox_messages_clone"
Padding="3"
Background="Transparent"
BorderThickness="0"
Hyperlink.RequestNavigate="Hyperlink_RequestNavigate"
ItemTemplateSelector="{StaticResource AiConversationCloneMessageTemplateSelector}"
ItemsSource="{Binding ListVM.SelectedVM.Messages.VMList, UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.CanContentScroll="False"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="4" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<ContentPresenter Margin="{TemplateBinding Padding}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
<Button
Grid.Row="1"
Margin="8,4,8,8"
Command="{Binding CloneCommand}">
Klonen
</Button>
</Grid>
</Border>
<!-- AiConversationCloneMessageTemplateSelector -->
</Popup>
<Popup
x:Name="popup_message_save"

View File

@@ -86,11 +86,6 @@ namespace BeWo.View.Detail.AI
Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => BeWoWpfUtils.ScrollToBottom(listview_messages)));
}
private void popup_conversation_clone_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => BeWoWpfUtils.ScrollToBottom(listbox_messages_clone)));
}
private void Grid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)

View File

@@ -8,7 +8,6 @@ namespace BeWo.ViewModel
{
public class AiConversationMessageVM : AbstractDCMapperVM<AiConversationMessageDC>
{
private bool _IsChecked;
private string _Message;
public AiConversationMessageVM(AiConversationMessageDC dc) : base(dc, dc.Oid is null)
@@ -16,22 +15,6 @@ namespace BeWo.ViewModel
}
public event EventHandler IsCheckedChanged;
public bool IsChecked
{
get { return _IsChecked; }
set
{
if (!AreDifferent(IsChecked, value))
return;
_IsChecked = value;
FirePropertyChanged(nameof(IsChecked));
IsCheckedChanged?.Invoke(this, EventArgs.Empty);
}
}
public string Message
{
get { return _Message; }
@@ -88,11 +71,5 @@ namespace BeWo.ViewModel
return pDataContract;
}
public void SetIsChecked(bool value)
{
_IsChecked = value;
FirePropertyChanged(nameof(IsChecked));
}
}
}

View File

@@ -20,67 +20,7 @@ namespace BeWo.ViewModel.ListViewModel
{
public AiConversationMessageListVM(List<AiConversationMessageDC> pDCs) : base(pDCs)
{
foreach(var vm in VMList)
{
vm.IsCheckedChanged += CloneIsCheckedChanged;
}
//VMList.ListChanged += (s, e) =>
// {
// if (e.ListChangedType == ListChangedType.ItemChanged)
// {
// var changedItem = VMList[e.NewIndex];
// Item_PropertyChanged(changedItem, new PropertyChangedEventArgs(nameof(AiConversationMessageVM.IsChecked)));
// }
// };
}
public AiConversationMessageListVM() : this(null) { }
private void CloneIsCheckedChanged(object sender, EventArgs e)
{
if(sender is AiConversationMessageVM vm)
{
int index = VMList.IndexOf(vm);
if (vm.IsChecked)
{
for (int i = 0; i < index; i++)
{
VMList[i].SetIsChecked(true);
}
}
else
{
for (int i = index - 1; i < VMList.Count; i++)
{
VMList[i].SetIsChecked(false);
}
}
}
}
//private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
//{
// if (e.PropertyName == nameof(AiConversationMessageVM.IsChecked)
// && sender is AiConversationMessageVM vm
// && vm.Role == BS.Shared.AiConversationMessageRole.Assistent)
// {
// var changedItem = (AiConversationMessageVM)sender;
// int index = VMList.IndexOf(changedItem);
// if (changedItem.IsChecked)
// {
// for (int i = 0; i <= index; i++)
// if (!VMList[i].IsChecked)
// VMList[i].IsChecked = true;
// }
// else
// {
// for (int i = index - 1; i < VMList.Count; i++)
// if (VMList[i].IsChecked)
// VMList[i].IsChecked = false;
// }
// }
//}
}
}

View File

@@ -26,7 +26,6 @@ namespace BeWo.ViewModel.View.AI
public class AiConversationChatViewModel : DialogViewModel
{
private bool _IsSettingsOpen;
private bool _IsCloneOpen;
private bool _IsSending;
private string _MessageInput;
@@ -50,8 +49,6 @@ namespace BeWo.ViewModel.View.AI
OpenSettingCommand = new DelegateCommand(OpenSetting, () => BeWoApp.AppSettings?.ModuleAiSettingsEnabled ?? false);
RenameCommand = new DelegateCommand(Rename, () => ListVM.SelectedVM is object);
OpenCloneCommand = new DelegateCommand(OpenClone, () => ListVM.SelectedVM is object && BeWoAppInfo.IsInAiDeveloperMode);
CloneCommand = new DelegateCommand(Clone);
AskDeleteCommand = new DelegateCommand(AskDelete, () => ListVM.SelectedVM is object);
@@ -79,8 +76,6 @@ namespace BeWo.ViewModel.View.AI
public ICommand OpenSettingCommand { get; set; }
public ICommand RenameCommand { get; set; }
public ICommand OpenCloneCommand { get; set; }
public ICommand CloneCommand { get; set; }
public ICommand SavePromptCommand { get; set; }
public ICommand AcceptSavePromptCommand { get; set; }
@@ -145,15 +140,6 @@ namespace BeWo.ViewModel.View.AI
FirePropertyChanged(nameof(IsSettingsOpen));
}
}
public bool IsCloneOpen
{
get => _IsCloneOpen;
set
{
_IsCloneOpen = value;
FirePropertyChanged(nameof(IsCloneOpen));
}
}
public bool IsSending
{
get => _IsSending;
@@ -401,42 +387,6 @@ namespace BeWo.ViewModel.View.AI
vm.IsEditing = !vm.IsEditing;
}
}
private void OpenClone()
{
foreach (var message in ListVM.SelectedVM.Messages.VMList)
{
message.SetIsChecked(true);
}
IsCloneOpen = true;
}
private void Clone()
{
var conv = ListVM.SelectedVM;
AiConversationMessageVM last = null;
foreach (var msg in conv.Messages.VMList)
{
if (!msg.IsChecked)
break;
last = msg;
}
var conv_oid = conv.DataContract.Oid.Value;
var msg_oid = last?.DataContract.Oid;
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CloneAiConversation(conv_oid, msg_oid), dc =>
{
InsertConverstion(dc);
CloseClone();
});
}
private void CloseClone()
{
IsCloneOpen = false;
}
public void AskDelete()
{
var selected = ListVM.SelectedVM;

View File

@@ -175,55 +175,6 @@ namespace BeWo.Service.Plugins
// return conv_dc;
//}
public virtual AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
{
var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid);
if (parent_conv is null)
throw new InvalidOperationException("conv_oid unknown");
var clone_conv = new AiConversation();
clone_conv.Created = DateTime.Now;
clone_conv.ContextBeWoObjects = parent_conv.ContextBeWoObjects.ToList();
clone_conv.Displayname = "Klon von " + parent_conv.Displayname;
clone_conv.Messages = new List<AiConversationMessage>();
clone_conv.Modell = parent_conv.Modell;
clone_conv.ActionType = parent_conv.ActionType;
clone_conv.Updated = DateTime.Now;
clone_conv.ApplicationUserOid = parent_conv.ApplicationUserOid;
if (last_message_oid is null)
last_message_oid = parent_conv.Messages[0].Oid;
foreach (var msg in parent_conv.Messages)
{
var clone_msg = new AiConversationMessage();
clone_msg.Created = msg.Created;
clone_msg.Message = msg.Message;
clone_msg.Role = msg.Role;
clone_msg.Duration = msg.Duration;
clone_msg.ModelName = msg.ModelName;
clone_msg.ShowMessage = msg.ShowMessage;
clone_msg.UsedPromptbausteinTitle = msg.UsedPromptbausteinTitle;
clone_msg.UsedPromptbaustein = msg.UsedPromptbaustein;
clone_msg.StepCount = msg.StepCount;
clone_conv.Messages.Add(clone_msg);
clone_msg.AiConversation = clone_conv;
if (msg.Oid == last_message_oid)
break;
}
DAOFactory.GenericDAO.Insert(clone_conv);
var dc = MapperFactory.AiConversation.MapToNewDC(clone_conv);
return dc;
}
public virtual long UpdateAiConversationDisplayname(long oid, long version, string displayname)
{
var conv = DAOFactory.GenericDAO.GetByID<AiConversation>(oid);

View File

@@ -46,11 +46,6 @@ namespace BeWo.Service.ServiceContracts.Enhanced
[OperationContract]
AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
//[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConversationDC CloneAiConversation(long conversation_oid, long? message_oid);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
//[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]

View File

@@ -36,9 +36,6 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message)
=> GetAiService().CreateAiConversationWithMessage(conversation, view_context, message);
public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
=> GetAiService().CloneAiConversation(conversation_oid, last_message_oid);
public long UpdateAiConversationDisplayname(long oid, long version, string displayname)
=> GetAiService().UpdateAiConversationDisplayname(oid, version, displayname);