mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
feat(coach): document chats live in the Coach view and history
Asking the Coach about a document opened a separate, half-finished chat panel that never appeared in Coach history. The bespoke drawer is gone; a document conversation now opens the real Coach view, appears in the Coach list with a document badge and a "Chatting about: <title>" note, and is read back through the same history rail as any other thread. The prompt-injection fence is unchanged and stays server-side. A document turn is still sent through the hardened fenced endpoint (no tools, no health snapshot, grounded in the document text only); the coach tool route continues to fetch with documentId null, so a document-scoped conversation can never be continued through the tool loop even from a hostile client. Only the surface moved into the Coach; the boundary did not. The relaxed conversation-list and detail filters drop only the documentId predicate — userId scoping is unchanged, so a document thread is still visible only to its owner. CoachConversationDTO gains documentId + documentTitle (server-derived, title/filename only); no schema change (documentId exists since 0230). OpenAPI regenerated.
This commit is contained in:
1 parent
57539283c8
commit
5b24ca0fa1
28 files changed
+605
-1112
No files matched your search
@@ -66,16 +66,6 @@ export const documentKeys = {
|
||||
*/
|
||||
inboundDocumentAiCapability: () =>
|
||||
["documents", "inbound", "ai-capability"] as const,
|
||||
/**
|
||||
* The scoped "chat about this document" thread
|
||||
* (`GET /api/documents/inbound/{id}/chat`). Keyed on the document id so two
|
||||
* open detail sheets never share a thread cache slot; a sent turn's SSE
|
||||
* `done` frame invalidates exactly this key so the persisted history reloads.
|
||||
* Stays under the `["documents", "inbound"]` prefix so a document delete /
|
||||
* bulk write still evicts it.
|
||||
*/
|
||||
inboundDocumentChat: (documentId: string) =>
|
||||
["documents", "inbound", documentId, "chat"] as const,
|
||||
/**
|
||||
* The per-user "read documents automatically with AI" opt-in
|
||||
* (`GET/PATCH /api/auth/me/documents-auto-ai-read`). Drives the AI-settings
|
||||
|
||||
Reference in new issue
Block a user