feat(summary): custom summary template editor with JSON authoring - #4
Merged
Conversation
Add a template editor in Settings -> Summary to create, edit, duplicate, and delete summary templates. Editing a built-in saves a same-id custom override; deleting it restores the built-in. Includes a Form/JSON toggle for raw JSON authoring (validated), Import JSON, and Copy JSON export. Backend: expose template source/editable/deletable metadata and get-content/save/delete commands over the existing JSON-file template store; add validation bounds (trim, unique titles, section and character limits) and a crash-safe temp-file+backup save. Frontend: SummaryTemplateManager plus summary-template helpers (collision-free ids, section reorder). The fixed multi-language/prompt-injection preamble and api_process_transcript signature are unchanged. Docs: README custom summary template section with schema and JSON examples. Verified: 17 backend template tests pass; tsc --noEmit clean; 66/66 Bun tests.
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.
Summary
Adds a custom summary template editor so users can control how meeting records are
structured, including JSON-level authoring. Templates were already JSON-backed and
override-able on disk; this exposes create/edit/duplicate/delete in the UI and adds raw
JSON editing, import, and export. Implements the actionable part of #257 (editable
summarization) without a raw system-prompt override.
The fixed prompt preamble (multi-language contract + prompt-injection guard) and
api_process_transcript's signature are unchanged — only the template's sectioninstructions (the safe, functional part of the prompt) are editable.
What changed
Backend (
frontend/src-tauri/src/summary/)template_commands.rs:TemplateInfonow carriessource/editable/deletable; newapi_get_template_content,api_save_template,api_delete_template(registered inlib.rs).templates/loader.rs:template_source,is_valid_template_id, andsave_custom_template/delete_custom_templateover the existing JSON-file store, with acrash-safe temp-file + backup swap on save.
templates/types.rs: validation bounds — trim/whitespace rejection, unique sectiontitles, ≤30 sections, and character limits (name 120, description 500, title 120,
instruction 2000, item_format 500).
Frontend
components/SummaryTemplateManager.tsxcard in Settings → Summary: list withBuilt-in/Custom badges; create / edit / duplicate / delete (delete via
ConfirmationModal);Form / JSON toggle with raw JSON editing + Validate; Import JSON; Copy JSON.
Section reorder (up/down), discard-changes confirmation, collision-free ids.
lib/summary-template.tshelpers (slugifyTemplateId,createUniqueTemplateId,moveArrayItem) +tests/lib/summary-template.test.mjs.components/SummaryModelSettings.tsx.Docs
README.md: "Custom summary templates" section with the schema, a full example, aminimal example, a field reference (with limits), and on-disk locations.
Editing model
built-in. Only custom templates are deletable.
format∈paragraph|list|string); there isintentionally no arbitrary system-prompt override.
Testing
summary::templatestests pass (incl. new validation + atomic-save tests).tsc --noEmitclean; 66/66 Bun tests (incl. 3 new helper tests).Import/Copy JSON; edit a built-in → becomes Custom → delete reverts; invalid JSON/format
is rejected with a clear message; template appears in the meeting summary picker.
Notes
navigator.clipboard(already used elsewhere in the app).FUTURE_ROADMAPS.md(living project roadmap) is included in this push.