mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 17:38:00 +00:00
Polish per-answer thinking disclosure
This commit is contained in:
1 parent
b28f2bcf6c
commit
fc30b33daa
20 files changed
+147
-54
No files matched your search
@@ -39,9 +39,16 @@ public sealed record AnthropicResponse
|
||||
/// <summary>
|
||||
/// The human-readable thinking the model returned, with redacted blocks omitted.
|
||||
/// </summary>
|
||||
public string GetThinkingOutput() => string.Concat(this.Content
|
||||
.Where(x => ReadString(x, "type").Equals("thinking", StringComparison.Ordinal))
|
||||
.Select(x => ReadString(x, "thinking")));
|
||||
/// <remarks>
|
||||
/// Each thinking block reads as its own paragraph, so they are joined as paragraphs
|
||||
/// rather than run into one another.
|
||||
/// </remarks>
|
||||
public string GetThinkingOutput() => string.Join(
|
||||
$"{Environment.NewLine}{Environment.NewLine}",
|
||||
this.Content
|
||||
.Where(x => ReadString(x, "type").Equals("thinking", StringComparison.Ordinal))
|
||||
.Select(x => ReadString(x, "thinking"))
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x)));
|
||||
|
||||
private static string ReadString(JsonElement item, string propertyName)
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ public readonly record struct ResponseStreamLine(string Type, int Index, Delta D
|
||||
/// <inheritdoc />
|
||||
public ContentStreamChunk GetContent() => this.Delta.Type switch
|
||||
{
|
||||
"thinking_delta" => new(string.Empty, this.Delta.Thinking, []),
|
||||
_ => new(this.Delta.Text, string.Empty, []),
|
||||
"thinking_delta" => new(string.Empty, [], this.Delta.Thinking),
|
||||
_ => new(this.Delta.Text, []),
|
||||
};
|
||||
|
||||
#region Implementation of IAnnotationStreamLine
|
||||
|
||||
Reference in new issue
Block a user