Anchor generated attachments to assistant messages

Deliverables now inherit the active assistant draft message ID so clients can render them beside the reply that produced them.
This commit is contained in:
2026-09-09 06:54:56 +00:00
parent 5725d635b2
commit 6be1601ccd
3 changed files with 17 additions and 2 deletions
+8 -1
View File
@@ -379,11 +379,18 @@ class PhebyAdapter(BasePlatformAdapter):
return SendResult(success=True, message_id=clarify_id)
# ── deliverables (attachments) ───────────────────────────────────────
def _active_assistant_message_id(self, conversation_id: str) -> Optional[str]:
"""Return the live assistant draft that a deliverable belongs beneath."""
draft = self._drafts.get(conversation_id)
message_id = draft.get("message_id") if isinstance(draft, dict) else None
return str(message_id) if message_id else None
async def _register_and_broadcast(
self,
file_path: str,
conversation_id: str,
*,
message_id: Optional[str] = None,
kind_hint: Optional[str] = None,
filename: Optional[str] = None,
) -> Optional[Dict[str, Any]]:
@@ -392,7 +399,7 @@ class PhebyAdapter(BasePlatformAdapter):
desc = await self._server.store.register_file(
file_path,
conversation_id=conversation_id,
message_id=None,
message_id=message_id or self._active_assistant_message_id(conversation_id),
filename=filename,
kind_hint=kind_hint,
)