Clean up compiler and inspection warnings

This commit is contained in:
Thorsten Sommer committed 2026-09-06 13:26:56 +02:00
1 parent d3a40e999c
commit fb8e37aaf3
18 files changed
+19 -24

No files matched your search

+4
View File
@@ -1,4 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<!-- The local RAG index store is SQLite, where TEXT is stored dynamically. HasMaxLength() has no
effect there, while picking arbitrary limits for paths or chunk texts would turn into real
storage errors as soon as somebody indexes a deeply nested folder or a long document. -->
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EntityFramework_002EModelValidation_002EUnlimitedStringLength/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AI/@EntryIndexedValue">AI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EDI/@EntryIndexedValue">EDI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ERI/@EntryIndexedValue">ERI</s:String>
@@ -1,7 +1,5 @@
using AIStudio.Assistants.ERI;
using AIStudio.Components;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
using AIStudio.Tools.ERIClient;
using AIStudio.Tools.ERIClient.DataModel;
@@ -137,7 +137,7 @@ public partial class DataSourceLocalDirectoryDialog : MSGComponentBase
? T("No embedding selected")
: string.IsNullOrWhiteSpace(this.SelectedEmbedding.TokenizerPath)
? T("Default tokenizer")
: System.IO.Path.GetFileName(this.SelectedEmbedding.TokenizerPath);
: Path.GetFileName(this.SelectedEmbedding.TokenizerPath);
private int ProviderMaxChunkTokenLength => this.SelectedEmbedding?.EffectiveTokenLimit ?? EmbeddingProvider.DEFAULT_TOKEN_LIMIT;
@@ -1,4 +1,3 @@
@using AIStudio.Settings.DataModel
@using AIStudio.Provider
@inherits MSGComponentBase
@@ -137,7 +137,7 @@ public partial class DataSourceLocalFileDialog : MSGComponentBase
? T("No embedding selected")
: string.IsNullOrWhiteSpace(this.SelectedEmbedding.TokenizerPath)
? T("Default tokenizer")
: System.IO.Path.GetFileName(this.SelectedEmbedding.TokenizerPath);
: Path.GetFileName(this.SelectedEmbedding.TokenizerPath);
private int ProviderMaxChunkTokenLength => this.SelectedEmbedding?.EffectiveTokenLimit ?? EmbeddingProvider.DEFAULT_TOKEN_LIMIT;
@@ -1,4 +1,3 @@
@using AIStudio.Settings.DataModel
@using AIStudio.Provider
@inherits MSGComponentBase
@@ -1,7 +1,6 @@
@using AIStudio.Provider
@using AIStudio.Provider.HuggingFace
@using AIStudio.Provider.SelfHosted
@using AIStudio.Tools.Rust
@inherits MSGComponentBase
<MudDialog>
@@ -1,7 +1,6 @@
@using AIStudio.Provider
@using AIStudio.Provider.HuggingFace
@using AIStudio.Provider.SelfHosted
@using AIStudio.Tools.Rust
@inherits MSGComponentBase
<MudDialog>
<DialogContent>
@@ -1,4 +1,3 @@
using System.Runtime.CompilerServices;
using AIStudio.Dialogs;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
@@ -84,7 +83,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
private DataSourceEmbeddingOverview embeddingOverview = new(false, DataSourceEmbeddingState.COMPLETED, 0, 0, 0);
private IReadOnlyCollection<NavBarItem> navItems = [];
private NavBarItem embeddingItem = new (string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, false);
private bool showEmbeddingStatusIcon = false;
private bool showEmbeddingStatusIcon;
#region Overrides of ComponentBase
@@ -213,7 +213,7 @@ CONFIG["EMBEDDING_PROVIDERS"] = {}
--
-- -- Optional: Encrypted API key (see LLM_PROVIDERS example for details)
-- -- ["APIKey"] = "ENC:v1:<base64-encoded encrypted data>",
--
-- -- Optional: tokenizer path for this provider relative to the plugin directory.
-- -- ["TokenizerPath"] = "",
--
@@ -4,7 +4,7 @@ using AIStudio.Tools.Services;
namespace AIStudio.Tools.Databases;
public sealed partial class DatabaseClientProvider(RustService rustService, ILoggerFactory loggerFactory) : IDisposable
public sealed class DatabaseClientProvider(RustService rustService, ILoggerFactory loggerFactory) : IDisposable
{
private readonly Dictionary<DatabaseRole, DatabaseClient> clients = new();
private readonly Dictionary<DatabaseRole, SemaphoreSlim> locks = new();
@@ -5,6 +5,9 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
namespace AIStudio.Tools.Databases.IndexStore.Migrations;
// EF Core writes this file and declares the type as partial. Dropping the keyword would only
// last until the next migration is added, so the inspection is silenced instead.
// ReSharper disable once PartialTypeWithSinglePart
[DbContext(typeof(IndexStoreDbContext))]
partial class IndexStoreDbContextModelSnapshot : ModelSnapshot
{
@@ -6,7 +6,6 @@ using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
using AIStudio.Tools.Databases.IndexStore;
using AIStudio.Tools.PluginSystem;
using AIStudio.Tools.Rust;
namespace AIStudio.Tools.Services;
@@ -242,7 +241,7 @@ public sealed partial class DataSourceEmbeddingService
minimumCandidateUnitCount = searchedMaximumCandidateUnitCount + 1;
maximumCandidateUnitCount = (int)Math.Min(
availableUnitCount,
Math.Max((long)minimumCandidateUnitCount, (long)searchedMaximumCandidateUnitCount * 2));
Math.Max(minimumCandidateUnitCount, (long)searchedMaximumCandidateUnitCount * 2));
}
return largestValidUnitCount;
@@ -282,7 +281,7 @@ public sealed partial class DataSourceEmbeddingService
foreach (var unit in units)
{
consumedLength += unit.Length;
var tokenCountAtBoundary = (int)Math.Min(sourceTokenCount.Value, (long)sourceTokenCount.Value * consumedLength / totalLength);
var tokenCountAtBoundary = (int)Math.Min(sourceTokenCount.Value, sourceTokenCount.Value * consumedLength / totalLength);
result.Add(Math.Max(0, tokenCountAtBoundary - allocatedTokenCount));
allocatedTokenCount = tokenCountAtBoundary;
}
@@ -455,7 +454,6 @@ public sealed partial class DataSourceEmbeddingService
}
var chunk = AddOverlapPrefix(text[startIndex..bestEndIndex].Trim(), overlapPrefix);
overlapPrefix = string.Empty;
if (!string.IsNullOrWhiteSpace(chunk))
yield return chunk;
@@ -960,7 +958,7 @@ public sealed partial class DataSourceEmbeddingService
{
DataSourceLocalFile localFile => indexedFiles.Count > 0
? fileHashes[indexedFiles[0].FullName]
: BuildMetadataHash("file", localFile.FilePath, Path.GetFileName(localFile.FilePath) ?? string.Empty, "missing", "0"),
: BuildMetadataHash("file", localFile.FilePath, Path.GetFileName(localFile.FilePath), "missing", "0"),
DataSourceLocalDirectory localDirectory => this.BuildDirectoryMetadataHash(localDirectory, indexedFiles, fileHashes),
@@ -1,5 +1,4 @@
using System.Collections.Concurrent;
using System.Threading;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Channels;
using AIStudio.Provider;
@@ -43,10 +43,10 @@ public sealed class DataSourceLocalRetrievalService(
int ConfidenceLevelRank);
public Task<IReadOnlyList<IRetrievalContext>> RetrieveDataAsync(DataSourceLocalFile dataSource, IContent lastUserPrompt, ChatThread thread, CancellationToken token = default) =>
this.RetrieveDataAsync((IInternalDataSource)dataSource, lastUserPrompt, token);
this.RetrieveDataAsync(dataSource, lastUserPrompt, token);
public Task<IReadOnlyList<IRetrievalContext>> RetrieveDataAsync(DataSourceLocalDirectory dataSource, IContent lastUserPrompt, ChatThread thread, CancellationToken token = default) =>
this.RetrieveDataAsync((IInternalDataSource)dataSource, lastUserPrompt, token);
this.RetrieveDataAsync(dataSource, lastUserPrompt, token);
private async Task<IReadOnlyList<IRetrievalContext>> RetrieveDataAsync(IInternalDataSource dataSource, IContent lastUserPrompt, CancellationToken token)
{
@@ -3,7 +3,6 @@ using System.Text.Json;
using System.Runtime.CompilerServices;
using AIStudio.Settings;
using AIStudio.Tools.Rust;
using AIStudio.Tools.Security;
namespace AIStudio.Tools.Services;
@@ -303,7 +302,7 @@ public sealed partial class RustService
yield break;
}
string? finalContentChunk = null;
string? finalContentChunk;
try
{
await using var stream = await response.Content.ReadAsStreamAsync(token);
@@ -72,7 +72,7 @@ public sealed partial class RustService
private async Task<TokenizerResponse?> GetTokenCount(string providerName, string tokenizerPath, string text, CancellationToken cancellationToken)
{
var result = await this.http.PostAsJsonAsync("/tokenizer/count", new {
text = text,
text,
tokenizer_path = tokenizerPath,
}, this.jsonRustSerializerOptions, cancellationToken);