From 5a5b60ff75a38cc6d9b55b923a57a601e911f6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=91=D0=B5?= =?UTF-8?q?=D0=BB=D1=8F=D0=B5=D0=B2?= Date: Sat, 8 Aug 2026 13:11:13 +0300 Subject: [PATCH] docs: plan editor settings integration --- .../plans/2026-08-08-editor-settings-plan.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 dzen-assistant/docs/superpowers/plans/2026-08-08-editor-settings-plan.md diff --git a/dzen-assistant/docs/superpowers/plans/2026-08-08-editor-settings-plan.md b/dzen-assistant/docs/superpowers/plans/2026-08-08-editor-settings-plan.md new file mode 100644 index 0000000..f752479 --- /dev/null +++ b/dzen-assistant/docs/superpowers/plans/2026-08-08-editor-settings-plan.md @@ -0,0 +1,59 @@ +# Editor Settings Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Add a settings page with a reusable Editor.js footer signature and extra LLM instructions, then use both settings in draft editing and article generation. + +**Architecture:** Store two named values in a small SQLite `app_settings` table. Expose authenticated GET/PUT settings endpoints. The admin SPA adds a settings view and loads the saved signature when opening a draft, appending it as an editable final block; the worker appends extra instructions to the existing system prompt only when non-empty. + +**Tech Stack:** FastAPI, SQLAlchemy/SQLite, Celery, React/Vite, Editor.js, existing shadcn components and lucide-react. + +--- + +### Task 1: Persist and expose settings + +**Files:** +- Modify: `app/models.py` +- Modify: `app/routes.py` +- Modify: `app/database.py` + +- [ ] Add an `AppSetting` model with unique `key` and text `value` columns. +- [ ] Add `GET /api/settings` returning `signatureHtml` and `llmInstructions`. +- [ ] Add `PUT /api/settings` accepting both fields, trimming values, and committing them atomically. +- [ ] Ensure database initialization creates the table for existing installations. + +### Task 2: Apply extra LLM instructions + +**Files:** +- Modify: `app/worker.py` + +- [ ] Read `llmInstructions` from the settings table at article-generation time. +- [ ] Append it to `ARTICLE_SYSTEM_PROMPT` under a clearly delimited additional-instructions section. +- [ ] Keep generation unchanged when the field is empty. + +### Task 3: Settings screen and navigation + +**Files:** +- Modify: `admin/src/App.tsx` + +- [ ] Add a simple view switch between the production dashboard and settings. +- [ ] Build the settings form with the existing shadcn Card, Input/controls, Button, and Editor.js instance. +- [ ] Load settings on entry, save both values together, show saving/error status, and destroy the Editor.js instance on exit. + +### Task 4: Signature in the article editor + +**Files:** +- Modify: `admin/src/App.tsx` + +- [ ] Load the saved signature along with the article when opening a draft. +- [ ] Append signature blocks to the editor data only when the article does not already contain the saved signature, avoiding duplicates on re-open. +- [ ] Keep the appended blocks editable and include them in the normal article save operation. + +### Task 5: Verification and deployment + +**Files:** +- No new files. + +- [ ] Run Python compilation and frontend production build. +- [ ] Deploy `api`, `worker`, and `beat` so API and generation use the same image. +- [ ] Verify health, settings GET/PUT with admin authentication, and that the admin bundle contains the settings view.