refactor: bind cron jobs to origin sessions

This commit is contained in:
chengyongru
2026-06-12 14:00:53 +08:00
parent 271b3651d7
commit 80524e9e88
14 changed files with 47 additions and 267 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ class CronTool(Tool, ContextAware):
self._channel.set(ctx.channel)
self._chat_id.set(ctx.chat_id)
self._metadata.set(ctx.metadata)
self._session_key.set(ctx.session_key or "")
self._session_key.set(f"{ctx.channel}:{ctx.chat_id}" if ctx.channel and ctx.chat_id else "")
def set_cron_context(self, active: bool):
"""Mark whether the tool is executing inside a cron job callback."""