🤖 自动格式化代码 [skip ci]
This commit is contained in:
@@ -23,11 +23,7 @@ class EmojiAction(BaseAction):
|
||||
action_parameters: dict[str:str] = {
|
||||
"description": "文字描述你想要发送的表情",
|
||||
}
|
||||
action_require: list[str] = [
|
||||
"你想要发送一个表情",
|
||||
"表达情绪时可以选择使用",
|
||||
"一般在你回复之后可以选择性使用"
|
||||
]
|
||||
action_require: list[str] = ["你想要发送一个表情", "表达情绪时可以选择使用", "一般在你回复之后可以选择性使用"]
|
||||
|
||||
associated_types: list[str] = ["emoji"]
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ def init_prompt():
|
||||
"simple_planner_prompt",
|
||||
)
|
||||
|
||||
|
||||
Prompt(
|
||||
"""
|
||||
动作名称:{action_name}
|
||||
@@ -192,7 +191,6 @@ class ActionPlanner(BasePlanner):
|
||||
reasoning = f"LLM 请求失败,你的模型出现问题: {req_e}"
|
||||
action = "no_reply"
|
||||
|
||||
|
||||
if llm_content:
|
||||
try:
|
||||
fixed_json_string = repair_json(llm_content)
|
||||
@@ -233,9 +231,7 @@ class ActionPlanner(BasePlanner):
|
||||
reasoning = extracted_reasoning
|
||||
|
||||
except Exception as json_e:
|
||||
logger.warning(
|
||||
f"{self.log_prefix}解析LLM响应JSON失败 {json_e}. LLM原始输出: '{llm_content}'"
|
||||
)
|
||||
logger.warning(f"{self.log_prefix}解析LLM响应JSON失败 {json_e}. LLM原始输出: '{llm_content}'")
|
||||
traceback.print_exc()
|
||||
reasoning = f"解析LLM响应JSON失败: {json_e}. 将使用默认动作 'no_reply'."
|
||||
action = "no_reply"
|
||||
|
||||
@@ -195,7 +195,6 @@ class DefaultReplyer:
|
||||
|
||||
await self._create_thinking_message(anchor_message, thinking_id)
|
||||
|
||||
|
||||
try:
|
||||
has_sent_something = False
|
||||
sent_msg_list = []
|
||||
@@ -209,7 +208,6 @@ class DefaultReplyer:
|
||||
else:
|
||||
logger.warning(f"{self.log_prefix} 没有找到合适表情")
|
||||
|
||||
|
||||
if reply:
|
||||
with Timer("发送表情", cycle_timers):
|
||||
sent_msg_list = await self.send_response_messages(
|
||||
@@ -231,8 +229,6 @@ class DefaultReplyer:
|
||||
traceback.print_exc()
|
||||
return False, None
|
||||
|
||||
|
||||
|
||||
async def reply(
|
||||
self,
|
||||
# in_mind_reply: str,
|
||||
@@ -385,7 +381,7 @@ class DefaultReplyer:
|
||||
style_habbits_str = "\n".join(style_habbits)
|
||||
grammar_habbits_str = "\n".join(grammar_habbits)
|
||||
|
||||
# 关键词检测与反应
|
||||
# 关键词检测与反应
|
||||
keywords_reaction_prompt = ""
|
||||
try:
|
||||
# 处理关键词规则
|
||||
|
||||
@@ -510,11 +510,15 @@ class MemoryManager:
|
||||
# 如果有摘要信息,添加到提示中
|
||||
if summary1:
|
||||
prompt += f"记忆1主题:{summary1['brief']}\n"
|
||||
prompt += "记忆1关键要点:\n" + "\n".join([f"- {point}" for point in summary1.get("key_points", [])]) + "\n\n"
|
||||
prompt += (
|
||||
"记忆1关键要点:\n" + "\n".join([f"- {point}" for point in summary1.get("key_points", [])]) + "\n\n"
|
||||
)
|
||||
|
||||
if summary2:
|
||||
prompt += f"记忆2主题:{summary2['brief']}\n"
|
||||
prompt += "记忆2关键要点:\n" + "\n".join([f"- {point}" for point in summary2.get("key_points", [])]) + "\n\n"
|
||||
prompt += (
|
||||
"记忆2关键要点:\n" + "\n".join([f"- {point}" for point in summary2.get("key_points", [])]) + "\n\n"
|
||||
)
|
||||
|
||||
# 添加记忆原始内容
|
||||
prompt += f"""
|
||||
|
||||
@@ -184,9 +184,7 @@ class ImageManager:
|
||||
return f"[图片:{cached_description}]"
|
||||
|
||||
# 调用AI获取描述
|
||||
prompt = (
|
||||
"请用中文描述这张图片的内容。如果有文字,请把文字都描述出来,请留意其主题,直观感受,以及是否有擦边色情内容。最多100个字。"
|
||||
)
|
||||
prompt = "请用中文描述这张图片的内容。如果有文字,请把文字都描述出来,请留意其主题,直观感受,以及是否有擦边色情内容。最多100个字。"
|
||||
description, _ = await self._llm.generate_response_for_image(prompt, image_base64, image_format)
|
||||
|
||||
if description is None:
|
||||
|
||||
@@ -90,7 +90,9 @@ class TelemetryHeartBeatTask(AsyncTask):
|
||||
else:
|
||||
logger.error("无效的服务端响应")
|
||||
else:
|
||||
logger.error(f"请求UUID失败,不过你还是可以正常使用麦麦,状态码: {response.status_code}, 响应内容: {response.text}")
|
||||
logger.error(
|
||||
f"请求UUID失败,不过你还是可以正常使用麦麦,状态码: {response.status_code}, 响应内容: {response.text}"
|
||||
)
|
||||
|
||||
# 请求失败,重试次数+1
|
||||
try_count += 1
|
||||
|
||||
@@ -79,7 +79,11 @@ class ConfigBase:
|
||||
|
||||
if field_origin_type is list:
|
||||
# 如果列表元素类型是ConfigBase的子类,则对每个元素调用from_dict
|
||||
if field_type_args and isinstance(field_type_args[0], type) and issubclass(field_type_args[0], ConfigBase):
|
||||
if (
|
||||
field_type_args
|
||||
and isinstance(field_type_args[0], type)
|
||||
and issubclass(field_type_args[0], ConfigBase)
|
||||
):
|
||||
return [field_type_args[0].from_dict(item) for item in value]
|
||||
return [cls._convert_field(item, field_type_args[0]) for item in value]
|
||||
elif field_origin_type is set:
|
||||
|
||||
Reference in New Issue
Block a user