fix: 自消息放行 + session搜索策略细化

This commit is contained in:
hmo
2026-06-14 12:18:36 +08:00
parent 28523beccf
commit d1a0348c77
2 changed files with 14 additions and 12 deletions
+5 -8
View File
@@ -31,6 +31,7 @@ PORT = 3021
ATTACH_SESSION = "ses_xxm_xmpp"
MUC_ROOMS = [
"coregroup@conference.yoin.fun", # core group chat
"jujidina@conference.yoin.fun", # jujidina group
]
LOG_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "logs")
@@ -540,15 +541,11 @@ def on_group_message(msg):
nickname = full_from.split("/")[1] if "/" in full_from else ""
bot_nick = JID.split("@")[0]
# Self-message echo from MUC — save to bridge context so LLM
# can see what it just said in the group (don't discard).
# Self-message echo from MUC — let through to LLM with prefix
# so LLM can see @mentions and observer protocol applies.
if nickname == bot_nick:
log(f"(self-msg saved to ctx) {body[:80]}")
try:
_router.bridge._append_to_log("assistant", body)
except Exception:
pass
return
log(f"(self-msg to LLM) {body[:80]}")
body = f"(自言自语) {body}"
# Record to message buffer for HTTP bridge monitoring
_record_group_msg(nickname, body)