feat: add session-level publish and comment flow

This commit is contained in:
theshy
2026-04-14 16:00:17 +08:00
parent 862db502b0
commit d5d9693581
42 changed files with 2478 additions and 181 deletions

View File

@ -155,6 +155,10 @@ class SessionDeliveryService:
if session_key is None and source_title is None:
return {"error": {"code": "SESSION_KEY_OR_SOURCE_TITLE_REQUIRED", "message": "session_key or source_title required"}}
source_contexts = self.repo.list_task_contexts_by_source_title(source_title) if source_title else []
if session_key is None and source_contexts:
session_key = source_contexts[0].session_key
now = utc_now_iso()
self.repo.upsert_session_binding(
SessionBinding(
@ -170,8 +174,8 @@ class SessionDeliveryService:
)
contexts = self.repo.list_task_contexts_by_session_key(session_key) if session_key else []
if not contexts and source_title:
contexts = self.repo.list_task_contexts_by_source_title(source_title)
if not contexts and source_contexts:
contexts = source_contexts
updated_tasks: list[dict[str, object]] = []
for context in contexts: