fix: chat channel runtime (#16129)

### What problem does this PR solve?
Fix chat channel message routing to use the connected `chat_id`, and
make the Feishu websocket client bind to the thread-local event loop.

### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2026-06-17 15:52:13 +08:00
committed by GitHub
parent 44164e18d8
commit be869f5d96
2 changed files with 10 additions and 4 deletions

View File

@@ -107,7 +107,7 @@ def _make_chat_handler(ch):
# account_id == chat_channel.id; re-read so a re-connected dialog applies live.
e, cc = ChatChannelService.get_by_id(ch.account_id)
if not e or not cc.dialog_id:
if not e or not cc.chat_id:
LOGGER.info(
"[%s:%s] no dialog connected; ignoring message",
ch.channel_id,
@@ -115,12 +115,12 @@ def _make_chat_handler(ch):
)
return
e, dia = DialogService.get_by_id(cc.dialog_id)
e, dia = DialogService.get_by_id(cc.chat_id)
if not e:
LOGGER.warning("[%s:%s] connected dialog not found: %s", ch.channel_id, ch.account_id, cc.dialog_id)
LOGGER.warning("[%s:%s] connected dialog not found: %s", ch.channel_id, ch.account_id, cc.chat_id)
return
conv = ConversationService.get_or_create_for_channel(cc.dialog_id, ch.account_id, msg.chat_id)
conv = ConversationService.get_or_create_for_channel(cc.chat_id, ch.account_id, msg.chat_id)
if conv is None:
LOGGER.warning("[%s:%s] failed to get conversation for chat %s", ch.channel_id, ch.account_id, msg.chat_id)
return