Added thread-safe random class

This commit is contained in:
tsommer committed 2024-07-30 20:22:43 +02:00
1 parent 2cea53d2a9
commit b74fd644ff
5 files changed
+93 -4

No files matched your search

@@ -1,6 +1,7 @@
using AIStudio.Chat;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Tools;
using Microsoft.AspNetCore.Components;
@@ -15,7 +16,7 @@ public abstract partial class AssistantBase : ComponentBase
protected IJSRuntime JsRuntime { get; init; } = null!;
[Inject]
protected Random RNG { get; set; } = null!;
protected ThreadSafeRandom RNG { get; init; } = null!;
protected abstract string Title { get; }
@@ -22,7 +22,7 @@ public partial class Workspaces : ComponentBase
private IDialogService DialogService { get; set; } = null!;
[Inject]
public Random RNG { get; set; } = null!;
private ThreadSafeRandom RNG { get; init; } = null!;
[Parameter]
public ChatThread? CurrentChatThread { get; set; }
@@ -25,7 +25,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
public IJSRuntime JsRuntime { get; init; } = null!;
[Inject]
public Random RNG { get; set; } = null!;
private ThreadSafeRandom RNG { get; init; } = null!;
[Inject]
public IDialogService DialogService { get; set; } = null!;