Added whole documents to the Translation, Grammar & Spelling, and Rewrite & Improve assistants (#1179)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Sabrina-devopsandThorsten Sommer authored and GitHub committed 2026-11-28 20:27:23 +01:00
1 parent f7666861f1
commit 918572c158
150 files changed
+12850 -302

No files matched your search

@@ -211,6 +211,35 @@ public sealed class AssistantSessionDraftTests
Assert.That(AssistantLowerBase.IsWorthADraft(state.ToDictionary(), stateWithDefaults.ToDictionary(), holdsSentText: false), Is.False, "Work in progress is not a change the user made.");
}
[Test]
public void TheModeOfADocumentAssistantComesBackWithARunOnly()
{
var state = new AssistantSessionStateWriter();
state.Set(DocumentAssistantStateKeys.MODE, AssistantContentMode.DOCUMENT);
var fields = state.ToDictionary();
var modeOfDraft = AssistantContentMode.UNDECIDED;
new AssistantSessionStateReader(fields, "Translation", isDraft: true).Restore(DocumentAssistantStateKeys.MODE, value => modeOfDraft = value);
var modeOfRun = AssistantContentMode.UNDECIDED;
new AssistantSessionStateReader(fields, "Translation").Restore(DocumentAssistantStateKeys.MODE, value => modeOfRun = value);
Assert.That(modeOfDraft, Is.EqualTo(AssistantContentMode.UNDECIDED), "When the user comes back, the assistant starts as its settings say, e.g., asks again what to work on.");
Assert.That(modeOfRun, Is.EqualTo(AssistantContentMode.DOCUMENT), "A run brings its mode along, or its progress and its result would stay hidden.");
}
[Test]
public void AChosenModeAloneIsNoChange()
{
var stateWithDefaults = new AssistantSessionStateWriter();
stateWithDefaults.Set(DocumentAssistantStateKeys.MODE, AssistantContentMode.UNDECIDED);
var state = new AssistantSessionStateWriter();
state.Set(DocumentAssistantStateKeys.MODE, AssistantContentMode.TEXT);
Assert.That(AssistantLowerBase.IsWorthADraft(state.ToDictionary(), stateWithDefaults.ToDictionary(), holdsSentText: false), Is.False, "A draft would not bring the mode back, so choosing it alone is nothing to keep.");
}
[TestCase(typeof(AssistantLowerBase), "INPUT_IS_VALID_STATE_KEY")]
[TestCase(typeof(AssistantLowerBase), "INPUT_ISSUES_STATE_KEY")]
[TestCase(typeof(AssistantDynamic), "IMAGE_CACHE_STATE_KEY")]