mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-04 16:49:40 +00:00
Added missing document analysis assistant features (#644)
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (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) (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 updater) (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) (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 deb updater) (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 / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (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) (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 updater) (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) (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 deb updater) (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 / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
This commit is contained in:
1 parent
0f6a8c3247
commit
3d9e8a6f48
51 files changed
+861
-353
No files matched your search
@@ -80,6 +80,11 @@ public sealed class Data
|
||||
/// The next chat template number to use.
|
||||
/// </summary>
|
||||
public uint NextChatTemplateNum { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The next document analysis policy number to use.
|
||||
/// </summary>
|
||||
public uint NextDocumentAnalysisPolicyNum { get; set; } = 1;
|
||||
|
||||
public DataApp App { get; init; } = new(x => x.App);
|
||||
|
||||
|
||||
@@ -1,16 +1,37 @@
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
|
||||
using Lua;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataDocumentAnalysisPolicy
|
||||
public sealed record DataDocumentAnalysisPolicy : ConfigurationBaseObject
|
||||
{
|
||||
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataDocumentAnalysisPolicy>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Id { get; init; } = string.Empty;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override uint Num { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name
|
||||
{
|
||||
get => this.PolicyName;
|
||||
init => this.PolicyName = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsEnterpriseConfiguration { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the policy name?
|
||||
/// The name of the document analysis policy.
|
||||
/// </summary>
|
||||
public string PolicyName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the policy description?
|
||||
/// The description of the document analysis policy.
|
||||
/// </summary>
|
||||
public string PolicyDescription { get; set; } = string.Empty;
|
||||
|
||||
@@ -18,12 +39,9 @@ public sealed class DataDocumentAnalysisPolicy
|
||||
/// Is this policy protected? If so, it cannot be deleted or modified by the user.
|
||||
/// </summary>
|
||||
public bool IsProtected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is this a managed policy? Managed policies are created and managed by the organization
|
||||
/// and cannot be modified or deleted by the user.
|
||||
/// </summary>
|
||||
public bool IsManaged { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Guid EnterpriseConfigurationPluginId { get; init; } = Guid.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The rules for the document analysis policy.
|
||||
@@ -49,4 +67,86 @@ public sealed class DataDocumentAnalysisPolicy
|
||||
/// Preselect a profile?
|
||||
/// </summary>
|
||||
public string PreselectedProfile { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Hide the policy definition section in the UI?
|
||||
/// If true, the policy definition panel will be hidden and only the document selection will be shown.
|
||||
/// This is useful for enterprise configurations where users should not see or modify the policy details.
|
||||
/// </summary>
|
||||
public bool HidePolicyDefinition { get; set; }
|
||||
|
||||
public static bool TryProcessConfiguration(int idx, LuaTable table, Guid configPluginId, out ConfigurationBaseObject policy)
|
||||
{
|
||||
policy = new DataDocumentAnalysisPolicy();
|
||||
if (!table.TryGetValue("Id", out var idValue) || !idValue.TryRead<string>(out var idText) || !Guid.TryParse(idText, out var id))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} does not contain a valid ID. The ID must be a valid GUID.", idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!table.TryGetValue("PolicyName", out var nameValue) || !nameValue.TryRead<string>(out var name) || string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} does not contain a valid PolicyName field.", idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!table.TryGetValue("PolicyDescription", out var descriptionValue) || !descriptionValue.TryRead<string>(out var description) || string.IsNullOrWhiteSpace(description))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} does not contain a valid PolicyDescription field.", idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!table.TryGetValue("AnalysisRules", out var analysisRulesValue) || !analysisRulesValue.TryRead<string>(out var analysisRules) || string.IsNullOrWhiteSpace(analysisRules))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} does not contain valid AnalysisRules field.", idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!table.TryGetValue("OutputRules", out var outputRulesValue) || !outputRulesValue.TryRead<string>(out var outputRules) || string.IsNullOrWhiteSpace(outputRules))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} does not contain valid OutputRules field.", idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
var minimumConfidence = ConfidenceLevel.NONE;
|
||||
if (table.TryGetValue("MinimumProviderConfidence", out var minConfValue) && minConfValue.TryRead<string>(out var minConfText))
|
||||
{
|
||||
if (!Enum.TryParse(minConfText, true, out minimumConfidence))
|
||||
{
|
||||
LOG.LogWarning("The configured document analysis policy {PolicyIndex} contains an invalid MinimumProviderConfidence: {ConfidenceLevel}.", idx, minConfText);
|
||||
minimumConfidence = ConfidenceLevel.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
var preselectedProvider = string.Empty;
|
||||
if (table.TryGetValue("PreselectedProvider", out var providerValue) && providerValue.TryRead<string>(out var providerId))
|
||||
preselectedProvider = providerId;
|
||||
|
||||
var preselectedProfile = string.Empty;
|
||||
if (table.TryGetValue("PreselectedProfile", out var profileValue) && profileValue.TryRead<string>(out var profileId))
|
||||
preselectedProfile = profileId;
|
||||
|
||||
var hidePolicyDefinition = false;
|
||||
if (table.TryGetValue("HidePolicyDefinition", out var hideValue) && hideValue.TryRead<bool>(out var hide))
|
||||
hidePolicyDefinition = hide;
|
||||
|
||||
policy = new DataDocumentAnalysisPolicy
|
||||
{
|
||||
Id = id.ToString(),
|
||||
Num = 0, // will be set later by the PluginConfigurationObject
|
||||
PolicyName = name,
|
||||
PolicyDescription = description,
|
||||
AnalysisRules = analysisRules,
|
||||
OutputRules = outputRules,
|
||||
MinimumProviderConfidence = minimumConfidence,
|
||||
PreselectedProvider = preselectedProvider,
|
||||
PreselectedProfile = preselectedProfile,
|
||||
HidePolicyDefinition = hidePolicyDefinition,
|
||||
IsProtected = true,
|
||||
IsEnterpriseConfiguration = true,
|
||||
EnterpriseConfigurationPluginId = configPluginId,
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user