fix(chat): 兼容 target_message_id 为 int 或缺少前缀 M 的情况
在 FOCUS 模式下,对 `target_message_id` 进行处理,以确保其为字符串格式并以 "M" 为前缀。这修复了当传入的 ID 为整数或缺少前缀时可能导致消息查找失败的问题。
This commit is contained in:
committed by
Windpicker-owo
parent
0d5aa9a575
commit
ddf023ff11
@@ -206,6 +206,11 @@ class ActionPlanner:
|
||||
# 非no_reply动作需要target_message_id
|
||||
if action != "no_reply":
|
||||
if target_message_id := parsed_json.get("target_message_id"):
|
||||
if isinstance(target_message_id, int):
|
||||
target_message_id = str(target_message_id)
|
||||
|
||||
if isinstance(target_message_id, str) and not target_message_id.startswith('M'):
|
||||
target_message_id = f"M{target_message_id}"
|
||||
# 根据target_message_id查找原始消息
|
||||
target_message = self.find_message_by_id(target_message_id, message_id_list)
|
||||
# 如果获取的target_message为None,输出warning并重新plan
|
||||
|
||||
Reference in New Issue
Block a user