feat: add writing style presets - #5
Merged
Merged
Conversation
Vorgefertigte Schreibstil-Vorlagen für den Text-Verbesserer (Blitztext+), auswählbar in den Einstellungen. Variante 1: kein neuer Workflow-Typ und kein neuer Hotkey, built-in only. - app/writing_presets.py: Katalog mit 8 Built-in-Presets (standard, email_formal, email_locker, stichpunkte, zusammenfassung, du_form, sie_form, kurz_praezise) + get_preset()/preset_index() mit Fallback - config: workflows.writing_preset (Default standard, validiert, unbekannt -> standard, rückwärtskompatibel für bestehende config.json) - llm_service: rewrite() reicht den Preset-System-Prompt über den vorhandenen custom_prompt-Pfad von text_improver() durch; standard bleibt unverändert; custom_terms weiterhin aktiv - SettingsDialog: Dropdown "Schreibstil-Vorlage" (lädt/speichert via Config) - Tests: Katalog/Fallback, Config-Default/-Validierung, LLM-Routing, Dialog-Load/-Save (176 Tests grün, offscreen) - README: Sektion "Schreibstil-Vorlagen" + Config-Doku
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81c27b8ae5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Eine manuell editierte config.json mit einem unhashbaren Wert (Liste/Objekt) für workflows.writing_preset löste in _validate_and_sanitize einen TypeError aus (`value not in set` hasht den Wert) und brach den Start ab, statt auf "standard" zurückzufallen. Jetzt wird zuerst der String-Typ geprüft. Adressiert Codex-PR-Review (P2) auf PR #5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Adds built-in writing-style presets to the Blitztext+ (text-improver) workflow — selectable via Settings → KI-Workflows → "Schreibstil-Vorlage". No new workflow types and no new hotkeys (Variante 1, built-in only).
app/writing_presets.py: frozenWritingPreset(key, display_name, system_prompt)with 8 built-ins (standard,email_formal,email_locker,stichpunkte,zusammenfassung,du_form,sie_form,kurz_praezise) plusget_preset()(fallback) andpreset_index()(UI pre-selection, pure/testable).app/config.py:workflows.writing_preset(defaultstandard), validated; unknown values coerced tostandard; oldconfig.jsonwithout the key stays compatible.app/llm_service.py:rewrite()routes the preset's system prompt through the existing (previously unused)custom_promptparam oftext_improver().standardkeeps the prior template unchanged;custom_termsstill applied for every preset.app/blitztext_linux.py: new "Schreibstil-Vorlage" combo (loads from / saves to config).README.md: new "Schreibstil-Vorlagen" section + config docs.A non-
standardpreset fully replaces the text-improver template, so the tone setting applies tostandardonly — documented in the dialog help text and the README.Why?
Paket D from the roadmap: give users ready-made "how should the text be written" presets (formal e-mail, bullet points, summary, Du/Sie, concise) without bloating the default workflow or consuming scarce hotkeys.
How did you test it?
python3 -m compileall app tests→ okQT_QPA_PLATFORM=offscreen WHISPER_GUI_TESTS=1 python -m pytest -q→ 176 passed (was 144)preset_indexselection, config default/validation/migration, LLMstandard-unchanged + preset-as-custom_prompt+custom_termsstill applied, settings-dialog load/save.git diff --checkclean; secret scan: no real keys, no.env/secretsfiles.AI assistance
Yes — implemented with Claude Code; reviewed read-only by Codex (GPT-5.4) pre- and post-implementation (no CRITICAL/HIGH/MEDIUM findings).
Checklist
pytest tests/(offscreen) or explained why not.