feat(task-5): scope matrix context state per room
This commit is contained in:
parent
03160a3b37
commit
c11c8ecfbf
7 changed files with 189 additions and 72 deletions
|
|
@ -297,7 +297,19 @@ class MatrixBot:
|
|||
await clear_load_pending(self.runtime.store, user_id, room_id)
|
||||
prototype_state = getattr(self.runtime.platform, "_prototype_state", None)
|
||||
if prototype_state is not None:
|
||||
await prototype_state.set_current_session(user_id, name)
|
||||
room_meta = await get_room_meta(self.runtime.store, room_id)
|
||||
context_keys = []
|
||||
if room_meta is not None:
|
||||
platform_chat_id = room_meta.get("platform_chat_id")
|
||||
if platform_chat_id:
|
||||
context_keys.append(platform_chat_id)
|
||||
chat_id = room_meta.get("chat_id")
|
||||
if chat_id:
|
||||
context_keys.append(chat_id)
|
||||
if not context_keys:
|
||||
context_keys.append(room_id)
|
||||
for context_key in dict.fromkeys(context_keys):
|
||||
await prototype_state.set_current_session(context_key, name)
|
||||
|
||||
try:
|
||||
await self.runtime.platform.send_message(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue