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

+29 -1
View File
@@ -40,7 +40,7 @@ Key structure:
- **JSON contracts** - The contracts of all JSON which AI Studio reads or writes are generated while compiling. Each kind of options names the `JsonSerializerContext` which knows its types, with `GenerationMode = Metadata`, as its `TypeInfoResolver` and ends with `.AsReadOnly()`; only `VisualBriefingJson.Canonical` leaves that out, see MWAIS0010. A new JSON type goes into the context of the options it is read or written with, and into `JsonTestRoots` in `app/Tests/Serialization/`, whose contract, defaults, and coverage tests then check it. Give JSON types `set` instead of `init`, because the source generator of .NET 10 drops the initializer of an `init` property which the JSON leaves out, and write a record or a `JsonObject` instead of an anonymous type. Never call System.Text.Json without options, nor with `JsonSerializerOptions.Default`, `.Web`, or a `DefaultJsonTypeInfoResolver`: each of them builds the contracts by reflection, whose code a published build may lack. MWAIS0015 refuses them while compiling, `JsonOptionsResolverTests` checks the resolvers of all options of the app, and the trim smoke test of `dotnet run -- verify` builds the contract of every type of their contexts in a trimmed build. Reflection itself stays switched on, because Blazor Server needs it for JSON of its own, see `Trimming.props`.
- **Long menus** - MudBlazor keeps a `MudSelect` inside the window by itself, but never a `MudMenu`: a menu taller than the window runs past its edge, and its lower entries cannot be reached. Give every `MudMenu` whose entries come from data, such as the assistants or the profiles, `MaxHeight="@MenuDefaults.MAX_HEIGHT"`, so that it scrolls.
- **Growing popovers** - Since version 9, MudBlazor places an open popover again whenever its content changes size. Content which unfolds later, such as a `MudCollapse` or an `ExpansionPanel` inside a `MudPopover`, therefore stays inside the window and needs no code of its own.
- **Validated text fields** - Without `Immediate` or a `DebounceInterval`, a `MudTextField` passes its text on only when the user leaves it, so an issue stays visible while the user types the text which resolves it. Give every `MudTextField` with a `Validation` which takes typing `DebounceInterval="@TextFieldDefaults.VALIDATION_DEBOUNCE_MILLISECONDS"` and bind its `Value`, not its `Text`: bound by its text, the field also delays the texts its parent sets, e.g., by a reset, and checks them although nobody touched it. `Immediate="@true"` works as well, but renders the parent with every keystroke. `ValidatedTextFieldTests` checks this rule.
- **Validated text fields** - Without `Immediate` or a `DebounceInterval`, a `MudTextField` passes its text on only when the user leaves it, so an issue stays visible while the user types the text which resolves it. Give every `MudTextField` with a `Validation` which takes typing `DebounceInterval="@TextFieldDefaults.VALIDATION_DEBOUNCE_MILLISECONDS"` and bind its `Value`, not its `Text`: bound by its text, the field also delays the texts its parent sets, e.g., by a reset, and checks them although nobody touched it. `Immediate="@true"` works as well, but renders the parent with every keystroke. A read-only field, whose text only its parent sets, such as the path in `SelectFile`, binds its `Value` as well: bound by its text, it checks the empty text before the user chose anything. `ValidatedTextFieldTests` checks this rule.
- **Encryption** - Initialized before Rust service is marked ready
- **Access to the app server** - Only the app window gets into the Blazor server. `AppAccessMiddleware` runs first in `Program.cs`, right after the host filter, and refuses every request without the session cookie of the window or with an origin other than the app's own. Add no exception for any path, not even for static files: `AppAccessPipelineTests` checks the order in `Program.cs`. Since nothing but the window holds the cookie, the app never sends a request to its own server: read files below `wwwroot/` through `WebRootFiles`. The system browser gets no cookie either, so never open a URL of the app server there; offer a save dialog through `RustService` instead, as the ERI Server assistant does for its specification. `runtime/AGENTS.md` describes the runtime side.
- **Debug environment** - Reads `startup.env` file with IPC credentials
@@ -185,6 +185,34 @@ presentation with the Open XML SDK (`DocumentFormat.OpenXml`), in `app/MindWork
**Area guide:** `app/MindWork AI Studio/Tools/PowerPoint/AGENTS.md`, with how a presentation comes about
and the rules which are easy to break.
## Document Segments
An assistant which works on a whole document, such as the Translation assistant with "Translate document",
lets a model work on its text segment by segment and writes a new document of the same type, in which
everything but the text stays as it was. The formats and the work with the model live in
`app/MindWork AI Studio/Tools/DocumentSegments/`.
An assistant which works on a document as well as on a text derives from `DocumentAssistantBase` in
`app/MindWork AI Studio/Assistants/`, as the Translation assistant does. The base asks at the start what to work
on, switches between both, runs the document through the segments, and offers to save the new document. The
assistant brings only its prompts, the texts which name what it does, and its fields for a text.
- **Overrides call the base.** `ResetForm`, `CaptureCustomAssistantSessionState`, and
`RestoreCustomAssistantSessionState` of such an assistant call the base, which keeps the mode and the document.
A draft brings back the document but not the mode, so the assistant starts as its settings say whenever the user
comes back; a run brings its mode along.
A text sent to it goes into `ApplyTextLaunchPayloadToText`, after the base switched to the text, and buttons
below the result of a text, such as "Send to", into `TextFooterButtons`: a document gets none.
- **The form places two components of the base.** Until the user chose, it shows only `AssistantModeChoice` with
`ModeOptions` and `ChooseMode`; for a document, `SelectDocument` bound to `DocumentPath`. The switch next to the
settings and the summary of a document come from `DocumentAssistantBase.razor`, one component each.
- **Texts of the base use `TB()`, or `TA()` when they address the reader.** `T()` takes the key from the type at
runtime, which is the derived assistant, while the I18N collector files the text under the base. The base
therefore declares its own `TA()`, as `AssistantBase` does.
**Area guide:** `app/MindWork AI Studio/Tools/DocumentSegments/AGENTS.md`, with how such a document comes
about and the rules which are easy to break.
## Enterprise IT Support
AI Studio supports centralized configuration for enterprise environments: