🐛 fix: 修复部分单指令失效的问题

This commit is contained in:
Soulter
2025-02-19 19:04:23 +08:00
parent 1a0de02a15
commit 7bafc87e2b
3 changed files with 9 additions and 6 deletions
@@ -128,6 +128,7 @@ class SimpleGewechatClient():
if abm.group_id not in self.userrealnames:
self.userrealnames[abm.group_id] = {}
member_list = await self.get_chatroom_member_list(abm.group_id)
logger.debug(f"获取到 {abm.group_id} 的群成员列表。")
if member_list and 'memberList' in member_list:
for member in member_list['memberList']:
self.userrealnames[abm.group_id][member['wxid']] = member['nickName']
+8 -2
View File
@@ -102,11 +102,17 @@ class CommandFilter(HandlerFilter):
ok = False
for candidate in candidates:
for parent_command_name in self.parent_command_names:
_full = f"{parent_command_name} {candidate}"
if message_str.startswith(f"{_full} ") or message_str == _full.strip():
if parent_command_name:
_full = f"{parent_command_name} {candidate}"
else:
_full = candidate
if message_str.startswith(f"{_full} ") or message_str == _full:
message_str = message_str[len(_full):].strip()
ok = True
break
print(message_str, self.command_name, self.alias, self.parent_command_names, ok)
if not ok:
return False
-4
View File
@@ -125,10 +125,6 @@ class LongTermMemory:
else:
req.system_prompt += "You are now in a chatroom. The chat history is as follows: \n"
req.system_prompt += chats_str
if self.image_caption:
req.system_prompt += (
"The images sent by the members are displayed in text form above."
)
async def after_req_llm(self, event: AstrMessageEvent):
if event.unified_msg_origin not in self.session_chats: