UI polish pass: word count, slash commands, task lists, graph peek, bulk delete, export
- WordCount component (toggle words/chars vs read time, persisted mode) - TipTap: TaskList/TaskItem extensions, slash command menu (H1-H3, lists, code, quote, task) - Markdown serializer: task list → `- [ ]` / `- [x]` roundtrip - GraphView: slide-in peek panel for note/task nodes (body, tags, linked nodes); tag nodes still navigate - ChatView: bulk-select conversations with two-click confirm delete + chat retention policy (default 90d) - NoteEditorView: pill tab bar with animated edit/preview toggle + WordCount in toolbar - WorkspaceNoteEditor: inline search with tag matching, inline new-note creation, WordCount - WorkspaceTaskPanel: task body rendered in slide-over + Edit link - Settings: data export (Markdown ZIP / JSON) via GET /api/export - Accessibility: skip-to-content link, aria-labels on all icon-only buttons - Fix: export route used non-existent fabledassistant.database — corrected to async_session() - Fix: ToolCallRecord.status type now includes "running" (was causing TS build error) - Dockerfile: upgrade npm to latest before install to suppress major-version notice - npm audit fix: patched minimatch (ReDoS) and rollup (path traversal) — 0 vulnerabilities Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy import func, select, delete as sa_delete
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from fabledassistant.models import async_session
|
||||
@@ -103,6 +103,35 @@ async def delete_conversation(user_id: int, conversation_id: int) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
async def bulk_delete_conversations(user_id: int, ids: list[int]) -> int:
|
||||
"""Delete multiple conversations by ID for a user. Returns count deleted."""
|
||||
if not ids:
|
||||
return 0
|
||||
async with async_session() as session:
|
||||
result = await session.execute(
|
||||
sa_delete(Conversation)
|
||||
.where(Conversation.user_id == user_id, Conversation.id.in_(ids))
|
||||
.returning(Conversation.id)
|
||||
)
|
||||
await session.commit()
|
||||
return len(result.fetchall())
|
||||
|
||||
|
||||
async def cleanup_old_conversations(user_id: int, days: int) -> int:
|
||||
"""Delete conversations older than `days` days. Returns count deleted."""
|
||||
if days <= 0:
|
||||
return 0
|
||||
cutoff = datetime.now(timezone.utc) - timedelta(days=days)
|
||||
async with async_session() as session:
|
||||
result = await session.execute(
|
||||
sa_delete(Conversation)
|
||||
.where(Conversation.user_id == user_id, Conversation.updated_at < cutoff)
|
||||
.returning(Conversation.id)
|
||||
)
|
||||
await session.commit()
|
||||
return len(result.fetchall())
|
||||
|
||||
|
||||
async def update_conversation(
|
||||
user_id: int,
|
||||
conversation_id: int,
|
||||
|
||||
Reference in New Issue
Block a user