Skip to content

feat: UI-managed prompt configuration#52

Merged
ddulic merged 3 commits intomainfrom
004-ui-prompt-config
Mar 17, 2026
Merged

feat: UI-managed prompt configuration#52
ddulic merged 3 commits intomainfrom
004-ui-prompt-config

Conversation

@ddulic
Copy link
Copy Markdown
Owner

@ddulic ddulic commented Mar 17, 2026

Summary

  • Replaces 11 hardcoded prompt .md files with a database-backed PromptConfig table (Alembic migration included)
  • New PromptConfigService and REST endpoints (GET/PUT/DELETE /api/extended/prompts, POST /api/extended/reprocess-all) served via a dedicated prompts router
  • PromptLoader refactored to resolve prompts from DB with hardcoded string constants as fallback (no more filesystem reads at runtime)
  • ProcessorService gains reprocess_all() and per-page prompt-hash staleness tracking; stale pages surface in the UI
  • New PromptsModal.js component: tabbed OCR / Summary editor, custom note-type support, protected built-in layers (ocr/default, summary/default, summary/common), and an inline cost-warning confirmation before "Reprocess All Notes"
  • FileViewer.js updated: per-page stale badge, individual page reprocess button, amber header icon when the note has stale pages
  • Constitution v1.2.0: added §VIII Frontend UI Conventions (button style table); all interactive buttons across ApiKeysPanel, MoveModal, RenameModal, FileViewer, and index.html audited and normalised to the canonical SystemPanel palette

Test plan

  • Run ./script/test — all existing + new tests pass
  • Run ./script/lint — ruff, mypy, codespell clean
  • Start ./script/server (ephemeral) and open the web UI
  • Click the pencil (Prompts) icon in the header → modal opens with OCR / Summary tabs
  • Edit a prompt, save — verify toast "Prompt saved." and content persists on reload
  • Add a custom note type, verify it appears; remove it, verify it disappears
  • Attempt to remove default / common layers — Remove button should be absent
  • Click "Reprocess All Notes" → confirm inline warning appears before dispatching
  • Open a .note file, verify stale-page badge + per-page Reprocess button appear after prompt change
  • Verify all modal buttons (Prompts, API Keys, Move, Rename) use black primary / white secondary styles consistently in both light and dark mode

ddulic added 2 commits March 17, 2026 16:42
Replace hardcoded server-side prompt files with a database-backed prompt
configuration system fully manageable from the web UI.

Key changes:
- New PromptConfigService backed by SQLAlchemy model + Alembic migration
- REST endpoints: GET/PUT/DELETE /api/extended/prompts, POST /api/extended/reprocess-all
- PromptLoader refactored to resolve prompts from DB with hardcoded constants as fallback
- ProcessorService gains reprocess_all() and per-page prompt-hash staleness tracking
- New PromptsModal.js: tabbed OCR/Summary editor with custom type support, inline
  cost-warning confirmation before "Reprocess All Notes"
- FileViewer.js: per-page stale badge + individual reprocess button; amber header icon
  when note has stale pages
- Removed 11 hardcoded prompt .md files from supernote/server/resources/prompts/
- §VIII Frontend UI Conventions added to project constitution (v1.2.0); all button
  styles audited and normalised across ApiKeysPanel, MoveModal, RenameModal,
  FileViewer, and index.html to match the canonical SystemPanel reference palette
- Full test coverage: route security, service unit, processor hash, model completeness
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 96.82203% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
supernote/server/services/processor.py 73.80% 11 Missing ⚠️
...alembic/versions/b2c3d4e5f6a7_add_prompt_config.py 80.00% 3 Missing ⚠️
...rnote/server/services/processor_modules/summary.py 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Cover user-not-found branches, exception handlers, invalid file_id paths,
reprocess-all handler, stale page reprocessing with page_ids filtering,
already-processing 409, page-level reprocess success/failure, and
PromptConfigService edge cases (no-content ValueError, unknown prompt_id
skip, make_prompt_resolver).
@ddulic ddulic merged commit fbec62b into main Mar 17, 2026
5 checks passed
@ddulic ddulic deleted the 004-ui-prompt-config branch March 17, 2026 17:08
This was referenced Mar 17, 2026
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