This commit is contained in:
tt-P607
2025-09-14 16:44:44 +08:00
12 changed files with 362 additions and 143 deletions

View File

@@ -42,15 +42,18 @@ class PlanFilter:
"""
执行筛选逻辑,并填充 Plan 对象的 decided_actions 字段。
"""
logger.debug(f"墨墨在这里加了日志 -> filter 入口 plan: {plan}")
try:
prompt, used_message_id_list = await self._build_prompt(plan)
plan.llm_prompt = prompt
logger.debug(f"墨墨在这里加了日志 -> LLM prompt: {prompt}")
llm_content, _ = await self.planner_llm.generate_response_async(prompt=prompt)
if llm_content:
logger.debug(f"LLM a原始返回: {llm_content}")
logger.debug(f"墨墨在这里加了日志 -> LLM a原始返回: {llm_content}")
parsed_json = orjson.loads(repair_json(llm_content))
logger.debug(f"墨墨在这里加了日志 -> 解析后的 JSON: {parsed_json}")
if isinstance(parsed_json, dict):
parsed_json = [parsed_json]
@@ -91,7 +94,8 @@ class PlanFilter:
plan.decided_actions = [
ActionPlannerInfo(action_type="no_action", reasoning=f"筛选时出错: {e}")
]
logger.debug(f"墨墨在这里加了日志 -> filter 出口 decided_actions: {plan.decided_actions}")
return plan
async def _build_prompt(self, plan: Plan) -> tuple[str, list]: