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

@@ -30,6 +30,12 @@ public static class ConfigurationSelectDataFactory
yield return new(behavior.Name, behavior);
}
public static IEnumerable<ConfigurationSelectData<AssistantStartMode>> GetAssistantStartModeData()
{
foreach (var startMode in Enum.GetValues<AssistantStartMode>())
yield return new(startMode.Name, startMode);
}
public static IEnumerable<ConfigurationSelectData<Guid>> GetLanguagesData()
{
foreach (var runningPlugin in PluginFactory.RunningPlugins)
@@ -0,0 +1,31 @@
namespace AIStudio.Settings.DataModel;
/// <summary>
/// How an assistant which works on documents as well as on texts starts.
/// </summary>
public enum AssistantStartMode
{
/// <summary>
/// The assistant asks every time whether the user wants to work on a document or on a text.
/// </summary>
/// <remarks>
/// This must stay the first member. Enums are persisted under their name, and an unknown name
/// falls back to the default value of the enum, which is the member with the value zero.
/// </remarks>
ASK_EVERY_TIME,
/// <summary>
/// The assistant always starts with a document.
/// </summary>
DOCUMENT,
/// <summary>
/// The assistant always starts with a text.
/// </summary>
TEXT,
/// <summary>
/// The assistant starts with what the user last chose in it, and asks while the user chose nothing since AI Studio started.
/// </summary>
LAST_CHOICE,
}
@@ -0,0 +1,39 @@
using AIStudio.Assistants;
using AIStudio.Tools.PluginSystem;
namespace AIStudio.Settings.DataModel;
public static class AssistantStartModeExtensions
{
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(AssistantStartModeExtensions).Namespace, nameof(AssistantStartModeExtensions));
/// <param name="startMode">How the assistant starts.</param>
extension(AssistantStartMode startMode)
{
/// <summary>
/// Gets the name of the start mode, as the settings show it.
/// </summary>
public string Name => startMode switch
{
AssistantStartMode.ASK_EVERY_TIME => TB("Ask every time"),
AssistantStartMode.DOCUMENT => TB("Always start with a document"),
AssistantStartMode.TEXT => TB("Always start with a text"),
AssistantStartMode.LAST_CHOICE => TB("Start with the last choice"),
_ => TB("Ask every time"),
};
/// <summary>
/// Gets what the assistant works on when it starts; undecided while it still has to ask.
/// </summary>
/// <param name="lastChoice">What the user last chose in the assistant since AI Studio started; undecided for nothing.</param>
public AssistantContentMode InitialContentMode(AssistantContentMode lastChoice) => startMode switch
{
AssistantStartMode.DOCUMENT => AssistantContentMode.DOCUMENT,
AssistantStartMode.TEXT => AssistantContentMode.TEXT,
AssistantStartMode.LAST_CHOICE => lastChoice,
_ => AssistantContentMode.UNDECIDED,
};
}
}
@@ -4,6 +4,11 @@ namespace AIStudio.Settings.DataModel;
public sealed class DataGrammarSpelling
{
/// <summary>
/// Whether the grammar & spelling checker asks on start to check a document or a text, or starts with one of them right away.
/// </summary>
public AssistantStartMode StartMode { get; set; } = AssistantStartMode.ASK_EVERY_TIME;
/// <summary>
/// Preselect any rewrite options?
/// </summary>
@@ -5,6 +5,11 @@ namespace AIStudio.Settings.DataModel;
public sealed class DataRewriteImprove
{
/// <summary>
/// Whether the rewrite & improve assistant asks on start to improve a document or a text, or starts with one of them right away.
/// </summary>
public AssistantStartMode StartMode { get; set; } = AssistantStartMode.ASK_EVERY_TIME;
/// <summary>
/// Preselect any rewrite options?
/// </summary>
@@ -8,7 +8,12 @@ public sealed class DataTranslation
/// The live translation interval for debouncing in milliseconds.
/// </summary>
public int DebounceIntervalMilliseconds { get; set; } = 1_500;
/// <summary>
/// Whether the translator asks on start to translate a document or a text, or starts with one of them right away.
/// </summary>
public AssistantStartMode StartMode { get; set; } = AssistantStartMode.ASK_EVERY_TIME;
/// <summary>
/// Do we want to preselect any translator options?
/// </summary>