mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-05 01:49:41 +00:00
Add per-answer thinking disclosure
This commit is contained in:
1 parent
c7b42bee96
commit
bbbcdddc91
29 files changed
+360
-37
No files matched your search
@@ -28,6 +28,7 @@ public sealed class ToolCallingLoop(ILogger<ToolCallingLoop> logger) : IToolCall
|
||||
var toolCallCount = 0;
|
||||
var toolResultCharacterCount = 0L;
|
||||
var toolSources = new List<Source>();
|
||||
var hasThinkingOutput = false;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -47,6 +48,13 @@ public sealed class ToolCallingLoop(ILogger<ToolCallingLoop> logger) : IToolCall
|
||||
|
||||
toolSources.MergeSources(round.Sources);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(round.ThinkingOutput))
|
||||
{
|
||||
var separator = hasThinkingOutput ? $"{Environment.NewLine}{Environment.NewLine}" : string.Empty;
|
||||
yield return new ContentStreamChunk(string.Empty, $"{separator}{round.ThinkingOutput}", []);
|
||||
hasThinkingOutput = true;
|
||||
}
|
||||
|
||||
//
|
||||
// A call without an ID cannot be answered: the provider correlates the result by that
|
||||
// ID, and inventing one would have the next request rejected. Nothing can be salvaged
|
||||
@@ -168,4 +176,4 @@ public sealed class ToolCallingLoop(ILogger<ToolCallingLoop> logger) : IToolCall
|
||||
private static string GetDisplayName(ToolCallingLoopContext context, string toolName) => context.RunnableTools
|
||||
.FirstOrDefault(tool => tool.Definition.Function.Name.Equals(toolName, StringComparison.Ordinal))
|
||||
.Implementation?.GetDisplayName() ?? toolName;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user