mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 19:52:10 +00:00
Merge be15ce6a4a into 6eab9dc574
This commit is contained in:
commit
eddbc944ad
@ -31,9 +31,9 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
|||||||
protected override string SubmitText => this.submitText;
|
protected override string SubmitText => this.submitText;
|
||||||
protected override Func<Task> SubmitAction => this.Submit;
|
protected override Func<Task> SubmitAction => this.Submit;
|
||||||
protected override bool SubmitDisabled => this.isSecurityBlocked;
|
protected override bool SubmitDisabled => this.isSecurityBlocked;
|
||||||
// Dynamic assistants do not have dedicated settings yet.
|
// Dynamic assistants do not have dedicated settings yet. Their internal identity keeps their
|
||||||
// Reuse chat-level provider filtering/preselection instead of NONE.
|
// session and media state separate while ComponentsExtensions derives their defaults from chat.
|
||||||
protected override Tools.Components Component => Tools.Components.CHAT;
|
protected override Tools.Components Component => Tools.Components.DYNAMIC_ASSISTANT;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin ID as the assistant session instance ID.
|
/// Gets the plugin ID as the assistant session instance ID.
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
var launchLink = assistantPlugin.StartsChatDirectly ? string.Empty : $"{Routes.ASSISTANT_DYNAMIC}?assistantId={assistantPlugin.Id}";
|
var launchLink = assistantPlugin.StartsChatDirectly ? string.Empty : $"{Routes.ASSISTANT_DYNAMIC}?assistantId={assistantPlugin.Id}";
|
||||||
var availablePlugin = PluginFactory.AvailablePlugins.OfType<IAvailablePlugin>().FirstOrDefault(plugin => plugin.Id == assistantPlugin.Id);
|
var availablePlugin = PluginFactory.AvailablePlugins.OfType<IAvailablePlugin>().FirstOrDefault(plugin => plugin.Id == assistantPlugin.Id);
|
||||||
<AssistantBlock TSettings="NoSettingsPanel"
|
<AssistantBlock TSettings="NoSettingsPanel"
|
||||||
|
Component="Components.DYNAMIC_ASSISTANT"
|
||||||
Name="@T(assistantPlugin.AssistantTitle)"
|
Name="@T(assistantPlugin.AssistantTitle)"
|
||||||
Description="@T(assistantPlugin.Description)"
|
Description="@T(assistantPlugin.Description)"
|
||||||
Icon="@Icons.Material.Filled.FindInPage"
|
Icon="@Icons.Material.Filled.FindInPage"
|
||||||
|
|||||||
@ -41,6 +41,12 @@ public static class AssistantVisibilityExtensions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dynamic assistants are controlled through plugin activation and their security state.
|
||||||
|
// The Assistant Builder is controlled through its preview feature. Neither belongs to the
|
||||||
|
// built-in assistant visibility list, so both are expected to be visible at this point.
|
||||||
|
if (component is Components.DYNAMIC_ASSISTANT or Components.META_ASSISTANT)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Map Components enum to ConfigurableAssistant enum:
|
// Map Components enum to ConfigurableAssistant enum:
|
||||||
var configurableAssistant = component switch
|
var configurableAssistant = component switch
|
||||||
{
|
{
|
||||||
|
|||||||
@ -28,6 +28,10 @@ public enum Components
|
|||||||
// ReSharper restore InconsistentNaming
|
// ReSharper restore InconsistentNaming
|
||||||
|
|
||||||
CHAT,
|
CHAT,
|
||||||
|
|
||||||
|
// Internal identity for plugin-provided assistants. Its defaults are derived from CHAT,
|
||||||
|
// but it remains separate from the built-in chat component and its session state.
|
||||||
|
DYNAMIC_ASSISTANT,
|
||||||
WRITER,
|
WRITER,
|
||||||
APP_SETTINGS,
|
APP_SETTINGS,
|
||||||
|
|
||||||
|
|||||||
@ -30,16 +30,17 @@ public static class ComponentsExtensions
|
|||||||
/// blocks starting another one and inactive sessions can be cleared as a group.
|
/// blocks starting another one and inactive sessions can be cleared as a group.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Components return <c>false</c> for two different reasons. The chat has no assistant sessions
|
/// Components return <c>false</c> for three different reasons. The chat has no assistant sessions
|
||||||
/// at all. The visual briefing assistant keys its sessions per briefing, so it owns one slot per
|
/// at all. Dynamic assistants key their sessions per plugin. The visual briefing assistant keys
|
||||||
/// stored briefing rather than one per component. Both must be excluded from the single-slot
|
/// its sessions per briefing, so it owns one slot per stored briefing rather than one per
|
||||||
/// checks, which is why this is a capability and not a component comparison.
|
/// component. All must be excluded from the single-slot checks, which is why this is a
|
||||||
|
/// capability and not a component comparison.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="component">The component to look up.</param>
|
/// <param name="component">The component to look up.</param>
|
||||||
/// <returns><c>true</c> when the component owns exactly one session slot.</returns>
|
/// <returns><c>true</c> when the component owns exactly one session slot.</returns>
|
||||||
public static bool HasSingleSessionSlot(this Components component) => component switch
|
public static bool HasSingleSessionSlot(this Components component) => component switch
|
||||||
{
|
{
|
||||||
Components.CHAT => false,
|
Components.CHAT or Components.DYNAMIC_ASSISTANT => false,
|
||||||
Components.VISUAL_BRIEFING_ASSISTANT => false,
|
Components.VISUAL_BRIEFING_ASSISTANT => false,
|
||||||
|
|
||||||
_ => true,
|
_ => true,
|
||||||
@ -60,6 +61,7 @@ public static class ComponentsExtensions
|
|||||||
public static bool AllowSendTo(this Components component) => component switch
|
public static bool AllowSendTo(this Components component) => component switch
|
||||||
{
|
{
|
||||||
Components.NONE => false,
|
Components.NONE => false,
|
||||||
|
Components.DYNAMIC_ASSISTANT => false,
|
||||||
|
|
||||||
Components.ERI_ASSISTANT => false,
|
Components.ERI_ASSISTANT => false,
|
||||||
Components.BIAS_DAY_ASSISTANT => false,
|
Components.BIAS_DAY_ASSISTANT => false,
|
||||||
@ -186,6 +188,7 @@ public static class ComponentsExtensions
|
|||||||
// The provider is selected per policy instead. We do this inside the Document Analysis Assistant component.
|
// The provider is selected per policy instead. We do this inside the Document Analysis Assistant component.
|
||||||
Components.DOCUMENT_ANALYSIS_ASSISTANT => Settings.Provider.NONE,
|
Components.DOCUMENT_ANALYSIS_ASSISTANT => Settings.Provider.NONE,
|
||||||
|
|
||||||
|
Components.DYNAMIC_ASSISTANT => Components.CHAT.PreselectedProvider(settingsManager),
|
||||||
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Chat.PreselectedProvider) : null,
|
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Chat.PreselectedProvider) : null,
|
||||||
|
|
||||||
Components.AGENT_TEXT_CONTENT_CLEANER => settingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider) : null,
|
Components.AGENT_TEXT_CONTENT_CLEANER => settingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions ? settingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider) : null,
|
||||||
@ -212,6 +215,7 @@ public static class ComponentsExtensions
|
|||||||
Components.ERI_ASSISTANT => settingsManager.ConfigurationData.ERI.PreselectOptions ? settingsManager.ConfigurationData.ERI.PreselectedProfile : string.Empty,
|
Components.ERI_ASSISTANT => settingsManager.ConfigurationData.ERI.PreselectOptions ? settingsManager.ConfigurationData.ERI.PreselectedProfile : string.Empty,
|
||||||
Components.SLIDE_BUILDER_ASSISTANT => settingsManager.ConfigurationData.SlideBuilder.PreselectOptions ? settingsManager.ConfigurationData.SlideBuilder.PreselectedProfile : string.Empty,
|
Components.SLIDE_BUILDER_ASSISTANT => settingsManager.ConfigurationData.SlideBuilder.PreselectOptions ? settingsManager.ConfigurationData.SlideBuilder.PreselectedProfile : string.Empty,
|
||||||
Components.VISUAL_BRIEFING_ASSISTANT => settingsManager.ConfigurationData.VisualBriefing.PreselectedProfile,
|
Components.VISUAL_BRIEFING_ASSISTANT => settingsManager.ConfigurationData.VisualBriefing.PreselectedProfile,
|
||||||
|
Components.DYNAMIC_ASSISTANT => (string)Components.CHAT.GetProfilePreselection(settingsManager),
|
||||||
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.ConfigurationData.Chat.PreselectedProfile : string.Empty,
|
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.ConfigurationData.Chat.PreselectedProfile : string.Empty,
|
||||||
|
|
||||||
// The Document Analysis Assistant does not have a preselected profile at the component level.
|
// The Document Analysis Assistant does not have a preselected profile at the component level.
|
||||||
@ -226,6 +230,7 @@ public static class ComponentsExtensions
|
|||||||
|
|
||||||
public static ChatTemplate PreselectedChatTemplate(this Components component, SettingsManager settingsManager) => component switch
|
public static ChatTemplate PreselectedChatTemplate(this Components component, SettingsManager settingsManager) => component switch
|
||||||
{
|
{
|
||||||
|
Components.DYNAMIC_ASSISTANT => Components.CHAT.PreselectedChatTemplate(settingsManager),
|
||||||
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.GetChatTemplateById(settingsManager.ConfigurationData.Chat.PreselectedChatTemplate) : ChatTemplate.NO_CHAT_TEMPLATE,
|
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.GetChatTemplateById(settingsManager.ConfigurationData.Chat.PreselectedChatTemplate) : ChatTemplate.NO_CHAT_TEMPLATE,
|
||||||
|
|
||||||
_ => ChatTemplate.NO_CHAT_TEMPLATE,
|
_ => ChatTemplate.NO_CHAT_TEMPLATE,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user