Clean up of the code

This commit is contained in:
PaulKoudelka 2026-02-27 10:40:18 +01:00
parent 347600d970
commit 48da1b1563
2 changed files with 3 additions and 9 deletions

View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
using MudBlazor;
namespace AIStudio.Components; namespace AIStudio.Components;
@ -14,9 +13,6 @@ public class UserPromptComponent<T> : MudTextField<T>
[Parameter] [Parameter]
public TimeSpan DebounceTime { get; set; } = TimeSpan.FromMilliseconds(800); public TimeSpan DebounceTime { get; set; } = TimeSpan.FromMilliseconds(800);
// Use base Text / TextChanged from MudTextField; do not redeclare to avoid duplicate parameters.
// Text binding is handled through those base members; we only add debouncing behavior.
[Parameter] [Parameter]
public Func<string, Task> WhenTextChangedAsync { get; set; } = _ => Task.CompletedTask; public Func<string, Task> WhenTextChangedAsync { get; set; } = _ => Task.CompletedTask;
@ -29,8 +25,8 @@ public class UserPromptComponent<T> : MudTextField<T>
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
this.text = this.Text ?? string.Empty; this.text = this.Text ?? string.Empty;
this.lastParameterText = this.Text ?? string.Empty; this.lastParameterText = this.text;
this.lastNotifiedText = this.Text ?? string.Empty; this.lastNotifiedText = this.text;
this.debounceTimer.AutoReset = false; this.debounceTimer.AutoReset = false;
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds; this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
this.debounceTimer.Elapsed += (_, _) => this.debounceTimer.Elapsed += (_, _) =>
@ -61,7 +57,7 @@ public class UserPromptComponent<T> : MudTextField<T>
if (this.Text != this.lastParameterText) if (this.Text != this.lastParameterText)
{ {
this.text = this.Text ?? string.Empty; this.text = this.Text ?? string.Empty;
this.lastParameterText = this.Text ?? string.Empty; this.lastParameterText = this.text;
} }
this.debounceTimer.Stop(); this.debounceTimer.Stop();

View File

@ -42,9 +42,7 @@ pptx-to-md = "0.4.0"
tempfile = "3.8" tempfile = "3.8"
strum_macros = "0.27" strum_macros = "0.27"
sysinfo = "0.38.0" sysinfo = "0.38.0"
tiktoken-rs = "0.9.1"
tokenizers = "0.22.2" tokenizers = "0.22.2"
hf-hub = "0.4.3"
# Fixes security vulnerability downstream, where the upstream is not fixed yet: # Fixes security vulnerability downstream, where the upstream is not fixed yet:
time = "0.3.47" # -> Rocket time = "0.3.47" # -> Rocket