mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 00:27:21 +00:00
Turned getter-like extension methods into extension properties (#1157)
This commit is contained in:
1 parent
0375318b1b
commit
f649febf88
286 files changed
+1379
-1109
No files matched your search
@@ -873,17 +873,17 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
||||
|
||||
if (!AllowsEmbedding(dataSource, embeddingProvider.GetConfidenceLevel(settingsManager)))
|
||||
{
|
||||
var errorMessage = dataSource is DataSourceMailbox && !dataSource.ConfidenceLevel.IsAllowedMailboxConfidence()
|
||||
var errorMessage = dataSource is DataSourceMailbox && !dataSource.ConfidenceLevel.IsAllowedMailboxConfidence
|
||||
? TB("The mailbox has no valid confidence level, so no provider may read it. Please choose one in the settings of the mailbox.")
|
||||
: string.Format(TB("The selected embedding provider is not allowed to index this data source. The data source asks for the confidence level '{0}', while the embedding provider has '{1}'."), dataSource.ConfidenceLevel.GetName(), embeddingProvider.GetConfidenceLevel(settingsManager).GetName());
|
||||
: string.Format(TB("The selected embedding provider is not allowed to index this data source. The data source asks for the confidence level '{0}', while the embedding provider has '{1}'."), dataSource.ConfidenceLevel.Name, embeddingProvider.GetConfidenceLevel(settingsManager).Name);
|
||||
logger.LogWarning(
|
||||
"Skipping background embeddings for data source '{DataSourceName}' ({DataSourceId}) because embedding provider '{EmbeddingProviderName}' ({EmbeddingProviderId}) does not meet the required confidence. RequiredConfidence={RequiredConfidence}, EmbeddingProviderConfidence={EmbeddingProviderConfidence}.",
|
||||
dataSource.Name,
|
||||
dataSource.Id,
|
||||
embeddingProvider.Name,
|
||||
embeddingProvider.Id,
|
||||
dataSource.ConfidenceLevel.GetName(),
|
||||
embeddingProvider.GetConfidenceLevel(settingsManager).GetName());
|
||||
dataSource.ConfidenceLevel.Name,
|
||||
embeddingProvider.GetConfidenceLevel(settingsManager).Name);
|
||||
|
||||
token.ThrowIfCancellationRequested();
|
||||
this.UpsertStatus(this.GetFallbackStatus(dataSource, errorMessage));
|
||||
|
||||
@@ -406,7 +406,7 @@ public sealed class DataSourceService
|
||||
{
|
||||
if (!provider.ConfidenceLevel.AllowsDataSourceConfidenceLevel(internalSource.ConfidenceLevel))
|
||||
{
|
||||
this.logger.LogWarning($"The internal data source '{source.Name}' (id={source.Id}) requires provider confidence '{internalSource.ConfidenceLevel.GetName()}'. The {provider.Role} only has confidence '{provider.ConfidenceLevel.GetName()}'. We skip this source.");
|
||||
this.logger.LogWarning($"The internal data source '{source.Name}' (id={source.Id}) requires provider confidence '{internalSource.ConfidenceLevel.Name}'. The {provider.Role} only has confidence '{provider.ConfidenceLevel.Name}'. We skip this source.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -420,7 +420,7 @@ public sealed class DataSourceService
|
||||
var embeddingProviderConfidence = embeddingProvider.GetConfidenceLevel(this.settingsManager);
|
||||
if (!embeddingProviderConfidence.AllowsDataSourceConfidenceLevel(internalSource.ConfidenceLevel))
|
||||
{
|
||||
this.logger.LogWarning($"The internal data source '{source.Name}' (id={source.Id}) requires provider confidence '{internalSource.ConfidenceLevel.GetName()}'. Its embedding provider '{embeddingProvider.Name}' only has confidence '{embeddingProviderConfidence.GetName()}'. We skip this source.");
|
||||
this.logger.LogWarning($"The internal data source '{source.Name}' (id={source.Id}) requires provider confidence '{internalSource.ConfidenceLevel.Name}'. Its embedding provider '{embeddingProvider.Name}' only has confidence '{embeddingProviderConfidence.Name}'. We skip this source.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ internal sealed class DocumentRunProgress(IndexedRunContext context, int totalDo
|
||||
break;
|
||||
}
|
||||
|
||||
case FileExtractionException extractionFailure when extractionFailure.Code.IsPermanentIndexingFailure():
|
||||
case FileExtractionException extractionFailure when extractionFailure.Code.IsPermanentIndexingFailure:
|
||||
{
|
||||
//
|
||||
// The document itself is why this failed, so trying it again changes nothing until
|
||||
|
||||
@@ -118,7 +118,7 @@ internal sealed partial class MailboxIndexer(SettingsManager settingsManager, Ru
|
||||
if (!policy.IsAllowed(mailbox.Host))
|
||||
{
|
||||
logger.LogInformation("Not connecting to mailbox '{MailboxId}' because the organization allows only its own mail servers, and this one is none of them.", mailbox.Id);
|
||||
(await this.CreateStoredStateProgressAsync(context, token)).PublishRunFailure(MailboxConnectionFailure.SERVER_NOT_ALLOWED.GetDescription(), DataSourceAttention.SERVER_NOT_ALLOWED);
|
||||
(await this.CreateStoredStateProgressAsync(context, token)).PublishRunFailure(MailboxConnectionFailure.SERVER_NOT_ALLOWED.Description, DataSourceAttention.SERVER_NOT_ALLOWED);
|
||||
return IndexedRunOutcome.DONE;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ internal sealed partial class MailboxIndexer(SettingsManager settingsManager, Ru
|
||||
progress.PublishRunFailure(GetAuthFailureMessage(failure), DataSourceAttention.AUTH_FAILED);
|
||||
}
|
||||
else
|
||||
progress.PublishRunFailure(e.Failure.GetDescription(), e.Failure is MailboxConnectionFailure.SERVER_NOT_ALLOWED ? DataSourceAttention.SERVER_NOT_ALLOWED : DataSourceAttention.NONE);
|
||||
progress.PublishRunFailure(e.Failure.Description, e.Failure is MailboxConnectionFailure.SERVER_NOT_ALLOWED ? DataSourceAttention.SERVER_NOT_ALLOWED : DataSourceAttention.NONE);
|
||||
|
||||
return IndexedRunOutcome.DONE;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ internal sealed partial class MailboxIndexer(SettingsManager settingsManager, Ru
|
||||
this.RecordConnectionFailure(mailbox.Id, e.Failure);
|
||||
await context.OptimizeCollectionIfNeededAsync("mailbox sync stopped", token);
|
||||
progress ??= await this.CreateStoredStateProgressAsync(context, token);
|
||||
progress.PublishRunFailure(e.Failure.GetDescription());
|
||||
progress.PublishRunFailure(e.Failure.Description);
|
||||
return IndexedRunOutcome.DONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ public sealed class MediaTranscriptionService(
|
||||
// unchanged when it already is a single mono 48 kHz Opus track in a WebM container and small
|
||||
// enough. Such a file keeps whatever bitrate it was made with, which is the better outcome --
|
||||
// re-encoding it could only take quality away, never add any.
|
||||
var opusBitrateBps = settingsManager.ConfigurationData.App.OpusBitrate.GetBitsPerSecond();
|
||||
var opusBitrateBps = settingsManager.ConfigurationData.App.OpusBitrate.BitsPerSecond;
|
||||
|
||||
// Which quality an upload was produced with is the first question to ask when a transcript
|
||||
// comes back missing something, so it has to be in the log of the job it belongs to:
|
||||
|
||||
@@ -247,7 +247,7 @@ public sealed partial class PluginInstallService
|
||||
private static string CreateDeleteBackupDirectory(IAvailablePlugin plugin)
|
||||
{
|
||||
var backupRoot = Path.Join(SettingsManager.DataDirectory, DELETE_BACKUP_DIRECTORY);
|
||||
return Path.Join(backupRoot, $"{plugin.Type.GetDirectory()}-{plugin.Id:N}-{Guid.NewGuid():N}");
|
||||
return Path.Join(backupRoot, $"{plugin.Type.Directory}-{plugin.Id:N}-{Guid.NewGuid():N}");
|
||||
}
|
||||
|
||||
private async Task TryRestoreDeletedPluginAsync(IAvailablePlugin plugin, string pluginDirectory, string backupDirectory, PluginDeleteSideEffects sideEffects, CancellationToken token)
|
||||
|
||||
@@ -133,7 +133,7 @@ public sealed partial class PluginInstallService
|
||||
return false;
|
||||
}
|
||||
|
||||
pluginRoot = Path.Join(dataDirectory, "plugins", pluginType.GetDirectory());
|
||||
pluginRoot = Path.Join(dataDirectory, "plugins", pluginType.Directory);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ public sealed partial class RustService
|
||||
// documentation/compatibility-shims/2026-06-self-hosted-secret-id.md
|
||||
private const string LEGACY_SELF_HOSTED_SECRET_ID_DE = "Selbst gehostet";
|
||||
|
||||
private static string APIKey(SecretStoreType storeType, ISecretId secretId) => $"{storeType.Prefix()}::{secretId.SecretId}::{secretId.SecretName}::api_key";
|
||||
private static string APIKey(SecretStoreType storeType, ISecretId secretId) => $"{storeType.Prefix}::{secretId.SecretId}::{secretId.SecretName}::api_key";
|
||||
|
||||
private static IEnumerable<string> LegacySelfHostedAPIKeys(ISecretId secretId, SecretStoreType storeType)
|
||||
{
|
||||
if (secretId.SecretId == SELF_HOSTED_SECRET_ID)
|
||||
yield return $"{storeType.Prefix()}::{LEGACY_SELF_HOSTED_SECRET_ID_DE}::{secretId.SecretName}::api_key";
|
||||
yield return $"{storeType.Prefix}::{LEGACY_SELF_HOSTED_SECRET_ID_DE}::{secretId.SecretName}::api_key";
|
||||
|
||||
if (secretId.SecretId == $"{ISecretId.ENTERPRISE_KEY_PREFIX}::{SELF_HOSTED_SECRET_ID}")
|
||||
yield return $"{storeType.Prefix()}::{ISecretId.ENTERPRISE_KEY_PREFIX}::{LEGACY_SELF_HOSTED_SECRET_ID_DE}::{secretId.SecretName}::api_key";
|
||||
yield return $"{storeType.Prefix}::{ISecretId.ENTERPRISE_KEY_PREFIX}::{LEGACY_SELF_HOSTED_SECRET_ID_DE}::{secretId.SecretName}::api_key";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -24,7 +24,7 @@ public sealed partial class RustService
|
||||
private static DeleteSecretResponse TranslateSecretStoreIssue(DeleteSecretResponse response) =>
|
||||
response.Success ? response : response with { Issue = TranslateSecretStoreIssue(response.IssueCode, response.Issue) };
|
||||
|
||||
private static string SecretKey(ISecretId secretId, SecretStoreType storeType) => $"{storeType.Prefix()}::{secretId.SecretId}::{secretId.SecretName}";
|
||||
private static string SecretKey(ISecretId secretId, SecretStoreType storeType) => $"{storeType.Prefix}::{secretId.SecretId}::{secretId.SecretName}";
|
||||
|
||||
private static string LegacySecretKey(ISecretId secretId) => $"secret::{secretId.SecretId}::{secretId.SecretName}";
|
||||
|
||||
|
||||
Reference in new issue
Block a user