myagent-ai 1.23.64 → 1.23.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chatbot/manager.py +7 -1
- package/package.json +1 -1
package/chatbot/manager.py
CHANGED
|
@@ -199,9 +199,15 @@ class ChatBotManager:
|
|
|
199
199
|
await bot.start()
|
|
200
200
|
except asyncio.CancelledError:
|
|
201
201
|
logger.info(f"聊天平台 {name} 已取消")
|
|
202
|
+
# Cancelled 意味着外部已调用 stop(),不要重复调用
|
|
202
203
|
except Exception as e:
|
|
203
204
|
logger.error(f"聊天平台 {name} 运行异常: {e}")
|
|
204
|
-
#
|
|
205
|
+
# 异常时必须清理残留的 polling 连接,否则新 bot 会冲突
|
|
206
|
+
try:
|
|
207
|
+
await bot.stop()
|
|
208
|
+
except Exception:
|
|
209
|
+
pass
|
|
210
|
+
# 移除 bot 实例,下次热更新会重新创建全新的 bot
|
|
205
211
|
self._bots.pop(name, None)
|
|
206
212
|
self._bot_tasks.pop(name, None)
|
|
207
213
|
|