mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 07:17:59 +00:00
Added opt-in sharing of feature usage with self-hosted servers (#1020)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
90c90910b3
commit
50aa11a34c
27 files changed
+531
-12
No files matched your search
@@ -46,6 +46,12 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
// session and media state separate while ComponentsExtensions derives their defaults from chat.
|
||||
protected override Tools.Components Component => Tools.Components.DYNAMIC_ASSISTANT;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// Empty for an assistant somebody built for themselves, see MayShareAssistantName.
|
||||
/// </remarks>
|
||||
protected override string RuntimeAssistantName => this.sharesAssistantName ? this.assistantPlugin?.Name ?? string.Empty : string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin ID as the assistant session instance ID.
|
||||
/// </summary>
|
||||
@@ -68,6 +74,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
private PluginAssistantAudit? audit;
|
||||
private string securityMessage = string.Empty;
|
||||
private bool isSecurityBlocked;
|
||||
private bool sharesAssistantName;
|
||||
private PluginAssistants? pendingChatLauncher;
|
||||
private const string ASSISTANT_QUERY_KEY = "assistantId";
|
||||
private static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
||||
@@ -87,6 +94,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
private static readonly AssistantSessionStateKey<PluginAssistantAudit?> AUDIT_STATE_KEY = new(nameof(audit));
|
||||
private static readonly AssistantSessionStateKey<string> SECURITY_MESSAGE_STATE_KEY = new(nameof(securityMessage));
|
||||
private static readonly AssistantSessionStateKey<bool> IS_SECURITY_BLOCKED_STATE_KEY = new(nameof(isSecurityBlocked));
|
||||
private static readonly AssistantSessionStateKey<bool> SHARES_ASSISTANT_NAME_STATE_KEY = new(nameof(sharesAssistantName));
|
||||
|
||||
private bool CanReviseCurrentAssistant => this.assistantPlugin is { IsInternal: false, IsManagedByConfigServer: false } && !string.IsNullOrWhiteSpace(this.assistantPlugin.PluginPath);
|
||||
|
||||
@@ -109,6 +117,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
state.Set(AUDIT_STATE_KEY, this.audit);
|
||||
state.Set(SECURITY_MESSAGE_STATE_KEY, this.securityMessage);
|
||||
state.Set(IS_SECURITY_BLOCKED_STATE_KEY, this.isSecurityBlocked);
|
||||
state.Set(SHARES_ASSISTANT_NAME_STATE_KEY, this.sharesAssistantName);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -130,6 +139,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
state.Restore(AUDIT_STATE_KEY, value => this.audit = value);
|
||||
state.Restore(SECURITY_MESSAGE_STATE_KEY, value => this.securityMessage = value);
|
||||
state.Restore(IS_SECURITY_BLOCKED_STATE_KEY, value => this.isSecurityBlocked = value);
|
||||
state.Restore(SHARES_ASSISTANT_NAME_STATE_KEY, value => this.sharesAssistantName = value);
|
||||
}
|
||||
|
||||
#region Implementation of AssistantBase
|
||||
@@ -177,6 +187,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
this.audit = this.SettingsManager.ConfigurationData.AssistantPluginAudits.FirstOrDefault(x => x.PluginId == pluginAssistant.Id && x.PluginHash == pluginHash);
|
||||
|
||||
var securityState = PluginAssistantSecurityResolver.Resolve(this.SettingsManager, pluginAssistant);
|
||||
this.sharesAssistantName = MayShareAssistantName(pluginAssistant, securityState);
|
||||
if (!securityState.CanStartAssistant)
|
||||
{
|
||||
this.assistantPlugin = pluginAssistant;
|
||||
@@ -374,6 +385,7 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
var securityState = PluginAssistantSecurityResolver.Resolve(this.SettingsManager, updatedPlugin);
|
||||
this.securityMessage = securityState.CanStartAssistant ? string.Empty : securityState.Description;
|
||||
this.isSecurityBlocked = !securityState.CanStartAssistant;
|
||||
this.sharesAssistantName = MayShareAssistantName(updatedPlugin, securityState);
|
||||
|
||||
this.assistantState.Clear();
|
||||
if (this.RootComponent is not null)
|
||||
@@ -382,6 +394,22 @@ public partial class AssistantDynamic : AssistantBaseCore<NoSettingsPanel>
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Whether requests may name this assistant plugin, e.g., in the User-Agent for self-hosted servers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only assistants from AI Studio itself or from the organization are named: those shipped with
|
||||
/// the app, rolled out by its configuration server, or approved by it. Everybody can build an
|
||||
/// assistant of their own with the Assistant Builder, and its name may well be personal, such as
|
||||
/// an application to one particular company. That name stays on the device; the request still
|
||||
/// names the component, so the operators can count it as an assistant all the same.
|
||||
/// </remarks>
|
||||
/// <param name="plugin">The assistant plugin.</param>
|
||||
/// <param name="securityState">Its security state, which tells whether the organization approved it.</param>
|
||||
/// <returns>True when its name may be shared; otherwise, false.</returns>
|
||||
private static bool MayShareAssistantName(PluginAssistants plugin, PluginAssistantSecurityState securityState) =>
|
||||
plugin.IsInternal || plugin.IsManagedByConfigServer || securityState.IsEnterpriseApproved;
|
||||
|
||||
/// <summary>
|
||||
/// Reads the tools this plugin names for its assistant.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user