mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 15:18:00 +00:00
Fixed issues with stored paths in chat templates (#727)
This commit is contained in:
1 parent
e49973497c
commit
c325ba0787
5 files changed
+23
-8
No files matched your search
@@ -94,7 +94,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
|
||||
// Apply template's file attachments, if any:
|
||||
foreach (var attachment in this.currentChatTemplate.FileAttachments)
|
||||
this.chatDocumentPaths.Add(attachment);
|
||||
this.chatDocumentPaths.Add(attachment.Normalize());
|
||||
|
||||
//
|
||||
// Check for deferred messages of the kind 'SEND_TO_CHAT',
|
||||
@@ -392,7 +392,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
// Apply template's file attachments (replaces existing):
|
||||
this.chatDocumentPaths.Clear();
|
||||
foreach (var attachment in this.currentChatTemplate.FileAttachments)
|
||||
this.chatDocumentPaths.Add(attachment);
|
||||
this.chatDocumentPaths.Add(attachment.Normalize());
|
||||
|
||||
if(this.ChatThread is null)
|
||||
return;
|
||||
@@ -538,10 +538,15 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
IContent? lastUserPrompt;
|
||||
if (!reuseLastUserPrompt)
|
||||
{
|
||||
var normalizedAttachments = this.chatDocumentPaths
|
||||
.Select(attachment => attachment.Normalize())
|
||||
.Where(attachment => attachment.IsValid)
|
||||
.ToList();
|
||||
|
||||
lastUserPrompt = new ContentText
|
||||
{
|
||||
Text = this.userInput,
|
||||
FileAttachments = [..this.chatDocumentPaths.Where(x => x.IsValid)],
|
||||
FileAttachments = normalizedAttachments,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -764,7 +769,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
||||
// Apply template's file attachments:
|
||||
this.chatDocumentPaths.Clear();
|
||||
foreach (var attachment in this.currentChatTemplate.FileAttachments)
|
||||
this.chatDocumentPaths.Add(attachment);
|
||||
this.chatDocumentPaths.Add(attachment.Normalize());
|
||||
|
||||
// Now, we have to reset the data source options as well:
|
||||
this.ApplyStandardDataSourceOptions();
|
||||
|
||||
Reference in new issue
Block a user