Add document preview, delete, and fix scroll in documents panel

Documents tab was limited to ~9 visible items due to fixed max-height
without overflow-hidden. Now uses 70vh with proper overflow. Added
click-to-preview (shows extracted text in dialog) and delete button
with confirmation dialog + backend DELETE endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 17:45:01 +00:00
parent 2b988fd805
commit 2b431e75ab
3 changed files with 279 additions and 34 deletions

View File

@@ -747,6 +747,22 @@ async def update_decision(decision_id: UUID, **fields) -> None:
await conn.execute(sql, decision_id, *values)
# ── Document deletion ──────────────────────────────────────────────
async def delete_document(doc_id: UUID) -> bool:
"""Delete a document and all its chunks. Returns True if deleted."""
pool = await get_pool()
async with pool.acquire() as conn:
async with conn.transaction():
await conn.execute(
"DELETE FROM document_chunks WHERE document_id = $1", doc_id
)
result = await conn.execute(
"DELETE FROM documents WHERE id = $1", doc_id
)
return int(result.split()[-1]) > 0
# ── Chunks & Vectors ───────────────────────────────────────────────
async def delete_document_chunks(document_id: UUID) -> int: