Skip to content

feat: add writing style presets - #5

Merged
TimInTech merged 2 commits into
mainfrom
feature/paket-d-writing-presets
Jun 17, 2026
Merged

feat: add writing style presets#5
TimInTech merged 2 commits into
mainfrom
feature/paket-d-writing-presets

Conversation

@TimInTech

Copy link
Copy Markdown
Owner

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).

  • New app/writing_presets.py: frozen WritingPreset(key, display_name, system_prompt) with 8 built-ins (standard, email_formal, email_locker, stichpunkte, zusammenfassung, du_form, sie_form, kurz_praezise) plus get_preset() (fallback) and preset_index() (UI pre-selection, pure/testable).
  • app/config.py: workflows.writing_preset (default standard), validated; unknown values coerced to standard; old config.json without the key stays compatible.
  • app/llm_service.py: rewrite() routes the preset's system prompt through the existing (previously unused) custom_prompt param of text_improver(). standard keeps the prior template unchanged; custom_terms still 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-standard preset fully replaces the text-improver template, so the tone setting applies to standard only — 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 → ok
  • QT_QPA_PLATFORM=offscreen WHISPER_GUI_TESTS=1 python -m pytest -q176 passed (was 144)
  • New tests cover: preset catalog + fallback, preset_index selection, config default/validation/migration, LLM standard-unchanged + preset-as-custom_prompt + custom_terms still applied, settings-dialog load/save.
  • git diff --check clean; secret scan: no real keys, no .env/secrets files.

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

  • I ran pytest tests/ (offscreen) or explained why not.
  • I did not commit API keys, tokens, private recordings, or confidential transcripts.
  • I considered whether this changes privacy, security, or data flow.
  • I kept the change focused on the Linux scope.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread app/config.py Outdated
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.
@TimInTech
TimInTech merged commit 5f4fb3a into main Jun 17, 2026
7 checks passed
@TimInTech
TimInTech deleted the feature/paket-d-writing-presets branch June 17, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant