Conversation List Reorder

This commit is contained in:
2026-06-23 11:32:47 +02:00
parent afac63be1a
commit 668449fd16
6 changed files with 59 additions and 10 deletions

View File

@@ -933,8 +933,6 @@ namespace BeWo.ViewModel
{
var list = ServiceFacade.DoAiEnhancedServiceSnyc(s => s.GetAiConversations(actionType, reference_oid));
list.Reverse();
return new AiConversationListVM(list);
}

View File

@@ -307,6 +307,8 @@ namespace BeWo.ViewModel.View.AI
{
MessageInput = string.Empty;
ReloadConversations(ListVM.VMList);
EndSending();
SendNewMessageSuccess?.Invoke(this, EventArgs.Empty);
@@ -357,7 +359,21 @@ namespace BeWo.ViewModel.View.AI
var list = VMFactory.CreateAiConversationListVM(ui_context, reference);
ListVM.VMList.MakeEqualTo(list.VMList);
ReloadConversations(list.VMList);
}
private void ReloadConversations(IEnumerable<AiConversationVM> aiConversations)
{
if(aiConversations is null)
{
throw new ArgumentOutOfRangeException(nameof(aiConversations));
}
var sorted = aiConversations.OrderByDescending(vm => vm.Updated).ToList();
var t0 = ListVM.SelectedVM;
ListVM.VMList.UpdateBy(sorted);
ListVM.SelectedVM = t0;
ListVM.VMList.ResetBindings();
}
private void OpenSetting()
@@ -540,6 +556,8 @@ namespace BeWo.ViewModel.View.AI
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiConversationWithPrompt(cb.Oid.Value, ViewContext, prompt.DataContract.Oid.Value),
cb2 =>
{
vm.Updated = DateTime.Now;
FinishSending();
ServiceFacade.EndManuelWaiting();
@@ -594,8 +612,12 @@ namespace BeWo.ViewModel.View.AI
private void ExecuteChain(AiPromptbausteinRoutineVM routine, int step, Action<Exception> error)
{
var conv = ListVM.SelectedVM;
if (step >= routine.Steps.Count)
{
conv.Updated = DateTime.Now;
FinishSending();
ServiceFacade.EndManuelWaiting();
@@ -603,8 +625,6 @@ namespace BeWo.ViewModel.View.AI
return;
}
var conv = ListVM.SelectedVM;
var custom_viewContext = new AiViewContextDC
{
References = ViewContext.References,