5.1.4 viewcontext fix

This commit is contained in:
2026-06-15 12:06:03 +02:00
parent fd7bf5e2bb
commit a5fe8ddc33
2 changed files with 24 additions and 10 deletions

View File

@@ -601,26 +601,40 @@ namespace BeWo.ViewModel.View.AI
return;
}
var msg = routine.Steps.VMList[step].PromptReference.Prompt;
var conv = ListVM.SelectedVM;
var msg_dc = new AiConversationMessageDC();
var custom_viewContext = new AiViewContextDC
{
References = ViewContext.References,
Primary = ViewContext.Primary
};
msg_dc.Message = msg;
msg_dc.Role = BS.Shared.AiConversationMessageRole.User;
msg_dc.Created = DateTime.Now;
if (step > 0 && routine.RoutineType == AiRoutineType.Chain)
{
custom_viewContext.Secondary = conv.Messages.VMList.Last().Message;
}
else
{
custom_viewContext.Secondary = ViewContext.Secondary;
}
var msg = routine.Steps.VMList[step].PromptReference.Prompt;
var msg_dc = new AiConversationMessageDC
{
Message = msg,
Role = AiConversationMessageRole.User,
Created = DateTime.Now
};
var msg_vm = new AiConversationMessageVM(msg_dc);
conv.Messages.VMList.Add(msg_vm);
ServiceFacade.DoAiEnhancedServiceAsnyc(
x => x.ExecuteAiConversationWithRoutine(conv.Oid, ViewContext, routine.DataContract.Oid.Value, step),
x => x.ExecuteAiConversationWithRoutine(conv.Oid, custom_viewContext, routine.DataContract.Oid.Value, step),
cb =>
{
ViewContext.Secondary = cb.Last().Message;
conv.Messages.VMList.Remove(msg_vm);
conv.AddMessages(cb);