@foreach (var line in this.displayLines)
{
-
+
@line.Number
@((MarkupString)this.RenderLine(line))
diff --git a/app/MindWork AI Studio/Assistants/LogViewer/AssistantLogViewer.razor.cs b/app/MindWork AI Studio/Assistants/LogViewer/AssistantLogViewer.razor.cs
index 23c7ce09..0569a74e 100644
--- a/app/MindWork AI Studio/Assistants/LogViewer/AssistantLogViewer.razor.cs
+++ b/app/MindWork AI Studio/Assistants/LogViewer/AssistantLogViewer.razor.cs
@@ -7,6 +7,7 @@ using AIStudio.Tools.Rust;
using AIStudio.Tools.Services;
using Microsoft.AspNetCore.Components;
+// ReSharper disable NotAccessedPositionalProperty.Local
namespace AIStudio.Assistants.LogViewer;
@@ -26,9 +27,9 @@ public partial class AssistantLogViewer : MSGComponentBase
["TRACE"] = 7,
};
- private const int DEFAULT_MAX_LINES = 5000;
- protected const int MIN_MAX_LINES = 100;
- protected const int MAX_MAX_LINES = 100000;
+ private const int DEFAULT_MAX_LINES = 5_000;
+ private const int MIN_MAX_LINES = 100;
+ private const int MAX_MAX_LINES = 100_000;
private const string OTHER_OPTION_VALUE = "__OTHER__";
[Inject]
@@ -43,6 +44,10 @@ public partial class AssistantLogViewer : MSGComponentBase
[Inject]
private ILogger
Logger { get; init; } = null!;
+ private readonly HashSet selectedLogLevels = new(StringComparer.OrdinalIgnoreCase);
+ private readonly HashSet selectedLoggers = new(StringComparer.OrdinalIgnoreCase);
+ private readonly HashSet selectedSourceDetails = new(StringComparer.OrdinalIgnoreCase);
+
private GetLogPathsResponse logPaths;
private LogFileKind selectedLogFile = LogFileKind.APP;
private List loadedLines = [];
@@ -50,9 +55,7 @@ public partial class AssistantLogViewer : MSGComponentBase
private List logLevelOptions = [OTHER_OPTION_VALUE];
private List loggerOptions = [OTHER_OPTION_VALUE];
private List sourceDetailOptions = [OTHER_OPTION_VALUE];
- private HashSet selectedLogLevels = new(StringComparer.OrdinalIgnoreCase);
- private HashSet selectedLoggers = new(StringComparer.OrdinalIgnoreCase);
- private HashSet selectedSourceDetails = new(StringComparer.OrdinalIgnoreCase);
+
private string[] activeSearchTerms = [];
private CancellationTokenSource? autoRefreshCancellationTokenSource;
private string filterText = string.Empty;
@@ -141,13 +144,13 @@ public partial class AssistantLogViewer : MSGComponentBase
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
-
if (!this.SettingsManager.IsAssistantVisible(Tools.Components.LOG_VIEWER_ASSISTANT, assistantName: T("Log Viewer")))
{
this.NavigationManager.NavigateTo(Routes.ASSISTANTS);
return;
}
+ this.logPaths = await this.RustService.GetLogPaths();
await this.RefreshLogAsync();
}
@@ -189,7 +192,6 @@ public partial class AssistantLogViewer : MSGComponentBase
private async Task AutoRefreshChanged(bool value)
{
this.autoRefresh = value;
-
if (this.autoRefresh)
this.StartAutoRefresh();
else
@@ -210,21 +212,6 @@ public partial class AssistantLogViewer : MSGComponentBase
private async Task OpenCurrentLogInFileManager()
{
- try
- {
- this.logPaths = await this.RustService.GetLogPaths();
- }
- catch (Exception e)
- {
- this.Logger.LogWarning(e, "Could not refresh the log file paths before opening the file manager.");
- this.Snackbar.Add(T("The log file path is not available yet."), Severity.Warning, config =>
- {
- config.Icon = Icons.Material.Filled.Folder;
- config.IconSize = Size.Large;
- });
- return;
- }
-
var path = this.CurrentLogPath;
if (string.IsNullOrWhiteSpace(path))
{
@@ -290,9 +277,7 @@ public partial class AssistantLogViewer : MSGComponentBase
try
{
- this.logPaths = await this.RustService.GetLogPaths();
var path = this.CurrentLogPath;
-
if (string.IsNullOrWhiteSpace(path))
{
this.loadedLines = [];
@@ -450,7 +435,7 @@ public partial class AssistantLogViewer : MSGComponentBase
return parts.Count == 0 ? string.Empty : string.Join(" ", parts);
}
- private string GetLineClass(LogLine line)
+ private static string GetLineClass(LogLine line)
{
var level = line.Segments.Level ?? string.Empty;
@@ -621,7 +606,7 @@ public partial class AssistantLogViewer : MSGComponentBase
private static bool IsSourceDetails(string content)
{
- return content.Contains("=", StringComparison.Ordinal);
+ return content.Contains('=', StringComparison.Ordinal);
}
private static int SkipWhiteSpace(string text, int start)
@@ -779,10 +764,4 @@ public partial class AssistantLogViewer : MSGComponentBase
private readonly record struct LogSnapshot(List Lines, int TotalLineCount, int SkippedLineCount);
private readonly record struct HighlightRange(int Start, int Length);
-}
-
-public enum LogFileKind
-{
- APP,
- STARTUP,
-}
+}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Assistants/LogViewer/LogFileKind.cs b/app/MindWork AI Studio/Assistants/LogViewer/LogFileKind.cs
new file mode 100644
index 00000000..8b453ecd
--- /dev/null
+++ b/app/MindWork AI Studio/Assistants/LogViewer/LogFileKind.cs
@@ -0,0 +1,7 @@
+namespace AIStudio.Assistants.LogViewer;
+
+public enum LogFileKind
+{
+ APP,
+ STARTUP,
+}
\ No newline at end of file