🤖 自动格式化代码 [skip ci]
This commit is contained in:
@@ -29,7 +29,6 @@ import traceback
|
|||||||
|
|
||||||
from .normal_chat_generator import NormalChatGenerator
|
from .normal_chat_generator import NormalChatGenerator
|
||||||
from src.chat.normal_chat.normal_chat_expressor import NormalChatExpressor
|
from src.chat.normal_chat.normal_chat_expressor import NormalChatExpressor
|
||||||
from src.chat.replyer.default_generator import DefaultReplyer
|
|
||||||
from src.chat.normal_chat.normal_chat_planner import NormalChatPlanner
|
from src.chat.normal_chat.normal_chat_planner import NormalChatPlanner
|
||||||
from src.chat.normal_chat.normal_chat_action_modifier import NormalChatActionModifier
|
from src.chat.normal_chat.normal_chat_action_modifier import NormalChatActionModifier
|
||||||
|
|
||||||
|
|||||||
@@ -143,14 +143,14 @@ class DefaultReplyer:
|
|||||||
):
|
):
|
||||||
self.log_prefix = "replyer"
|
self.log_prefix = "replyer"
|
||||||
self.request_type = request_type
|
self.request_type = request_type
|
||||||
|
|
||||||
self.enable_tool = enable_tool
|
self.enable_tool = enable_tool
|
||||||
|
|
||||||
if model_configs:
|
if model_configs:
|
||||||
self.express_model_configs = model_configs
|
self.express_model_configs = model_configs
|
||||||
else:
|
else:
|
||||||
# 当未提供配置时,使用默认配置并赋予默认权重
|
# 当未提供配置时,使用默认配置并赋予默认权重
|
||||||
|
|
||||||
model_config_1 = global_config.model.replyer_1.copy()
|
model_config_1 = global_config.model.replyer_1.copy()
|
||||||
model_config_2 = global_config.model.replyer_2.copy()
|
model_config_2 = global_config.model.replyer_2.copy()
|
||||||
prob_first = global_config.chat.replyer_random_probability
|
prob_first = global_config.chat.replyer_random_probability
|
||||||
@@ -172,11 +172,7 @@ class DefaultReplyer:
|
|||||||
|
|
||||||
self.heart_fc_sender = HeartFCSender()
|
self.heart_fc_sender = HeartFCSender()
|
||||||
self.memory_activator = MemoryActivator()
|
self.memory_activator = MemoryActivator()
|
||||||
self.tool_executor = ToolExecutor(
|
self.tool_executor = ToolExecutor(chat_id=self.chat_stream.stream_id, enable_cache=True, cache_ttl=3)
|
||||||
chat_id=self.chat_stream.stream_id,
|
|
||||||
enable_cache=True,
|
|
||||||
cache_ttl=3
|
|
||||||
)
|
|
||||||
|
|
||||||
def _select_weighted_model_config(self) -> Dict[str, Any]:
|
def _select_weighted_model_config(self) -> Dict[str, Any]:
|
||||||
"""使用加权随机选择来挑选一个模型配置"""
|
"""使用加权随机选择来挑选一个模型配置"""
|
||||||
@@ -575,8 +571,6 @@ class DefaultReplyer:
|
|||||||
else:
|
else:
|
||||||
tool_info_block = ""
|
tool_info_block = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if extra_info_block:
|
if extra_info_block:
|
||||||
extra_info_block = f"以下是你在回复时需要参考的信息,现在请你阅读以下内容,进行决策\n{extra_info_block}\n以上是你在回复时需要参考的信息,现在请你阅读以下内容,进行决策"
|
extra_info_block = f"以下是你在回复时需要参考的信息,现在请你阅读以下内容,进行决策\n{extra_info_block}\n以上是你在回复时需要参考的信息,现在请你阅读以下内容,进行决策"
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ class Config(ConfigBase):
|
|||||||
lpmm_knowledge: LPMMKnowledgeConfig
|
lpmm_knowledge: LPMMKnowledgeConfig
|
||||||
tool: ToolConfig
|
tool: ToolConfig
|
||||||
|
|
||||||
|
|
||||||
def load_config(config_path: str) -> Config:
|
def load_config(config_path: str) -> Config:
|
||||||
"""
|
"""
|
||||||
加载配置文件
|
加载配置文件
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ class ExpressionConfig(ConfigBase):
|
|||||||
格式: [["qq:12345:group", "qq:67890:private"]]
|
格式: [["qq:12345:group", "qq:67890:private"]]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ToolConfig(ConfigBase):
|
class ToolConfig(ConfigBase):
|
||||||
"""工具配置类"""
|
"""工具配置类"""
|
||||||
@@ -346,7 +347,8 @@ class ToolConfig(ConfigBase):
|
|||||||
|
|
||||||
enable_in_focus_chat: bool = True
|
enable_in_focus_chat: bool = True
|
||||||
"""是否在专注聊天中启用工具"""
|
"""是否在专注聊天中启用工具"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class EmojiConfig(ConfigBase):
|
class EmojiConfig(ConfigBase):
|
||||||
"""表情包配置类"""
|
"""表情包配置类"""
|
||||||
|
|||||||
@@ -94,7 +94,9 @@ async def generate_reply(
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# 获取回复器
|
# 获取回复器
|
||||||
replyer = get_replyer(chat_stream, chat_id, model_configs=model_configs, request_type=request_type, enable_tool=enable_tool)
|
replyer = get_replyer(
|
||||||
|
chat_stream, chat_id, model_configs=model_configs, request_type=request_type, enable_tool=enable_tool
|
||||||
|
)
|
||||||
if not replyer:
|
if not replyer:
|
||||||
logger.error("[GeneratorAPI] 无法获取回复器")
|
logger.error("[GeneratorAPI] 无法获取回复器")
|
||||||
return False, []
|
return False, []
|
||||||
|
|||||||
Reference in New Issue
Block a user