mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-11 13:33:48 +00:00
Personal Code Review
This commit is contained in:
1 parent
601fe727ba
commit
34774531fd
11 files changed
+95
-15
No files matched your search
@@ -27,7 +27,7 @@
|
||||
RegenerateFunc="@this.RegenerateBlock"
|
||||
RegenerateEnabled="@(() => this.IsProviderSelected && this.ChatThread.IsLLMProviderAllowed(this.Provider))"
|
||||
RollbackFunc="@this.RollbackBlock"
|
||||
RollbackEnabled="@(!this.IsCurrentChatStreaming)"
|
||||
RollbackEnabled="@(() => !this.IsCurrentChatStreaming)"
|
||||
EditLastBlockFunc="@this.EditLastBlock"
|
||||
EditLastUserBlockFunc="@this.EditLastUserBlock"/>
|
||||
}
|
||||
|
||||
@@ -1403,6 +1403,16 @@ public partial class ChatComponent : MSGComponentBase
|
||||
if (!this.ChatThread.RemoveBlocksAfter(aiBlock))
|
||||
return;
|
||||
|
||||
//
|
||||
// Only the working state of the next turn is reset here: the augmented data and the
|
||||
// AI-selected data sources are rebuilt by the RAG process anyway, so carrying the ones of a
|
||||
// removed message over would just put stale context into the system prompt.
|
||||
//
|
||||
// What stays is everything the thread ratchets for security reasons, namely DataSecurity and
|
||||
// RequiredProviderConfidence. Both only ever tighten, because the data which raised them was
|
||||
// seen by this thread. Removing the message that brought it in does not unsee it, so the
|
||||
// chat keeps demanding the same of every provider which continues it.
|
||||
//
|
||||
this.ChatThread.AugmentedData = string.Empty;
|
||||
this.ChatThread.AISelectedDataSources = [];
|
||||
this.dataSourceSelectionComponent?.ChangeOptionWithoutSaving(this.ChatThread.DataSourceOptions, this.ChatThread.AISelectedDataSources);
|
||||
|
||||
@@ -152,4 +152,4 @@ else
|
||||
}
|
||||
</ItemTemplate>
|
||||
</MudTreeView>
|
||||
}
|
||||
}
|
||||
@@ -791,11 +791,25 @@ public partial class Workspaces : MSGComponentBase
|
||||
if (this.AIJobService.IsChatGenerationActive(chat.ChatId) || this.MediaTranscriptionService.IsBusy(mediaOwner))
|
||||
return;
|
||||
|
||||
//
|
||||
// Copying the chat which is open right now takes its in-memory state, so whatever the user
|
||||
// has not saved yet ends up in the copy while the original keeps the state it was stored
|
||||
// with. Copying any other chat replaces the open one, so its unsaved changes are gone.
|
||||
// Both outcomes are surprising enough to deserve their own wording.
|
||||
//
|
||||
var openChat = this.CurrentChatThread;
|
||||
var isCopyOfOpenChat = openChat is not null && openChat.ChatId == chat.ChatId;
|
||||
if (await MessageBus.INSTANCE.SendMessageUseFirstResult<bool, bool>(this, Event.HAS_CHAT_UNSAVED_CHANGES))
|
||||
{
|
||||
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||
{
|
||||
{ x => x.Message, T("Are you sure you want to load another chat? All unsaved changes will be lost.") },
|
||||
{
|
||||
x => x.Message, isCopyOfOpenChat switch
|
||||
{
|
||||
true => T("Do you want to copy this chat? Your unsaved changes move into the copy, and the original chat keeps the state it was last saved with."),
|
||||
false => T("Do you want to copy this chat? The copy is opened afterwards, so all unsaved changes of the chat you have open right now will be lost."),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Copy Chat"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
@@ -804,7 +818,7 @@ public partial class Workspaces : MSGComponentBase
|
||||
return;
|
||||
}
|
||||
|
||||
var sourceChat = this.CurrentChatThread is { } currentChat && currentChat.ChatId == chat.ChatId ? currentChat : chat;
|
||||
var sourceChat = isCopyOfOpenChat ? openChat! : chat;
|
||||
var copy = await WorkspaceBehaviour.CopyChatAsync(sourceChat);
|
||||
|
||||
await this.LoadTreeItemsAsync(startPrefetch: false);
|
||||
|
||||
Reference in new issue
Block a user