mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 21:33:47 +00:00
Integrated data sources into any chat (#282)
This commit is contained in:
1 parent
954cf44939
commit
f4780939fc
70 files changed
+1506
-250
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.ERIClient.DataModel;
|
||||
|
||||
namespace AIStudio.Tools.Validation;
|
||||
@@ -11,6 +12,8 @@ public sealed class DataSourceValidation
|
||||
public Func<IEnumerable<string>> GetUsedDataSourceNames { get; init; } = () => [];
|
||||
|
||||
public Func<AuthMethod> GetAuthMethod { get; init; } = () => AuthMethod.NONE;
|
||||
|
||||
public Func<SecurityRequirements?> GetSecurityRequirements { get; init; } = () => null;
|
||||
|
||||
public Func<bool> GetSelectedCloudEmbedding { get; init; } = () => false;
|
||||
|
||||
@@ -42,6 +45,21 @@ public sealed class DataSourceValidation
|
||||
return null;
|
||||
}
|
||||
|
||||
public string? ValidateSecurityPolicy(DataSourceSecurity securityPolicy)
|
||||
{
|
||||
if(securityPolicy is DataSourceSecurity.NOT_SPECIFIED)
|
||||
return "Please select your security policy.";
|
||||
|
||||
var dataSourceSecurity = this.GetSecurityRequirements();
|
||||
if (dataSourceSecurity is null)
|
||||
return null;
|
||||
|
||||
if(dataSourceSecurity.Value.AllowedProviderType is ProviderType.SELF_HOSTED && securityPolicy is not DataSourceSecurity.SELF_HOSTED)
|
||||
return "This data source can only be used with a self-hosted LLM provider. Please change the security policy.";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string? ValidateUsername(string username)
|
||||
{
|
||||
if(this.GetAuthMethod() is not AuthMethod.USERNAME_PASSWORD)
|
||||
|
||||
Reference in new issue
Block a user