@inherits MSGComponentBase
@T("Tool Selection") @T("Tools allow the LLM to perform targeted additional actions such as web searches or reading web pages.") @if (!this.SupportsTools) { @this.UnsupportedToolsMessage } else if (this.Disabled) { @T("Tool changes are locked while a response is running. Your current selection is shown below and applies again from the next message once the run is finished.") } else if (this.catalog.Count == 0) { @T("No tools are available in this context.") } @if (this.SupportsTools && this.catalog.Count > 0) { @* The striping sits on this wrapper: the rows share their parent with the introduction and the occasional alert, which would shift the parity. *@
@foreach (var item in this.catalog) { var isSelected = this.SelectedToolIds.Contains(item.Definition.Id); var isConfigured = item.ConfigurationState.IsConfigured; var providerConfidenceHint = this.GetProviderConfidenceHint(item);
@* Everything but the settings button switches the tool, so aiming for the small switch is optional. The button spans that part of the row, which keeps the settings button outside of it without any event plumbing. *@ @* A checkbox rather than a switch, because this row is one entry of a set the user picks from, not a setting of its own -- the same question the data source selection next to it asks, and it should not look like a different one. The checkbox only shows the state; the surrounding button does the switching. It therefore takes no pointer events at all: its label reaches past the visible box and would otherwise swallow the clicks landing in that strip. *@ @if (!item.IsActive) { } @item.Implementation.GetDisplayName() @if (!isConfigured) { @(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 }
}
}
@T("Close")