fix: merge _get_hermes_home() dynamic resolution and feishu receive_id_type detection

- scheduler.py: Replace static _hermes_home with dynamic _get_hermes_home() function
  to support profile switching at runtime (HERMES_HOME override)
- scheduler.py: Replace static _LOCK_DIR/_LOCK_FILE with _get_lock_paths() function
  for profile-aware lock path resolution
- feishu.py: Add receive_id_type detection (oc_/ou_ -> open_id, else chat_id)
  to fix Feishu API '[230001] ext=invalid receive_id' error for user DMs
This commit is contained in:
邓taoyuan 2026-04-22 07:22:02 +08:00 committed by Teknium
parent de9238d37e
commit 969bfff449
2 changed files with 29 additions and 13 deletions

View file

@ -4090,7 +4090,14 @@ class FeishuAdapter(BasePlatformAdapter):
content=payload,
uuid_value=str(uuid.uuid4()),
)
request = self._build_create_message_request("chat_id", body)
# Detect whether chat_id is an open_id (private message) or a group chat_id.
# Feishu API requires receive_id_type="open_id" for user DMs (oc_/ou_ prefix)
# and receive_id_type="chat_id" for group chats (ch_ prefix).
if chat_id.startswith(("oc_", "ou_")):
receive_id_type = "open_id"
else:
receive_id_type = "chat_id"
request = self._build_create_message_request(receive_id_type, body)
return await asyncio.to_thread(self._client.im.v1.message.create, request)
@staticmethod