Added retrieval integration, part I (#281)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-02-10 18:49:22 +01:00
1 parent e973b51f75
commit 954cf44939
18 files changed
+477 -31

No files matched your search

+8 -6
View File
@@ -106,17 +106,19 @@ public partial class Writer : MSGComponentBase, IAsyncDisposable
};
var time = DateTimeOffset.Now;
var lastUserPrompt = new ContentText
{
// We use the maximum 160 characters from the end of the text:
Text = this.userInput.Length > 160 ? this.userInput[^160..] : this.userInput,
};
this.chatThread.Blocks.Clear();
this.chatThread.Blocks.Add(new ContentBlock
{
Time = time,
ContentType = ContentType.TEXT,
Role = ChatRole.USER,
Content = new ContentText
{
// We use the maximum 160 characters from the end of the text:
Text = this.userInput.Length > 160 ? this.userInput[^160..] : this.userInput,
},
Content = lastUserPrompt,
});
var aiText = new ContentText
@@ -137,7 +139,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, this.chatThread);
await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(this.Logger), this.SettingsManager, this.providerSettings.Model, lastUserPrompt, this.chatThread);
this.suggestion = aiText.Text;
this.isStreaming = false;