mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 22:57:59 +00:00
Refactored property and field casing for consistency (#740)
This commit is contained in:
1 parent
312b3cf79d
commit
8d1d04cb0a
61 files changed
+219
-223
No files matched your search
@@ -52,4 +52,4 @@
|
||||
}
|
||||
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -323,8 +323,8 @@ public partial class AssistantAgenda : AssistantBaseCore<SettingsDialogAgenda>
|
||||
|
||||
private async Task CreateAgenda()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<InnerScrolling>
|
||||
<ChildContent>
|
||||
<MudForm @ref="@(this.form)" @bind-IsValid="@(this.inputIsValid)" @bind-Errors="@(this.inputIssues)" FieldChanged="@this.TriggerFormChange" Class="pr-2">
|
||||
<MudForm @ref="@(this.Form)" @bind-IsValid="@(this.InputIsValid)" @bind-Errors="@(this.inputIssues)" FieldChanged="@this.TriggerFormChange" Class="pr-2">
|
||||
<MudText Typo="Typo.body1" Align="Align.Justify" Class="mb-2">
|
||||
@this.Description
|
||||
</MudText>
|
||||
@@ -41,7 +41,7 @@
|
||||
<MudButton Disabled="@(this.SubmitDisabled || this.isProcessing)" Variant="Variant.Filled" OnClick="@(async () => await this.Start())" Style="@this.SubmitButtonStyle">
|
||||
@this.SubmitText
|
||||
</MudButton>
|
||||
@if (this.isProcessing && this.cancellationTokenSource is not null)
|
||||
@if (this.isProcessing && this.CancellationTokenSource is not null)
|
||||
{
|
||||
<MudTooltip Text="@TB("Stop generation")">
|
||||
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@(async () => await this.CancelStreaming())"/>
|
||||
@@ -68,9 +68,9 @@
|
||||
<ContentBlockComponent Role="@(this.resultingContentBlock.Role)" Type="@(this.resultingContentBlock.ContentType)" Time="@(this.resultingContentBlock.Time)" Content="@this.resultingContentBlock.Content"/>
|
||||
}
|
||||
|
||||
@if(this.ShowResult && this.ShowEntireChatThread && this.chatThread is not null)
|
||||
@if(this.ShowResult && this.ShowEntireChatThread && this.ChatThread is not null)
|
||||
{
|
||||
foreach (var block in this.chatThread.Blocks.OrderBy(n => n.Time))
|
||||
foreach (var block in this.ChatThread.Blocks.OrderBy(n => n.Time))
|
||||
{
|
||||
@if (block is { HideFromUser: false, Content: not null })
|
||||
{
|
||||
@@ -155,12 +155,12 @@
|
||||
|
||||
@if (this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence)
|
||||
{
|
||||
<ConfidenceInfo Mode="PopoverTriggerMode.BUTTON" LLMProvider="@this.providerSettings.UsedLLMProvider"/>
|
||||
<ConfidenceInfo Mode="PopoverTriggerMode.BUTTON" LLMProvider="@this.ProviderSettings.UsedLLMProvider"/>
|
||||
}
|
||||
|
||||
@if (this.AllowProfiles && this.ShowProfileSelection)
|
||||
{
|
||||
<ProfileSelection MarginLeft="" @bind-CurrentProfile="@this.currentProfile"/>
|
||||
<ProfileSelection MarginLeft="" @bind-CurrentProfile="@this.CurrentProfile"/>
|
||||
}
|
||||
|
||||
<MudSpacer />
|
||||
|
||||
@@ -111,14 +111,14 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
protected virtual bool HasSettingsPanel => typeof(TSettings) != typeof(NoSettingsPanel);
|
||||
|
||||
protected AIStudio.Settings.Provider providerSettings = Settings.Provider.NONE;
|
||||
protected MudForm? form;
|
||||
protected bool inputIsValid;
|
||||
protected Profile currentProfile = Profile.NO_PROFILE;
|
||||
protected ChatTemplate currentChatTemplate = ChatTemplate.NO_CHAT_TEMPLATE;
|
||||
protected ChatThread? chatThread;
|
||||
protected IContent? lastUserPrompt;
|
||||
protected CancellationTokenSource? cancellationTokenSource;
|
||||
protected AIStudio.Settings.Provider ProviderSettings = Settings.Provider.NONE;
|
||||
protected MudForm? Form;
|
||||
protected bool InputIsValid;
|
||||
protected Profile CurrentProfile = Profile.NO_PROFILE;
|
||||
protected ChatTemplate CurrentChatTemplate = ChatTemplate.NO_CHAT_TEMPLATE;
|
||||
protected ChatThread? ChatThread;
|
||||
protected IContent? LastUserPrompt;
|
||||
protected CancellationTokenSource? CancellationTokenSource;
|
||||
|
||||
private readonly Timer formChangeTimer = new(TimeSpan.FromSeconds(1.6));
|
||||
|
||||
@@ -147,9 +147,9 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
};
|
||||
|
||||
this.MightPreselectValues();
|
||||
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
||||
this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(this.Component);
|
||||
this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
||||
this.CurrentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
this.CurrentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(this.Component);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -165,7 +165,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
// Reset the validation when not editing and on the first render.
|
||||
// We don't want to show validation errors when the user opens the dialog.
|
||||
if(firstRender)
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
private string TB(string fallbackEN) => this.T(fallbackEN, typeof(AssistantBase<TSettings>).Namespace, nameof(AssistantBase<TSettings>));
|
||||
|
||||
private string SubmitButtonStyle => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence ? this.providerSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).StyleBorder(this.SettingsManager) : string.Empty;
|
||||
private string SubmitButtonStyle => this.SettingsManager.ConfigurationData.LLMProviders.ShowProviderConfidence ? this.ProviderSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).StyleBorder(this.SettingsManager) : string.Empty;
|
||||
|
||||
private IReadOnlyList<Tools.Components> VisibleSendToAssistants => Enum.GetValues<AIStudio.Tools.Components>()
|
||||
.Where(this.CanSendToAssistant)
|
||||
@@ -191,12 +191,12 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
private async Task Start()
|
||||
{
|
||||
using (this.cancellationTokenSource = new())
|
||||
using (this.CancellationTokenSource = new())
|
||||
{
|
||||
await this.SubmitAction();
|
||||
}
|
||||
|
||||
this.cancellationTokenSource = null;
|
||||
this.CancellationTokenSource = null;
|
||||
}
|
||||
|
||||
private void TriggerFormChange(FormFieldChangedEventArgs _)
|
||||
@@ -223,7 +223,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
{
|
||||
Array.Resize(ref this.inputIssues, this.inputIssues.Length + 1);
|
||||
this.inputIssues[^1] = issue;
|
||||
this.inputIsValid = false;
|
||||
this.InputIsValid = false;
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -233,17 +233,17 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
protected void ClearInputIssues()
|
||||
{
|
||||
this.inputIssues = [];
|
||||
this.inputIsValid = true;
|
||||
this.InputIsValid = true;
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
protected void CreateChatThread()
|
||||
{
|
||||
this.chatThread = new()
|
||||
this.ChatThread = new()
|
||||
{
|
||||
IncludeDateTime = false,
|
||||
SelectedProvider = this.providerSettings.Id,
|
||||
SelectedProfile = this.AllowProfiles ? this.currentProfile.Id : Profile.NO_PROFILE.Id,
|
||||
SelectedProvider = this.ProviderSettings.Id,
|
||||
SelectedProfile = this.AllowProfiles ? this.CurrentProfile.Id : Profile.NO_PROFILE.Id,
|
||||
SystemPrompt = this.SystemPrompt,
|
||||
WorkspaceId = Guid.Empty,
|
||||
ChatId = Guid.NewGuid(),
|
||||
@@ -255,11 +255,11 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
protected Guid CreateChatThread(Guid workspaceId, string name)
|
||||
{
|
||||
var chatId = Guid.NewGuid();
|
||||
this.chatThread = new()
|
||||
this.ChatThread = new()
|
||||
{
|
||||
IncludeDateTime = false,
|
||||
SelectedProvider = this.providerSettings.Id,
|
||||
SelectedProfile = this.AllowProfiles ? this.currentProfile.Id : Profile.NO_PROFILE.Id,
|
||||
SelectedProvider = this.ProviderSettings.Id,
|
||||
SelectedProfile = this.AllowProfiles ? this.CurrentProfile.Id : Profile.NO_PROFILE.Id,
|
||||
SystemPrompt = this.SystemPrompt,
|
||||
WorkspaceId = workspaceId,
|
||||
ChatId = chatId,
|
||||
@@ -272,27 +272,27 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
protected virtual void ResetProviderAndProfileSelection()
|
||||
{
|
||||
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
||||
this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(this.Component);
|
||||
this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
||||
this.CurrentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||
this.CurrentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(this.Component);
|
||||
}
|
||||
|
||||
protected DateTimeOffset AddUserRequest(string request, bool hideContentFromUser = false, params List<FileAttachment> attachments)
|
||||
{
|
||||
var time = DateTimeOffset.Now;
|
||||
this.lastUserPrompt = new ContentText
|
||||
this.LastUserPrompt = new ContentText
|
||||
{
|
||||
Text = request,
|
||||
FileAttachments = attachments,
|
||||
};
|
||||
|
||||
this.chatThread!.Blocks.Add(new ContentBlock
|
||||
this.ChatThread!.Blocks.Add(new ContentBlock
|
||||
{
|
||||
Time = time,
|
||||
ContentType = ContentType.TEXT,
|
||||
HideFromUser = hideContentFromUser,
|
||||
Role = ChatRole.USER,
|
||||
Content = this.lastUserPrompt,
|
||||
Content = this.LastUserPrompt,
|
||||
});
|
||||
|
||||
return time;
|
||||
@@ -300,8 +300,8 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
protected async Task<string> AddAIResponseAsync(DateTimeOffset time, bool hideContentFromUser = false)
|
||||
{
|
||||
var manageCancellationLocally = this.cancellationTokenSource is null;
|
||||
this.cancellationTokenSource ??= new CancellationTokenSource();
|
||||
var manageCancellationLocally = this.CancellationTokenSource is null;
|
||||
this.CancellationTokenSource ??= new CancellationTokenSource();
|
||||
|
||||
var aiText = new ContentText
|
||||
{
|
||||
@@ -319,10 +319,10 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
HideFromUser = hideContentFromUser,
|
||||
};
|
||||
|
||||
if (this.chatThread is not null)
|
||||
if (this.ChatThread is not null)
|
||||
{
|
||||
this.chatThread.Blocks.Add(this.resultingContentBlock);
|
||||
this.chatThread.SelectedProvider = this.providerSettings.Id;
|
||||
this.ChatThread.Blocks.Add(this.resultingContentBlock);
|
||||
this.ChatThread.SelectedProvider = this.ProviderSettings.Id;
|
||||
}
|
||||
|
||||
this.isProcessing = true;
|
||||
@@ -331,15 +331,15 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
// Use the selected provider to get the AI response.
|
||||
// By awaiting this line, we wait for the entire
|
||||
// content to be streamed.
|
||||
this.chatThread = await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(), this.providerSettings.Model, this.lastUserPrompt, this.chatThread, this.cancellationTokenSource!.Token);
|
||||
this.ChatThread = await aiText.CreateFromProviderAsync(this.ProviderSettings.CreateProvider(), this.ProviderSettings.Model, this.LastUserPrompt, this.ChatThread, this.CancellationTokenSource!.Token);
|
||||
|
||||
this.isProcessing = false;
|
||||
this.StateHasChanged();
|
||||
|
||||
if(manageCancellationLocally)
|
||||
{
|
||||
this.cancellationTokenSource.Dispose();
|
||||
this.cancellationTokenSource = null;
|
||||
this.CancellationTokenSource.Dispose();
|
||||
this.CancellationTokenSource = null;
|
||||
}
|
||||
|
||||
// Return the AI response:
|
||||
@@ -348,9 +348,9 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
private async Task CancelStreaming()
|
||||
{
|
||||
if (this.cancellationTokenSource is not null)
|
||||
if(!this.cancellationTokenSource.IsCancellationRequested)
|
||||
await this.cancellationTokenSource.CancelAsync();
|
||||
if (this.CancellationTokenSource is not null)
|
||||
if(!this.CancellationTokenSource.IsCancellationRequested)
|
||||
await this.CancellationTokenSource.CancelAsync();
|
||||
}
|
||||
|
||||
protected async Task CopyToClipboard()
|
||||
@@ -360,7 +360,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
|
||||
private ChatThread CreateSendToChatThread()
|
||||
{
|
||||
var originalChatThread = this.chatThread ?? new ChatThread();
|
||||
var originalChatThread = this.ChatThread ?? new ChatThread();
|
||||
if (string.IsNullOrWhiteSpace(this.SendToChatVisibleUserPromptText))
|
||||
return originalChatThread with
|
||||
{
|
||||
@@ -440,7 +440,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
else
|
||||
{
|
||||
var convertedChatThread = this.ConvertToChatThread;
|
||||
convertedChatThread = convertedChatThread with { SelectedProvider = this.providerSettings.Id };
|
||||
convertedChatThread = convertedChatThread with { SelectedProvider = this.ProviderSettings.Id };
|
||||
MessageBus.INSTANCE.DeferMessage(this, sendToData.Event, convertedChatThread);
|
||||
}
|
||||
break;
|
||||
@@ -465,7 +465,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
private async Task InnerResetForm()
|
||||
{
|
||||
this.resultingContentBlock = null;
|
||||
this.providerSettings = Settings.Provider.NONE;
|
||||
this.ProviderSettings = Settings.Provider.NONE;
|
||||
|
||||
await this.JsRuntime.ClearDiv(RESULT_DIV_ID);
|
||||
await this.JsRuntime.ClearDiv(AFTER_RESULT_DIV_ID);
|
||||
@@ -473,12 +473,12 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
||||
this.ResetForm();
|
||||
this.ResetProviderAndProfileSelection();
|
||||
|
||||
this.inputIsValid = false;
|
||||
this.InputIsValid = false;
|
||||
this.inputIssues = [];
|
||||
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
this.StateHasChanged();
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
}
|
||||
|
||||
private string GetResetColor() => this.SettingsManager.IsDarkMode switch
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
</MudList>
|
||||
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -131,8 +131,8 @@ public partial class BiasOfTheDayAssistant : AssistantBaseCore<SettingsDialogAss
|
||||
}
|
||||
}
|
||||
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.biasOfTheDay = useDrawnBias ?
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
</MudStack>
|
||||
|
||||
<MudTextField T="string" @bind-Text="@this.questions" Validation="@this.ValidateQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionMark" Adornment="Adornment.Start" Label="@T("Your question(s)")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -108,7 +108,7 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
||||
return ValueTask.CompletedTask;
|
||||
|
||||
this.codingContexts.RemoveAt(index);
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
|
||||
this.StateHasChanged();
|
||||
return ValueTask.CompletedTask;
|
||||
@@ -116,8 +116,8 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
||||
|
||||
private async Task GetSupport()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
var sbContext = new StringBuilder();
|
||||
|
||||
@@ -74,7 +74,7 @@ else
|
||||
@T("Documents for the analysis")
|
||||
</MudText>
|
||||
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.providerSettings"/>
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.ProviderSettings"/>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
@@ -164,10 +164,10 @@ else
|
||||
@T("Documents for the analysis")
|
||||
</MudText>
|
||||
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.providerSettings"/>
|
||||
<AttachDocuments Name="Document Analysis Files" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.ProviderSettings"/>
|
||||
|
||||
</ExpansionPanel>
|
||||
</MudExpansionPanels>
|
||||
}
|
||||
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider" ExplicitMinimumConfidence="@this.GetPolicyMinimumConfidenceLevel()"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider" ExplicitMinimumConfidence="@this.GetPolicyMinimumConfidenceLevel()"/>
|
||||
+21
-21
@@ -125,7 +125,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.chatThread is null || this.chatThread.Blocks.Count < 2)
|
||||
if (this.ChatThread is null || this.ChatThread.Blocks.Count < 2)
|
||||
{
|
||||
return new ChatThread
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
// that includes the loaded document paths and a standard message about the previous analysis session:
|
||||
new ContentBlock
|
||||
{
|
||||
Time = this.chatThread.Blocks.First().Time,
|
||||
Time = this.ChatThread.Blocks.First().Time,
|
||||
Role = ChatRole.USER,
|
||||
HideFromUser = false,
|
||||
ContentType = ContentType.TEXT,
|
||||
@@ -157,7 +157,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
|
||||
// Then, append the last block of the current chat thread
|
||||
// (which is expected to be the AI response):
|
||||
this.chatThread.Blocks.Last(),
|
||||
this.ChatThread.Blocks.Last(),
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.policyDefinitionExpanded = !this.selectedPolicy?.IsProtected ?? true;
|
||||
this.ApplyPolicyPreselection(preferPolicyPreselection: true);
|
||||
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
this.ClearInputIssues();
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.ResetForm();
|
||||
|
||||
await this.SettingsManager.StoreSettings();
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -408,10 +408,10 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
if (!preferPolicyPreselection)
|
||||
{
|
||||
// Keep the current provider if it still satisfies the minimum confidence:
|
||||
if (this.providerSettings != Settings.Provider.NONE &&
|
||||
this.providerSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||
if (this.ProviderSettings != Settings.Provider.NONE &&
|
||||
this.ProviderSettings.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||
{
|
||||
this.currentProfile = this.ResolveProfileSelection();
|
||||
this.CurrentProfile = this.ResolveProfileSelection();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -420,18 +420,18 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
var policyProvider = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.selectedPolicy.PreselectedProvider);
|
||||
if (policyProvider is not null && policyProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||
{
|
||||
this.providerSettings = policyProvider;
|
||||
this.currentProfile = this.ResolveProfileSelection();
|
||||
this.ProviderSettings = policyProvider;
|
||||
this.CurrentProfile = this.ResolveProfileSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
var fallbackProvider = this.SettingsManager.GetPreselectedProvider(this.Component, this.providerSettings.Id);
|
||||
var fallbackProvider = this.SettingsManager.GetPreselectedProvider(this.Component, this.ProviderSettings.Id);
|
||||
if (fallbackProvider != Settings.Provider.NONE &&
|
||||
fallbackProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level < minimumLevel)
|
||||
fallbackProvider = Settings.Provider.NONE;
|
||||
|
||||
this.providerSettings = fallbackProvider;
|
||||
this.currentProfile = this.ResolveProfileSelection();
|
||||
this.ProviderSettings = fallbackProvider;
|
||||
this.CurrentProfile = this.ResolveProfileSelection();
|
||||
}
|
||||
|
||||
private ConfidenceLevel GetPolicyMinimumConfidenceLevel()
|
||||
@@ -482,7 +482,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
|
||||
this.policyPreselectedProviderId = providerId;
|
||||
this.selectedPolicy.PreselectedProvider = providerId;
|
||||
this.providerSettings = Settings.Provider.NONE;
|
||||
this.ProviderSettings = Settings.Provider.NONE;
|
||||
this.ApplyPolicyPreselection();
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
if (this.selectedPolicy is not null)
|
||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfile;
|
||||
|
||||
this.currentProfile = this.ResolveProfileSelection();
|
||||
this.CurrentProfile = this.ResolveProfileSelection();
|
||||
await this.AutoSave();
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
this.ApplyPolicyPreselection(preferPolicyPreselection: true);
|
||||
|
||||
// Reset validation state:
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
this.ClearInputIssues();
|
||||
}
|
||||
|
||||
@@ -700,12 +700,12 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
private async Task Analyze()
|
||||
{
|
||||
await this.AutoSave();
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
this.chatThread!.IncludeDateTime = true;
|
||||
this.ChatThread!.IncludeDateTime = true;
|
||||
|
||||
var userRequest = this.AddUserRequest(
|
||||
await this.PromptLoadDocumentsContent(),
|
||||
@@ -724,8 +724,8 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
||||
}
|
||||
|
||||
await this.AutoSave();
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
{
|
||||
await this.MessageBus.SendError(new (Icons.Material.Filled.Policy, this.T("The selected policy contains invalid data. Please fix the issues before exporting the policy.")));
|
||||
return;
|
||||
|
||||
@@ -120,7 +120,7 @@ else
|
||||
var webState = this.assistantState.WebContent[webContent.Name];
|
||||
<div class="@webContent.Class" style="@GetOptionalStyle(webContent.Style)">
|
||||
<ReadWebContent @bind-Content="@webState.Content"
|
||||
ProviderSettings="@this.providerSettings"
|
||||
ProviderSettings="@this.ProviderSettings"
|
||||
@bind-AgentIsRunning="@webState.AgentIsRunning"
|
||||
@bind-Preselect="@webState.Preselect"
|
||||
@bind-PreselectContentCleanerAgent="@webState.PreselectContentCleanerAgent" />
|
||||
@@ -349,7 +349,7 @@ else
|
||||
if (component is AssistantProviderSelection providerSelection)
|
||||
{
|
||||
<div class="@providerSelection.Class" style="@GetOptionalStyle(providerSelection.Style)">
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider" />
|
||||
</div>
|
||||
}
|
||||
break;
|
||||
@@ -359,7 +359,7 @@ else
|
||||
{
|
||||
var selection = profileSelection;
|
||||
<div class="@selection.Class" style="@GetOptionalStyle(selection.Style)">
|
||||
<ProfileFormSelection Validation="@(profile => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.currentProfile" />
|
||||
<ProfileFormSelection Validation="@(profile => this.ValidateProfileSelection(selection, profile))" @bind-Profile="@this.CurrentProfile" />
|
||||
</div>
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -165,7 +165,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
if (this.assistantPlugin?.HasCustomPromptBuilder != true) return this.CollectUserPromptFallback();
|
||||
|
||||
var input = this.BuildPromptInput();
|
||||
var prompt = await this.assistantPlugin.TryBuildPromptAsync(input, this.cancellationTokenSource?.Token ?? CancellationToken.None);
|
||||
var prompt = await this.assistantPlugin.TryBuildPromptAsync(input, this.CancellationTokenSource?.Token ?? CancellationToken.None);
|
||||
return !string.IsNullOrWhiteSpace(prompt) ? prompt : this.CollectUserPromptFallback();
|
||||
}
|
||||
|
||||
@@ -178,10 +178,10 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
|
||||
var profile = new LuaTable
|
||||
{
|
||||
["Name"] = this.currentProfile.Name,
|
||||
["NeedToKnow"] = this.currentProfile.NeedToKnow,
|
||||
["Actions"] = this.currentProfile.Actions,
|
||||
["Num"] = this.currentProfile.Num,
|
||||
["Name"] = this.CurrentProfile.Name,
|
||||
["NeedToKnow"] = this.CurrentProfile.NeedToKnow,
|
||||
["Actions"] = this.CurrentProfile.Actions,
|
||||
["Num"] = this.CurrentProfile.Num,
|
||||
};
|
||||
|
||||
state["profile"] = profile;
|
||||
@@ -233,7 +233,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
try
|
||||
{
|
||||
var input = this.BuildPromptInput();
|
||||
var cancellationToken = this.cancellationTokenSource?.Token ?? CancellationToken.None;
|
||||
var cancellationToken = this.CancellationTokenSource?.Token ?? CancellationToken.None;
|
||||
var result = await this.assistantPlugin.TryInvokeButtonActionAsync(button, input, cancellationToken);
|
||||
if (result is not null)
|
||||
this.ApplyActionResult(result, AssistantComponentType.BUTTON);
|
||||
@@ -264,7 +264,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
try
|
||||
{
|
||||
var input = this.BuildPromptInput();
|
||||
var cancellationToken = this.cancellationTokenSource?.Token ?? CancellationToken.None;
|
||||
var cancellationToken = this.CancellationTokenSource?.Token ?? CancellationToken.None;
|
||||
var result = await this.assistantPlugin.TryInvokeSwitchChangedAsync(switchComponent, input, cancellationToken);
|
||||
if (result is not null)
|
||||
this.ApplyActionResult(result, AssistantComponentType.SWITCH);
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
<MudTextField T="string" @bind-Text="@this.inputName" Label="@T("(Optional) Your name for the closing salutation")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Person" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Your name for the closing salutation of your e-mail.")" Class="mb-3"/>
|
||||
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name())" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Select the writing style")" ValidateSelection="@this.ValidateWritingStyle"/>
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidateTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -224,8 +224,8 @@ public partial class AssistantEMail : AssistantBaseCore<SettingsDialogWritingEMa
|
||||
|
||||
private async Task CreateMail()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -330,7 +330,7 @@ else
|
||||
<b>@T("Important:")</b> @T("The LLM may need to generate many files. This reaches the request limit of most providers. Typically, only a certain number of requests can be made per minute, and only a maximum number of tokens can be generated per minute. AI Studio automatically considers this.") <b>@T("However, generating all the files takes a certain amount of time.")</b> @T("Local or self-hosted models may work without these limitations and can generate responses faster. AI Studio dynamically adapts its behavior and always tries to achieve the fastest possible data processing.")
|
||||
</MudJustifiedText>
|
||||
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
|
||||
<MudText Typo="Typo.h4" Class="mt-9 mb-1">
|
||||
@T("Write code to file system")
|
||||
|
||||
@@ -303,7 +303,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
||||
|
||||
protected override bool SubmitDisabled => this.IsNoneERIServerSelected;
|
||||
|
||||
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
|
||||
protected override ChatThread ConvertToChatThread => (this.ChatThread ?? new()) with
|
||||
{
|
||||
SystemPrompt = this.SystemPrompt,
|
||||
};
|
||||
@@ -400,7 +400,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
||||
if(this.selectedERIServer is null)
|
||||
return;
|
||||
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedProvider = this.providerSettings.Id;
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedProvider = this.ProviderSettings.Id;
|
||||
this.selectedERIServer.ServerName = this.serverName;
|
||||
this.selectedERIServer.ServerDescription = this.serverDescription;
|
||||
this.selectedERIServer.ERIVersion = this.selectedERIVersion;
|
||||
@@ -488,7 +488,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
||||
this.ResetForm();
|
||||
|
||||
await this.SettingsManager.StoreSettings();
|
||||
this.form?.ResetValidation();
|
||||
this.Form?.ResetValidation();
|
||||
}
|
||||
|
||||
private bool IsNoneERIServerSelected => this.selectedERIServer is null;
|
||||
@@ -940,8 +940,8 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
||||
return;
|
||||
|
||||
await this.AutoSave();
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
if(this.retrievalProcesses.Count == 0)
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidateText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input to check")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -119,8 +119,8 @@ public partial class AssistantGrammarSpelling : AssistantBaseCore<SettingsDialog
|
||||
|
||||
private async Task ProofreadText()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -85,7 +85,7 @@ else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
||||
}
|
||||
else
|
||||
{
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
}
|
||||
|
||||
@if (this.localizedContent.Count > 0)
|
||||
|
||||
@@ -269,8 +269,8 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
|
||||
private async Task LocalizeTextContent()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
if(this.selectedLanguagePlugin is null)
|
||||
@@ -291,7 +291,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
this.localizedContent = this.addedContent.ToDictionary();
|
||||
}
|
||||
|
||||
if(this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if(this.CancellationTokenSource!.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
//
|
||||
@@ -302,7 +302,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
//
|
||||
foreach (var keyValuePair in this.selectedLanguagePlugin.Content)
|
||||
{
|
||||
if (this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if (this.CancellationTokenSource!.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
if (this.localizedContent.ContainsKey(keyValuePair.Key))
|
||||
@@ -314,7 +314,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
this.localizedContent.Add(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
|
||||
if(this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if(this.CancellationTokenSource!.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
//
|
||||
@@ -324,7 +324,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
var commentContent = new Dictionary<string, string>(this.addedContent);
|
||||
foreach (var keyValuePair in PluginFactory.BaseLanguage.Content)
|
||||
{
|
||||
if (this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if (this.CancellationTokenSource!.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
if (this.removedContent.ContainsKey(keyValuePair.Key))
|
||||
@@ -342,7 +342,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
var minimumTime = TimeSpan.FromMilliseconds(500);
|
||||
foreach (var keyValuePair in this.addedContent)
|
||||
{
|
||||
if(this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if(this.CancellationTokenSource!.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -360,7 +360,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
var time = this.AddUserRequest(keyValuePair.Value);
|
||||
this.localizedContent.Add(keyValuePair.Key, await this.AddAIResponseAsync(time));
|
||||
|
||||
if (this.cancellationTokenSource!.IsCancellationRequested)
|
||||
if (this.CancellationTokenSource!.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -375,7 +375,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
||||
private void Phase2CreateLuaCode(IReadOnlyDictionary<string, string> commentContent)
|
||||
{
|
||||
this.finalLuaCode.Clear();
|
||||
LuaTable.Create(ref this.finalLuaCode, "UI_TEXT_CONTENT", this.localizedContent, commentContent, this.cancellationTokenSource!.Token);
|
||||
LuaTable.Create(ref this.finalLuaCode, "UI_TEXT_CONTENT", this.localizedContent, commentContent, this.CancellationTokenSource!.Token);
|
||||
|
||||
// Next, we must remove the `root::` prefix from the keys:
|
||||
this.finalLuaCode.Replace("""UI_TEXT_CONTENT["root::""", """
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -80,8 +80,8 @@ public partial class AssistantIconFinder : AssistantBaseCore<SettingsDialogIconF
|
||||
|
||||
private async Task FindIcon()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -12,4 +12,4 @@
|
||||
<MudTextField T="string" @bind-Text="@this.inputValidUntil" Label="@T("(Optional) Provide the date until the job posting is valid")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -287,8 +287,8 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
||||
|
||||
private async Task CreateJobPosting()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
@if (!this.SettingsManager.ConfigurationData.LegalCheck.HideWebContentReader)
|
||||
{
|
||||
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.ProviderSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
}
|
||||
|
||||
<ReadFileContent @bind-FileContent="@this.inputLegalDocument"/>
|
||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputLegalDocument" Validation="@this.ValidatingLegalDocument" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Legal document")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputQuestions" Validation="@this.ValidatingQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionAnswer" Adornment="Adornment.Start" Label="@T("Your questions")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -91,8 +91,8 @@ public partial class AssistantLegalCheck : AssistantBaseCore<SettingsDialogLegal
|
||||
|
||||
private async Task AksQuestions()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@attribute [Route(Routes.ASSISTANT_MY_TASKS)]
|
||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogMyTasks>
|
||||
|
||||
<ProfileFormSelection Validation="@this.ValidateProfile" @bind-Profile="@this.currentProfile"/>
|
||||
<ProfileFormSelection Validation="@this.ValidateProfile" @bind-Profile="@this.CurrentProfile"/>
|
||||
<MudTextField T="string" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Text or email")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -110,8 +110,8 @@ public partial class AssistantMyTasks : AssistantBaseCore<SettingsDialogMyTasks>
|
||||
|
||||
private async Task AnalyzeText()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
CatchAllDocuments="false"
|
||||
UseSmallForm="true"
|
||||
ValidateMediaFileTypes="false"
|
||||
Provider="@this.providerSettings"/>
|
||||
Provider="@this.ProviderSettings"/>
|
||||
}
|
||||
|
||||
<MudTextField T="string"
|
||||
@@ -121,4 +121,4 @@
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -111,7 +111,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
|
||||
protected override bool SubmitDisabled => this.useCustomPromptGuide && this.customPromptGuideFiles.Count == 0;
|
||||
|
||||
protected override ChatThread ConvertToChatThread => (this.chatThread ?? new()) with
|
||||
protected override ChatThread ConvertToChatThread => (this.ChatThread ?? new()) with
|
||||
{
|
||||
SystemPrompt = SystemPrompts.DEFAULT,
|
||||
};
|
||||
@@ -218,8 +218,8 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
|
||||
private async Task OptimizePromptAsync()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.ClearInputIssues();
|
||||
@@ -341,7 +341,6 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
if (probe is null || string.IsNullOrWhiteSpace(probe.OptimizedPrompt))
|
||||
return false;
|
||||
|
||||
probe.Recommendations ??= new PromptOptimizationRecommendations();
|
||||
parsedResult = probe;
|
||||
return true;
|
||||
}
|
||||
@@ -414,7 +413,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
if (string.IsNullOrWhiteSpace(this.optimizedPrompt))
|
||||
return;
|
||||
|
||||
if (this.chatThread is null)
|
||||
if (this.ChatThread is null)
|
||||
return;
|
||||
|
||||
var visibleResponseContent = new ContentText
|
||||
@@ -422,7 +421,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
Text = this.optimizedPrompt,
|
||||
};
|
||||
|
||||
this.chatThread.Blocks.Add(new ContentBlock
|
||||
this.ChatThread.Blocks.Add(new ContentBlock
|
||||
{
|
||||
Time = DateTimeOffset.Now,
|
||||
ContentType = ContentType.TEXT,
|
||||
@@ -548,7 +547,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
{ x => x.GuidelineMarkdown, promptingGuideline }
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<PromptingGuidelineDialog>(T("Prompting Guideline"), dialogParameters, AIStudio.Dialogs.DialogOptions.FULLSCREEN);
|
||||
var dialogReference = await this.DialogService.ShowAsync<PromptingGuidelineDialog>(T("Prompting Guideline"), dialogParameters, Dialogs.DialogOptions.FULLSCREEN);
|
||||
await dialogReference.Result;
|
||||
}
|
||||
|
||||
@@ -567,6 +566,6 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
||||
{ x => x.FileContent, this.customPromptingGuidelineContent },
|
||||
};
|
||||
|
||||
await this.DialogService.ShowAsync<DocumentCheckDialog>(T("Custom Prompt Guide Preview"), dialogParameters, AIStudio.Dialogs.DialogOptions.FULLSCREEN);
|
||||
await this.DialogService.ShowAsync<DocumentCheckDialog>(T("Custom Prompt Guide Preview"), dialogParameters, Dialogs.DialogOptions.FULLSCREEN);
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,4 @@
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom language")" />
|
||||
<EnumSelection T="WritingStyles" NameFunc="@(style => style.Name())" @bind-Value="@this.selectedWritingStyle" Icon="@Icons.Material.Filled.Edit" Label="@T("Writing style")" AllowOther="@false" />
|
||||
<EnumSelection T="SentenceStructure" NameFunc="@(voice => voice.Name())" @bind-Value="@this.selectedSentenceStructure" Icon="@Icons.Material.Filled.Person4" Label="@T("Sentence structure")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -1,4 +1,3 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Dialogs.Settings;
|
||||
|
||||
namespace AIStudio.Assistants.RewriteImprove;
|
||||
@@ -127,8 +126,8 @@ public partial class AssistantRewriteImprove : AssistantBaseCore<SettingsDialogR
|
||||
|
||||
private async Task RewriteText()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<MudTextField T="string" @bind-Text="@this.inputContent" Validation="@this.ValidatingContext" Adornment="Adornment.Start" Lines="6" MaxLines="12" AutoGrow="@false" Label="@T("Text content")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
|
||||
<MudText Typo="Typo.h6" Class="mb-1 mt-1"> @T("Attach documents")</MudText>
|
||||
<AttachDocuments Name="Documents for input" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" OnChange="@this.OnDocumentsChanged" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.providerSettings"/>
|
||||
<AttachDocuments Name="Documents for input" Layer="@DropLayers.ASSISTANTS" @bind-DocumentPaths="@this.loadedDocumentPaths" OnChange="@this.OnDocumentsChanged" CatchAllDocuments="true" UseSmallForm="false" Provider="@this.ProviderSettings"/>
|
||||
|
||||
<MudText Typo="Typo.h5" Class="mb-3 mt-6"> @T("Details about the desired presentation")</MudText>
|
||||
|
||||
@@ -66,4 +66,4 @@
|
||||
<EnumSelection T="AudienceAgeGroup" NameFunc="@(ageGroup => ageGroup.Name())" @bind-Value="@this.selectedAudienceAgeGroup" Icon="@Icons.Material.Filled.Cake" Label="@T("Audience age group")" />
|
||||
<EnumSelection T="AudienceOrganizationalLevel" NameFunc="@(level => level.Name())" @bind-Value="@this.selectedAudienceOrganizationalLevel" Icon="@Icons.Material.Filled.AccountTree" Label="@T("Audience organizational level")" />
|
||||
<EnumSelection T="AudienceExpertise" NameFunc="@(expertise => expertise.Name())" @bind-Value="@this.selectedAudienceExpertise" Icon="@Icons.Material.Filled.School" Label="@T("Audience expertise")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -82,7 +82,7 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.chatThread is null || this.chatThread.Blocks.Count < 2)
|
||||
if (this.ChatThread is null || this.ChatThread.Blocks.Count < 2)
|
||||
{
|
||||
return new ChatThread
|
||||
{
|
||||
@@ -100,7 +100,7 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
// Visible user block:
|
||||
new ContentBlock
|
||||
{
|
||||
Time = this.chatThread.Blocks.First().Time,
|
||||
Time = this.ChatThread.Blocks.First().Time,
|
||||
Role = ChatRole.USER,
|
||||
HideFromUser = false,
|
||||
ContentType = ContentType.TEXT,
|
||||
@@ -114,7 +114,7 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
// Hidden user block with inputContent data:
|
||||
new ContentBlock
|
||||
{
|
||||
Time = this.chatThread.Blocks.First().Time,
|
||||
Time = this.ChatThread.Blocks.First().Time,
|
||||
Role = ChatRole.USER,
|
||||
HideFromUser = true,
|
||||
ContentType = ContentType.TEXT,
|
||||
@@ -144,7 +144,7 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
|
||||
// Then, append the last block of the current chat thread
|
||||
// (which is expected to be the AI response):
|
||||
this.chatThread.Blocks.Last(),
|
||||
this.ChatThread.Blocks.Last(),
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -230,8 +230,8 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
|
||||
private async Task OnDocumentsChanged(HashSet<FileAttachment> _)
|
||||
{
|
||||
if(this.form is not null)
|
||||
await this.form.Validate();
|
||||
if(this.Form is not null)
|
||||
await this.Form.Validate();
|
||||
}
|
||||
|
||||
private string? ValidateCustomLanguage(string language)
|
||||
@@ -375,8 +375,8 @@ public partial class SlideAssistant : AssistantBaseCore<SettingsDialogSlideBuild
|
||||
|
||||
private async Task CreateSlideBuilder()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.calculatedNumberOfSlides = this.timeSpecification > 0 ? this.CalculateNumberOfSlides() : 0;
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
<MudTextField T="string" @bind-Text="@this.inputContext" AdornmentIcon="@Icons.Material.Filled.Description" Adornment="Adornment.Start" Lines="2" AutoGrow="@false" Label="@T("(Optional) The context for the given word or phrase")" Variant="Variant.Outlined" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -1,4 +1,3 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Dialogs.Settings;
|
||||
|
||||
namespace AIStudio.Assistants.Synonym;
|
||||
@@ -167,8 +166,8 @@ public partial class AssistantSynonyms : AssistantBaseCore<SettingsDialogSynonym
|
||||
|
||||
private async Task FindSynonyms()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)
|
||||
{
|
||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.ProviderSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
}
|
||||
|
||||
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||
@@ -11,4 +11,4 @@
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
|
||||
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
||||
<MudTextField T="string" AutoGrow="true" Lines="2" @bind-Text="@this.importantAspects" class="mb-3" Label="@T("(Optional) Important Aspects")" HelperText="@T("(Optional) Specify aspects for the LLM to focus on when generating a summary, such as summary length or specific topics to emphasize.")" ShrinkLabel="true" Variant="Variant.Outlined" AdornmentIcon="@Icons.Material.Filled.List" Adornment="Adornment.Start"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -123,8 +123,8 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
||||
|
||||
private async Task SummarizeText()
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
this.CreateChatThread();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)
|
||||
{
|
||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.ProviderSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||
}
|
||||
|
||||
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||
@@ -19,4 +19,4 @@ else
|
||||
}
|
||||
|
||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
<ProviderSelection @bind-ProviderSettings="@this.ProviderSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||
@@ -1,4 +1,3 @@
|
||||
using AIStudio.Chat;
|
||||
using AIStudio.Dialogs.Settings;
|
||||
|
||||
namespace AIStudio.Assistants.Translation;
|
||||
@@ -120,8 +119,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
|
||||
|
||||
private async Task TranslateText(bool force)
|
||||
{
|
||||
await this.form!.Validate();
|
||||
if (!this.inputIsValid)
|
||||
await this.Form!.Validate();
|
||||
if (!this.InputIsValid)
|
||||
return;
|
||||
|
||||
if(!force && this.inputText == this.inputTextLastTranslation)
|
||||
|
||||
Reference in new issue
Block a user