mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-02 18:39:47 +00:00
Handle the special case where today's bias was deleted and must be regenerated
This commit is contained in:
parent
9265a53266
commit
0769f04cdb
@ -117,19 +117,25 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore
|
|||||||
|
|
||||||
private async Task TellBias()
|
private async Task TellBias()
|
||||||
{
|
{
|
||||||
|
bool useDrawnBias = false;
|
||||||
if(this.SettingsManager.ConfigurationData.BiasOfTheDay.RestrictOneBiasPerDay)
|
if(this.SettingsManager.ConfigurationData.BiasOfTheDay.RestrictOneBiasPerDay)
|
||||||
{
|
{
|
||||||
if(this.SettingsManager.ConfigurationData.BiasOfTheDay.DateLastBiasDrawn == DateOnly.FromDateTime(DateTime.Now))
|
if(this.SettingsManager.ConfigurationData.BiasOfTheDay.DateLastBiasDrawn == DateOnly.FromDateTime(DateTime.Now))
|
||||||
{
|
{
|
||||||
MessageBus.INSTANCE.DeferMessage(this, Event.LOAD_CHAT,
|
var biasChat = new LoadChat
|
||||||
new LoadChat
|
{
|
||||||
{
|
WorkspaceId = Workspaces.WORKSPACE_ID_BIAS,
|
||||||
WorkspaceId = Workspaces.WORKSPACE_ID_BIAS,
|
ChatId = this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId,
|
||||||
ChatId = this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId,
|
};
|
||||||
});
|
|
||||||
|
if (Workspaces.IsChatExisting(biasChat))
|
||||||
this.NavigationManager.NavigateTo(Routes.CHAT);
|
{
|
||||||
return;
|
MessageBus.INSTANCE.DeferMessage(this, Event.LOAD_CHAT, biasChat);
|
||||||
|
this.NavigationManager.NavigateTo(Routes.CHAT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
useDrawnBias = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +143,10 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore
|
|||||||
if (!this.inputIsValid)
|
if (!this.inputIsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.biasOfTheDay = BiasCatalog.GetRandomBias(this.SettingsManager.ConfigurationData.BiasOfTheDay.UsedBias);
|
this.biasOfTheDay = useDrawnBias ?
|
||||||
|
BiasCatalog.ALL_BIAS[this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayId] :
|
||||||
|
BiasCatalog.GetRandomBias(this.SettingsManager.ConfigurationData.BiasOfTheDay.UsedBias);
|
||||||
|
|
||||||
var chatId = this.CreateChatThread(Workspaces.WORKSPACE_ID_BIAS, this.biasOfTheDay.Name);
|
var chatId = this.CreateChatThread(Workspaces.WORKSPACE_ID_BIAS, this.biasOfTheDay.Name);
|
||||||
this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayId = this.biasOfTheDay.Id;
|
this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayId = this.biasOfTheDay.Id;
|
||||||
this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId = chatId;
|
this.SettingsManager.ConfigurationData.BiasOfTheDay.BiasOfTheDayChatId = chatId;
|
||||||
|
Loading…
Reference in New Issue
Block a user