Prompt history: list preview shows the message as written, not the engine's time line (#660)
Version 0.1.13. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,9 @@ public sealed class RunTranscriptRecorder
|
||||
|
||||
public bool Enabled { get; }
|
||||
public string? SystemPrompt { get; private set; }
|
||||
|
||||
/// <summary>The message as sent by its author - without the time line the engine prepends.</summary>
|
||||
public string? PromptPreview { get; private set; }
|
||||
public DateTime StartedAt { get; }
|
||||
|
||||
public RunTranscriptRecorder(bool enabled = true, TimeProvider? clock = null)
|
||||
@@ -45,11 +48,14 @@ public sealed class RunTranscriptRecorder
|
||||
|
||||
// ─── Engine hooks ───
|
||||
|
||||
public void Begin(string? systemPrompt, string userMessage)
|
||||
/// <param name="sentMessage">What the model received, including what the engine added.</param>
|
||||
/// <param name="originalMessage">The message as its author wrote it - the list preview.</param>
|
||||
public void Begin(string? systemPrompt, string sentMessage, string? originalMessage = null)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
SystemPrompt = string.IsNullOrWhiteSpace(systemPrompt) ? null : SecretScrubber.Scrub(systemPrompt);
|
||||
Add(TranscriptEntryKind.User, userMessage, MaxTextChars);
|
||||
PromptPreview = SecretScrubber.Scrub(originalMessage ?? sentMessage);
|
||||
Add(TranscriptEntryKind.User, sentMessage, MaxTextChars);
|
||||
}
|
||||
|
||||
/// <summary>A message the engine sent on its own (follow-up after an empty answer etc.).</summary>
|
||||
@@ -127,6 +133,7 @@ public sealed class RunTranscriptRecorder
|
||||
CompletedAt = _clock.GetUtcNow().UtcDateTime,
|
||||
Status = status,
|
||||
SystemPromptHash = SystemPrompt is null ? null : Hash(SystemPrompt),
|
||||
PromptPreview = PromptPreview,
|
||||
Entries = _entries.ToList(),
|
||||
SizeChars = _size,
|
||||
Truncated = _truncated
|
||||
|
||||
Reference in New Issue
Block a user