feat(assistant): an attached file stays with its conversation

A file attached in the trip chat lived only as a buffer for the one request
that read it, so the assistant could not look at it again and nothing could
keep it in Files. Now its bytes go to storage before the turn writes anything
(under the trip files' category, which is never served by path) and a row in
the new assistant_attachments table keeps its name, type, size, hash and the
text TREK read out of it, written in the turn's opening transaction. The
message's attachment part carries the row's id; old messages without one still
read.

The text is read the way the AI import reads it, through a new public
LlmParseService.readText, and a file whose text cannot be read is kept all the
same. A storage that refuses the bytes refuses the turn before any row exists.
Deleting a thread takes its files along, and the nightly retention sweep drops
files older than seven days and bytes no row names any more.
This commit is contained in:
Maurice
2026-10-24 21:11:35 +02:00
parent 487f8dd886
commit 6a77496438
27 changed files with 1088 additions and 26 deletions
+1
View File
@@ -3,6 +3,7 @@
"AiConnections": "ai-connections",
"AppSettings": "settings",
"AssignmentParticipants": "assignments",
"AssistantAttachments": "assistant",
"AssistantMessages": "assistant",
"AssistantThreads": "assistant",
"AssistantToolCalls": "assistant",