Add profiles (#132)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-09-08 21:01:51 +02:00
1 parent 00f45f8998
commit d7c124926b
32 files changed
+659 -36

No files matched your search

@@ -55,6 +55,8 @@ public abstract partial class AssistantBase : ComponentBase
private protected virtual RenderFragment? Body => null;
protected virtual bool ShowResult => true;
protected virtual bool AllowProfiles => true;
protected virtual bool ShowDedicatedProgress => false;
@@ -72,6 +74,7 @@ public abstract partial class AssistantBase : ComponentBase
private ContentBlock? resultingContentBlock;
private string[] inputIssues = [];
private bool isProcessing;
private Profile currentProfile = Profile.NO_PROFILE;
#region Overrides of ComponentBase
@@ -79,6 +82,7 @@ public abstract partial class AssistantBase : ComponentBase
{
this.MightPreselectValues();
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
await base.OnInitializedAsync();
}
@@ -118,7 +122,12 @@ public abstract partial class AssistantBase : ComponentBase
ChatId = Guid.NewGuid(),
Name = string.Empty,
Seed = this.RNG.Next(),
SystemPrompt = this.SystemPrompt,
SystemPrompt = !this.AllowProfiles ? this.SystemPrompt :
$"""
{this.SystemPrompt}
{this.currentProfile.ToSystemPrompt()}
""",
Blocks = [],
};
}