Skip to content

Commit 7d10bb0

Browse files
Applied several small fixes (#536)
1 parent 9ca2860 commit 7d10bb0

File tree

7 files changed

+103
-9
lines changed

7 files changed

+103
-9
lines changed

app/MindWork AI Studio.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FNV/@EntryIndexedValue">FNV</s:String>
66
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GWDG/@EntryIndexedValue">GWDG</s:String>
77
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HF/@EntryIndexedValue">HF</s:String>
8+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IERI/@EntryIndexedValue">IERI</s:String>
89
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LLM/@EntryIndexedValue">LLM</s:String>
910
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LM/@EntryIndexedValue">LM</s:String>
1011
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSG/@EntryIndexedValue">MSG</s:String>
@@ -20,6 +21,7 @@
2021
<s:Boolean x:Key="/Default/UserDictionary/Words/=groq/@EntryIndexedValue">True</s:Boolean>
2122
<s:Boolean x:Key="/Default/UserDictionary/Words/=gwdg/@EntryIndexedValue">True</s:Boolean>
2223
<s:Boolean x:Key="/Default/UserDictionary/Words/=huggingface/@EntryIndexedValue">True</s:Boolean>
24+
<s:Boolean x:Key="/Default/UserDictionary/Words/=ieri/@EntryIndexedValue">True</s:Boolean>
2325
<s:Boolean x:Key="/Default/UserDictionary/Words/=mwais/@EntryIndexedValue">True</s:Boolean>
2426
<s:Boolean x:Key="/Default/UserDictionary/Words/=ollama/@EntryIndexedValue">True</s:Boolean>
2527
<s:Boolean x:Key="/Default/UserDictionary/Words/=tauri_0027s/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

app/MindWork AI Studio/Assistants/AssistantBase.razor.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,17 @@ private async Task InnerResetForm()
384384

385385
protected override void DisposeResources()
386386
{
387-
this.formChangeTimer.Dispose();
387+
try
388+
{
389+
this.formChangeTimer.Stop();
390+
this.formChangeTimer.Dispose();
391+
}
392+
catch
393+
{
394+
// ignore
395+
}
396+
397+
base.DisposeResources();
388398
}
389399

390400
#endregion

app/MindWork AI Studio/Components/ConfigurationText.razor.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,23 @@ private async Task OptionChanged(string updatedText)
9292
await this.SettingsManager.StoreSettings();
9393
await this.InformAboutChange();
9494
}
95+
96+
#region Overrides of MSGComponentBase
97+
98+
protected override void DisposeResources()
99+
{
100+
try
101+
{
102+
this.timer.Stop();
103+
this.timer.Dispose();
104+
}
105+
catch
106+
{
107+
// ignore
108+
}
109+
110+
base.DisposeResources();
111+
}
112+
113+
#endregion
95114
}

app/MindWork AI Studio/Components/DebouncedTextField.razor.cs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace AIStudio.Components;
66

7-
public partial class DebouncedTextField : MudComponentBase
7+
public partial class DebouncedTextField : MudComponentBase, IDisposable
88
{
99
[Parameter]
1010
public string Label { get; set; } = string.Empty;
@@ -51,6 +51,7 @@ public partial class DebouncedTextField : MudComponentBase
5151
private readonly Timer debounceTimer = new();
5252
private string text = string.Empty;
5353
private string lastParameterText = string.Empty;
54+
private bool isInitialized;
5455

5556
#region Overrides of ComponentBase
5657

@@ -68,20 +69,30 @@ protected override async Task OnInitializedAsync()
6869
this.InvokeAsync(() => this.WhenTextCanged(this.text));
6970
};
7071

72+
this.isInitialized = true;
7173
await base.OnInitializedAsync();
7274
}
7375

74-
protected override void OnParametersSet()
76+
protected override async Task OnParametersSetAsync()
7577
{
78+
// Ensure the timer uses the latest debouncing interval:
79+
if (!this.isInitialized)
80+
return;
81+
82+
if(Math.Abs(this.debounceTimer.Interval - this.DebounceTime.TotalMilliseconds) > 1)
83+
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
84+
7685
// Only sync when the parent's parameter actually changed since the last change:
7786
if (this.Text != this.lastParameterText)
7887
{
7988
this.text = this.Text;
8089
this.lastParameterText = this.Text;
81-
82-
this.debounceTimer.Stop();
83-
this.debounceTimer.Start();
8490
}
91+
92+
this.debounceTimer.Stop();
93+
this.debounceTimer.Start();
94+
95+
await base.OnParametersSetAsync();
8596
}
8697

8798
#endregion
@@ -92,4 +103,21 @@ private void OnTextChanged(string value)
92103
this.debounceTimer.Stop();
93104
this.debounceTimer.Start();
94105
}
106+
107+
#region IDisposable
108+
109+
public void Dispose()
110+
{
111+
try
112+
{
113+
this.debounceTimer.Stop();
114+
this.debounceTimer.Dispose();
115+
}
116+
catch
117+
{
118+
// ignore
119+
}
120+
}
121+
122+
#endregion
95123
}

app/MindWork AI Studio/Pages/Chat.razor.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ private async Task OpenWorkspacesSettingsDialog()
100100

101101
#region Overrides of MSGComponentBase
102102

103+
protected override void DisposeResources()
104+
{
105+
try
106+
{
107+
this.splitterSaveTimer.Stop();
108+
this.splitterSaveTimer.Dispose();
109+
}
110+
catch
111+
{
112+
// ignore
113+
}
114+
115+
base.DisposeResources();
116+
}
117+
118+
#endregion
119+
103120
protected override Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
104121
{
105122
switch (triggeredEvent)
@@ -111,6 +128,4 @@ private async Task OpenWorkspacesSettingsDialog()
111128

112129
return Task.CompletedTask;
113130
}
114-
115-
#endregion
116131
}

app/MindWork AI Studio/Pages/Writer.razor.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,23 @@ private void AcceptNextWord()
152152
this.suggestion = string.Join(' ', words.Skip(1));
153153
this.StateHasChanged();
154154
}
155+
156+
#region Overrides of MSGComponentBase
157+
158+
protected override void DisposeResources()
159+
{
160+
try
161+
{
162+
this.typeTimer.Stop();
163+
this.typeTimer.Dispose();
164+
}
165+
catch
166+
{
167+
// ignore
168+
}
169+
170+
base.DisposeResources();
171+
}
172+
173+
#endregion
155174
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# v0.9.51, build 226 (2025-08-xx xx:xx UTC)
2-
- Fixed a bug in various assistants where some text fields were not reset when resetting.
2+
- Improved memory usage in several areas of the app.
3+
- Fixed a bug in various assistants where some text fields were not reset when resetting.

0 commit comments

Comments
 (0)