mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-03-30 20:11:37 +00:00
Clean up of the code
This commit is contained in:
parent
347600d970
commit
48da1b1563
@ -1,6 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Timer = System.Timers.Timer;
|
||||
using MudBlazor;
|
||||
|
||||
namespace AIStudio.Components;
|
||||
|
||||
@ -14,9 +13,6 @@ public class UserPromptComponent<T> : MudTextField<T>
|
||||
[Parameter]
|
||||
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]
|
||||
public Func<string, Task> WhenTextChangedAsync { get; set; } = _ => Task.CompletedTask;
|
||||
|
||||
@ -29,8 +25,8 @@ public class UserPromptComponent<T> : MudTextField<T>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.text = this.Text ?? string.Empty;
|
||||
this.lastParameterText = this.Text ?? string.Empty;
|
||||
this.lastNotifiedText = this.Text ?? string.Empty;
|
||||
this.lastParameterText = this.text;
|
||||
this.lastNotifiedText = this.text;
|
||||
this.debounceTimer.AutoReset = false;
|
||||
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
|
||||
this.debounceTimer.Elapsed += (_, _) =>
|
||||
@ -61,7 +57,7 @@ public class UserPromptComponent<T> : MudTextField<T>
|
||||
if (this.Text != this.lastParameterText)
|
||||
{
|
||||
this.text = this.Text ?? string.Empty;
|
||||
this.lastParameterText = this.Text ?? string.Empty;
|
||||
this.lastParameterText = this.text;
|
||||
}
|
||||
|
||||
this.debounceTimer.Stop();
|
||||
|
||||
@ -42,9 +42,7 @@ pptx-to-md = "0.4.0"
|
||||
tempfile = "3.8"
|
||||
strum_macros = "0.27"
|
||||
sysinfo = "0.38.0"
|
||||
tiktoken-rs = "0.9.1"
|
||||
tokenizers = "0.22.2"
|
||||
hf-hub = "0.4.3"
|
||||
|
||||
# Fixes security vulnerability downstream, where the upstream is not fixed yet:
|
||||
time = "0.3.47" # -> Rocket
|
||||
|
||||
Loading…
Reference in New Issue
Block a user