feat(whatsapp): real group @mentions and cleaner inbound text

Wire mention JIDs/names through scheduled delivery and immediate replies (including attachment captions), sanitize group message text for the model, and surface channel-derived sessions in admin Chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-07-13 20:05:43 +08:00
parent cbe68a54cd
commit ad5d1db3c6
19 changed files with 1507 additions and 58 deletions

View file

@ -1546,6 +1546,14 @@ class SqliteStore(ScheduledJobStoreMixin):
created_at=utc_now_iso(),
)
def set_ui_session_owner(self, *, session_id: str, tenant_id: str, user_id: str) -> None:
self._ui_session_owner_repo().upsert_replace(
session_id=str(session_id),
tenant_id=str(tenant_id),
user_id=str(user_id),
created_at=utc_now_iso(),
)
def get_session(self, session_id: str) -> Optional[ChatSession]:
return self._chat_sessions_repo().fetch_chat_session_by_id(session_id=session_id)
@ -1629,6 +1637,35 @@ class SqliteStore(ScheduledJobStoreMixin):
username=username
)
def list_sessions_for_administrator_chat_view(
self,
*,
username: str,
tenant_id: str,
limit: int | None = None,
offset: int = 0,
) -> list[ChatSession]:
return self._chat_sessions_repo().list_chat_sessions_for_administrator_chat_view(
username=username,
tenant_id=tenant_id,
limit=limit,
offset=int(offset),
)
def get_sessions_list_meta_for_administrator_chat_view(
self, *, username: str, tenant_id: str
) -> SessionsListMeta:
return self._chat_sessions_repo().sessions_list_meta_for_administrator_chat_view(
username=username, tenant_id=tenant_id
)
def get_session_for_administrator_chat_view(
self, *, session_id: str, username: str, tenant_id: str
) -> Optional[ChatSession]:
return self._chat_sessions_repo().fetch_chat_session_for_administrator_chat_view(
session_id=session_id, username=username, tenant_id=tenant_id
)
def get_session_for_administrator_username(
self, *, session_id: str, username: str
) -> Optional[ChatSession]: