Propagate the data service to the common mid-level AI generation code for RAG

This commit is contained in:
tsommer committed 2025-02-14 13:00:38 +01:00
1 parent 63113cad50
commit 5ee7f2f2f1
8 files changed
+26 -9

No files matched your search

+5 -1
View File
@@ -1,6 +1,7 @@
using AIStudio.Chat;
using AIStudio.Components;
using AIStudio.Provider;
using AIStudio.Tools.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
@@ -14,6 +15,9 @@ public partial class Writer : MSGComponentBase, IAsyncDisposable
[Inject]
private ILogger<Chat> Logger { get; init; } = null!;
[Inject]
private DataSourceService DataSourceService { get; init; } = null!;
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
private readonly Timer typeTimer = new(TimeSpan.FromMilliseconds(1_500));
@@ -139,7 +143,7 @@ public partial class Writer : MSGComponentBase, IAsyncDisposable
this.isStreaming = true;
this.StateHasChanged();
await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(this.Logger), this.SettingsManager, this.providerSettings.Model, lastUserPrompt, this.chatThread);
await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(this.Logger), this.SettingsManager, this.DataSourceService, this.providerSettings.Model, lastUserPrompt, this.chatThread);
this.suggestion = aiText.Text;
this.isStreaming = false;