diff --git a/app/MindWork AI Studio/Components/ToolSelection.razor b/app/MindWork AI Studio/Components/ToolSelection.razor index 8763cc42..fbe9960a 100644 --- a/app/MindWork AI Studio/Components/ToolSelection.razor +++ b/app/MindWork AI Studio/Components/ToolSelection.razor @@ -44,8 +44,7 @@ @foreach (var item in this.catalog) { var isSelected = this.SelectedToolIds.Contains(item.Definition.Id); - var isConfigured = item.ConfigurationState.IsConfigured; - var providerConfidenceHint = this.GetProviderConfidenceHint(item); + var warningText = this.GetWarningText(item);
@* @@ -81,17 +80,13 @@ - @if (!isConfigured) + @if (!string.IsNullOrWhiteSpace(warningText)) { - @(string.IsNullOrWhiteSpace(item.ConfigurationState.Message) ? T("Required settings are missing. Configure this tool before enabling it.") : item.ConfigurationState.Message) - } - @if (!item.IsActive) - { - @T("This tool has been disabled by your organization.") - } - @if (!string.IsNullOrWhiteSpace(providerConfidenceHint)) - { - @providerConfidenceHint + @* + A caption renders as an inline span by default, and an inline element + cannot be justified. The div makes it a block of its own. + *@ + @warningText }
} @@ -104,4 +99,4 @@ - + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ToolSelection.razor.cs b/app/MindWork AI Studio/Components/ToolSelection.razor.cs index ff09ae93..c6b9e992 100644 --- a/app/MindWork AI Studio/Components/ToolSelection.razor.cs +++ b/app/MindWork AI Studio/Components/ToolSelection.razor.cs @@ -129,6 +129,29 @@ public partial class ToolSelection : MSGComponentBase this.ProviderConfidence.GetName()); } + /// + /// Every reason why this tool is out of reach right now, as one text. + /// + /// + /// Several reasons can apply at once, such as a missing setting and a provider without the + /// confidence the tool needs. One justified paragraph reads better than a stack of short lines. + /// + private string GetWarningText(ToolCatalogItem item) + { + var warnings = new List(3); + if (!item.ConfigurationState.IsConfigured) + warnings.Add(string.IsNullOrWhiteSpace(item.ConfigurationState.Message) ? T("Required settings are missing. Configure this tool before enabling it.") : item.ConfigurationState.Message); + + if (!item.IsActive) + warnings.Add(T("This tool has been disabled by your organization.")); + + var providerConfidenceHint = this.GetProviderConfidenceHint(item); + if (!string.IsNullOrWhiteSpace(providerConfidenceHint)) + warnings.Add(providerConfidenceHint); + + return string.Join(' ', warnings); + } + private async Task OpenSettings(string toolId) { var parameters = new DialogParameters