Let the chat template of a launcher decide its tools and data sources

This commit is contained in:
Thorsten Sommer committed 2026-09-22 10:37:33 +02:00
1 parent b498c8e2e1
commit 845a967480
5 files changed
+332 -31

No files matched your search

@@ -51,4 +51,20 @@
}
</MudSelect>
<ToolSelectionField Component="Components.CHAT" SelectedToolIds="@this.ToolIds" SelectedToolIdsChanged="@this.SetToolIds" Label="@T("Tools (Optional)")" Help="@T("These tools are preselected when the chat opens. Users can change the selection in the chat, and every tool has to meet the confidence requirements of the provider in use.")"/>
@* A chat template wins over what is chosen here, so the form says so before somebody picks
something which would never take effect: *@
@if (this.SelectedChatTemplate.DataSourceOptions is not null)
{
<MudText Typo="Typo.body2" Class="mud-text-secondary mb-3">
@T("The chosen chat template brings data sources of its own, and those win over a selection made here. Only a template can also leave the choice of sources to the AI, which is why it decides this on its own.")
</MudText>
}
<ToolSelectionField Component="Components.CHAT" SelectedToolIds="@this.ToolIds" SelectedToolIdsChanged="@this.SetToolIds" Label="@T("Tools (Optional)")" Help="@T("These tools are preselected when the chat opens. Users can change the selection in the chat, and every tool has to meet the confidence requirements of the provider in use.")"/>
@if (this.SelectedChatTemplate.ToolIds is not null)
{
<MudText Typo="Typo.body2" Class="mud-text-secondary">
@T("The chosen chat template brings tools of its own, and those win over a selection made here.")
</MudText>
}
@@ -1,3 +1,5 @@
using AIStudio.Settings;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
@@ -81,6 +83,19 @@ public partial class DirectChatLauncherForm : MSGComponentBase
/// </summary>
private bool OpensTemporaryChat => string.IsNullOrWhiteSpace(this.WorkspaceName);
/// <summary>
/// The chat template the launcher would open its chat with, as far as it is known here.
/// </summary>
/// <remarks>
/// With "use chat default" chosen, this is whichever template the chat options name right now,
/// and that may well be another one by the time somebody opens the launcher. The form therefore
/// only says what such a template brings along instead of disabling the fields below it: a field
/// which locks itself behind the user's back is worse than a sentence explaining the situation.
/// </remarks>
private ChatTemplate SelectedChatTemplate => string.IsNullOrWhiteSpace(this.ChatTemplateId)
? this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT)
: this.SettingsManager.GetChatTemplateById(this.ChatTemplateId);
private IReadOnlyList<WorkspaceTreeWorkspace> availableWorkspaces = [];
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();