feat:进一步完善hfc私聊支持

This commit is contained in:
SengokuCola
2025-05-01 22:33:59 +08:00
parent 0fdaff6f3d
commit f4e9721e36
4 changed files with 534 additions and 407 deletions

View File

@@ -45,20 +45,15 @@ async def get_chat_type_and_target_info(chat_id: str) -> Tuple[bool, Optional[Di
'person_name': None
}
# Try to fetch person info (assuming person_info_manager methods are sync)
# Try to fetch person info
try:
# Use asyncio.to_thread for potentially blocking sync calls
# Assume get_person_id is sync (as per original code), keep using to_thread
person_id = await asyncio.to_thread(person_info_manager.get_person_id, platform, user_id)
person_name = None
if person_id:
person_name = await asyncio.to_thread(person_info_manager.get_value, person_id, "person_name")
# get_value is async, so await it directly
person_name = await person_info_manager.get_value(person_id, "person_name")
# If person_info_manager methods are async, await them directly:
# person_id = await person_info_manager.get_person_id(platform, user_id)
# person_name = None
# if person_id:
# person_name = await person_info_manager.get_value(person_id, "person_name")
target_info['person_id'] = person_id
target_info['person_name'] = person_name
except Exception as person_e: