Note editor sidebar, full-doc assist, persistent drafts, version history
NoteEditorView: two-column sidebar layout (project/milestone/tags/assist always visible), removed assist toggle button, InlineAssistPanel removed. Writing assist: whole_doc mode rewrites entire document; DiffView.vue replaces editor during review showing full-document diff. Scope dropdown in sidebar switches between whole-document and section modes. Persistent drafts: migration 0022 adds note_drafts (UNIQUE per note+user) and note_versions (max 20, auto-pruned) tables. Draft saved after generation completes, restored on editor mount, cleared on accept/reject. Version snapshot created automatically whenever note body changes on save. HistoryPanel.vue: version list + DiffView modal, restore button writes body back to editor. Config: OLLAMA_NUM_CTX default raised to 65536; assist num_predict now tracks Config.OLLAMA_NUM_CTX instead of a hardcoded 4096. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -12,7 +12,25 @@
|
||||
> Include file-level details in the commit body when the change is non-trivial.
|
||||
|
||||
## Last Updated
|
||||
2026-03-05 — Task Work Log, writing assistant improvements, task editor UI overhaul.
|
||||
2026-03-05 — Note editor sidebar layout, full-document writing assist, persistent drafts, version history, context window bump.
|
||||
|
||||
**Note editor sidebar layout:** `NoteEditorView.vue` fully refactored into two-column layout matching `TaskEditorView`. Right sidebar (280px) contains Project, Milestone, Tags + tag suggestions, and the Writing Assistant panel (always visible, no toggle). Mobile collapses to accordion. Removed `assistOpen` ref and `✨ Assist` toggle button. `InlineAssistPanel` removed from note editor.
|
||||
|
||||
**Full-document writing assist:** `services/assist.py` — new `whole_doc: bool` param with a separate system prompt that instructs the model to output the complete revised document. `routes/notes.py` — `whole_doc` accepted from POST body; validation updated (section mode requires `target_section`, both modes require `instruction`). `composables/useAssist.ts` — added `scopeMode` ref (`'document' | 'section'`), `proposedFullBody` ref (full body after section replacement or whole-doc output), updated `diff` to always compare full document snapshots (`bodySnapshot → proposedFullBody`). Scope dropdown in sidebar drives `scopeMode` and `selectedSection`. `canSubmit` no longer requires a target in document mode. `selectSection()` and `selectTextRange()` now set `scopeMode = 'section'` automatically.
|
||||
|
||||
**DiffView.vue:** New standalone component (`frontend/src/components/DiffView.vue`). Full-width, flex-fills available height. Sticky summary bar (insertions / deletions count). Scrollable monospace diff body. Replaces the editor main area during review state.
|
||||
|
||||
**Main area state switching (NoteEditorView):** streaming → stream preview (rendered markdown); review → `DiffView` full-width; idle → normal Write/Preview/TiptapEditor.
|
||||
|
||||
**Persistent drafts — backend:** Migration `0022_add_note_versions_and_drafts.py` — `note_drafts` table (UNIQUE per `note_id + user_id`; fields: `proposed_body`, `original_body`, `instruction`, `scope`) and `note_versions` table (max 20 per note; fields: `body`, `title`, `created_at`). Models `models/note_draft.py`, `models/note_version.py`. Added imports to `models/__init__.py`. Services `services/note_drafts.py` (`upsert_draft` via INSERT … ON CONFLICT, `get_draft`, `delete_draft`) and `services/note_versions.py` (`create_version` with auto-prune to 20, `list_versions`, `get_version`). `services/notes.py` `update_note()` — snapshots old body/title before applying changes; calls `create_version` when body actually changes. Routes in `routes/notes.py`: `GET/PUT/DELETE /api/notes/<id>/draft`, `GET /api/notes/<id>/versions`, `GET /api/notes/<id>/versions/<vid>`.
|
||||
|
||||
**Persistent drafts — frontend:** `useAssist.ts` — accepts optional `noteId: Ref<number | null>` second param; saves draft via `PUT /api/notes/<id>/draft` after `done` event; `loadDraft(draft)` restores `bodySnapshot`, `proposedFullBody`, `instruction`, `scopeMode`, and sets state to `'review'`; `accept()` and `reject()` call `DELETE /api/notes/<id>/draft`. `NoteEditorView.vue` — on mount, after note loads, fetches draft and calls `assist.loadDraft()` if one exists. `NoteDraft` interface exported from `useAssist.ts`; `NoteDraft` + `NoteVersion` interfaces added to `frontend/src/types/task.ts`.
|
||||
|
||||
**Version history browser:** `HistoryPanel.vue` — wide modal (900px, 80vh), version list on left (lazy body loading), `DiffView` on right (selected version vs current body), Restore button emits body to parent. `NoteEditorView.vue` — "History" toolbar button, renders `<HistoryPanel>` with restore handler (`body = $event; markDirty()`).
|
||||
|
||||
**Context window + output token limits:** `OLLAMA_NUM_CTX` default raised from 16384 to 65536 in `config.py` (overridable via env var; comment updated to remove stale VRAM reference). `run_assist_generation` in `generation_task.py` — `num_predict` changed from hardcoded 4096 to `Config.OLLAMA_NUM_CTX`, so assist output budget always matches the configured context window.
|
||||
|
||||
**Previous session (2026-03-05 earlier):** Fix writing assist: disable thinking mode, drop stuck-buffer 409.
|
||||
|
||||
**Task Work Log (backend):** New `task_logs` table (migration `0021_add_task_logs.py`) with FK to `notes(id)` CASCADE and `users(id)` CASCADE, indexes on `task_id` and `user_id`. SQLAlchemy model `models/task_log.py`. Service `services/task_logs.py` with `create_log`, `list_logs`, `update_log` (uses `_UNSET` sentinel so `None` can explicitly clear `duration_minutes`), `delete_log` — all ownership-checked. Blueprint `routes/task_logs.py` registered in `app.py` at `/api/tasks/<task_id>/logs` (GET, POST, PATCH `/<log_id>`, DELETE `/<log_id>`). LLM tool `log_work` added to `_CORE_TOOLS` in `services/tools.py`: resolves task by title, calls `create_log`, returns `{success, log, task}`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user