mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 16:17:59 +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
@@ -229,11 +229,15 @@ public sealed class ContentText : IContent
|
||||
|
||||
if(this.FileAttachments.Count > 0)
|
||||
{
|
||||
var normalizedAttachments = this.FileAttachments
|
||||
.Select(attachment => attachment.Normalize())
|
||||
.ToList();
|
||||
|
||||
// Get the list of existing documents:
|
||||
var existingDocuments = this.FileAttachments.Where(x => x.Type is FileAttachmentType.DOCUMENT && x.Exists).ToList();
|
||||
var existingDocuments = normalizedAttachments.Where(x => x.Type is FileAttachmentType.DOCUMENT && x.Exists).ToList();
|
||||
|
||||
// Log warning for missing files:
|
||||
var missingDocuments = this.FileAttachments.Except(existingDocuments).Where(x => x.Type is FileAttachmentType.DOCUMENT).ToList();
|
||||
var missingDocuments = normalizedAttachments.Except(existingDocuments).Where(x => x.Type is FileAttachmentType.DOCUMENT).ToList();
|
||||
if (missingDocuments.Count > 0)
|
||||
foreach (var missingDocument in missingDocuments)
|
||||
LOGGER.LogWarning("File attachment no longer exists and will be skipped: '{MissingDocument}'.", missingDocument.FilePath);
|
||||
@@ -269,7 +273,7 @@ public sealed class ContentText : IContent
|
||||
sb.AppendLine("````");
|
||||
}
|
||||
|
||||
var numImages = this.FileAttachments.Count(x => x is { IsImage: true, Exists: true });
|
||||
var numImages = normalizedAttachments.Count(x => x is { IsImage: true, Exists: true });
|
||||
if (numImages > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
|
||||
Reference in new issue
Block a user