🤖 自动格式化代码 [skip ci]
This commit is contained in:
@@ -122,7 +122,9 @@ class HeartFChatting:
|
|||||||
self.expressor = DefaultExpressor(chat_id=self.stream_id)
|
self.expressor = DefaultExpressor(chat_id=self.stream_id)
|
||||||
self.replyer = DefaultReplyer(chat_id=self.stream_id)
|
self.replyer = DefaultReplyer(chat_id=self.stream_id)
|
||||||
self.action_manager = ActionManager()
|
self.action_manager = ActionManager()
|
||||||
self.action_planner = PlannerFactory.create_planner(log_prefix=self.log_prefix, action_manager=self.action_manager)
|
self.action_planner = PlannerFactory.create_planner(
|
||||||
|
log_prefix=self.log_prefix, action_manager=self.action_manager
|
||||||
|
)
|
||||||
self.action_modifier = ActionModifier(action_manager=self.action_manager)
|
self.action_modifier = ActionModifier(action_manager=self.action_manager)
|
||||||
self.action_observation = ActionObservation(observe_id=self.stream_id)
|
self.action_observation = ActionObservation(observe_id=self.stream_id)
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from typing import List, Dict, Any
|
|||||||
from src.chat.focus_chat.planners.action_manager import ActionManager
|
from src.chat.focus_chat.planners.action_manager import ActionManager
|
||||||
from src.chat.focus_chat.info.info_base import InfoBase
|
from src.chat.focus_chat.info.info_base import InfoBase
|
||||||
|
|
||||||
|
|
||||||
class BasePlanner(ABC):
|
class BasePlanner(ABC):
|
||||||
"""规划器基类"""
|
"""规划器基类"""
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from src.common.logger_manager import get_logger
|
|||||||
|
|
||||||
logger = get_logger("planner_factory")
|
logger = get_logger("planner_factory")
|
||||||
|
|
||||||
|
|
||||||
class PlannerFactory:
|
class PlannerFactory:
|
||||||
"""规划器工厂类,用于创建不同类型的规划器实例"""
|
"""规划器工厂类,用于创建不同类型的规划器实例"""
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ def init_prompt():
|
|||||||
"planner_prompt",
|
"planner_prompt",
|
||||||
)
|
)
|
||||||
|
|
||||||
Prompt("""
|
Prompt(
|
||||||
|
"""
|
||||||
{raw_output}
|
{raw_output}
|
||||||
请从上面这段内容中提取出JSON内容,不要有任何其他文字或解释。
|
请从上面这段内容中提取出JSON内容,不要有任何其他文字或解释。
|
||||||
以严格的 JSON 格式输出,且仅包含 JSON 内容,不要有任何其他文字或解释。
|
以严格的 JSON 格式输出,且仅包含 JSON 内容,不要有任何其他文字或解释。
|
||||||
@@ -68,12 +69,9 @@ def init_prompt():
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
请输出你提取的JSON,不要有任何其他文字或解释:""",
|
请输出你提取的JSON,不要有任何其他文字或解释:""",
|
||||||
"planner_prompt_json",
|
"planner_prompt_json",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Prompt(
|
Prompt(
|
||||||
"""
|
"""
|
||||||
动作名称:{action_name}
|
动作名称:{action_name}
|
||||||
@@ -216,8 +214,6 @@ class ActionPlanner(BasePlanner):
|
|||||||
# reasoning = f"解析LLM响应JSON失败: {json_e}. 将使用默认动作 'no_reply'."
|
# reasoning = f"解析LLM响应JSON失败: {json_e}. 将使用默认动作 'no_reply'."
|
||||||
# action = "no_reply"
|
# action = "no_reply"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if llm_content:
|
if llm_content:
|
||||||
try:
|
try:
|
||||||
fixed_json_string = repair_json(llm_content)
|
fixed_json_string = repair_json(llm_content)
|
||||||
|
|||||||
Reference in New Issue
Block a user