mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 04:27:21 +00:00
Improved how the AI remembers its earlier tool calls (#1185)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
0885862150
commit
382db4b8d0
22 files changed
+1323
-24
No files matched your search
@@ -4,6 +4,7 @@ using AIStudio.Settings;
|
||||
using AIStudio.Tools.Rust;
|
||||
using AIStudio.Tools.Security;
|
||||
using AIStudio.Tools.Services;
|
||||
using AIStudio.Tools.ToolCallingSystem;
|
||||
|
||||
namespace AIStudio.Chat;
|
||||
|
||||
@@ -81,7 +82,7 @@ public static class ListContentBlockExtensions
|
||||
return Task.Run(async () => new TextMessage
|
||||
{
|
||||
Role = roleTransformer(block.Role),
|
||||
Content = await text.PrepareTextContentForAI(reportingScope),
|
||||
Content = await PrepareTextAsync(block, text),
|
||||
} as IMessageBase);
|
||||
}
|
||||
|
||||
@@ -100,13 +101,19 @@ public static class ListContentBlockExtensions
|
||||
Role = roleTransformer(block.Role),
|
||||
Content =
|
||||
[
|
||||
textSubContentFactory(await text.PrepareTextContentForAI(reportingScope)),
|
||||
textSubContentFactory(await PrepareTextAsync(block, text)),
|
||||
..images.OfType<ISubContent>(),
|
||||
]
|
||||
} as IMessageBase;
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Local function to prepare the text of one message. An earlier answer of the model gets the
|
||||
// note of the tools and sources it rested on in front, see ToolCallHistoryNote.TextForModel.
|
||||
//
|
||||
async Task<string> PrepareTextAsync(ContentBlock block, ContentText text) => ToolCallHistoryNote.TextForModel(block, await text.PrepareTextContentForAI(reportingScope));
|
||||
|
||||
//
|
||||
// Local function to prepare one image for the model. An image which cannot be prepared
|
||||
// stays out of the message, and the user learns why. It used to go along as an image
|
||||
|
||||
Reference in new issue
Block a user