feat:黑话更高的提取率;增加提取准确性
黑话解释现在独立运行,拥有更高的提取率 增加提取准确性
This commit is contained in:
@@ -36,6 +36,7 @@ from src.chat.replyer.prompt.lpmm_prompt import init_lpmm_prompt
|
||||
from src.chat.replyer.prompt.replyer_prompt import init_replyer_prompt
|
||||
from src.chat.replyer.prompt.rewrite_prompt import init_rewrite_prompt
|
||||
from src.memory_system.memory_retrieval import init_memory_retrieval_prompt, build_memory_retrieval_prompt
|
||||
from src.jargon.jargon_explainer import explain_jargon_in_context
|
||||
|
||||
init_lpmm_prompt()
|
||||
init_replyer_prompt()
|
||||
@@ -786,7 +787,7 @@ class DefaultReplyer:
|
||||
show_actions=True,
|
||||
)
|
||||
|
||||
# 并行执行七个构建任务
|
||||
# 并行执行八个构建任务(包括黑话解释)
|
||||
task_results = await asyncio.gather(
|
||||
self._time_and_run_task(
|
||||
self.build_expression_habits(chat_talking_prompt_short, target, reply_reason), "expression_habits"
|
||||
@@ -804,6 +805,10 @@ class DefaultReplyer:
|
||||
),
|
||||
"memory_retrieval",
|
||||
),
|
||||
self._time_and_run_task(
|
||||
explain_jargon_in_context(chat_id, message_list_before_short, chat_talking_prompt_short),
|
||||
"jargon_explanation",
|
||||
),
|
||||
)
|
||||
|
||||
# 任务名称中英文映射
|
||||
@@ -816,6 +821,7 @@ class DefaultReplyer:
|
||||
"personality_prompt": "人格信息",
|
||||
"mood_state_prompt": "情绪状态",
|
||||
"memory_retrieval": "记忆检索",
|
||||
"jargon_explanation": "黑话解释",
|
||||
}
|
||||
|
||||
# 处理结果
|
||||
@@ -846,6 +852,7 @@ class DefaultReplyer:
|
||||
memory_retrieval: str = results_dict["memory_retrieval"]
|
||||
keywords_reaction_prompt = await self.build_keywords_reaction_prompt(target)
|
||||
mood_state_prompt: str = results_dict["mood_state_prompt"]
|
||||
jargon_explanation: Optional[str] = results_dict.get("jargon_explanation")
|
||||
|
||||
# 从 chosen_actions 中提取 planner 的整体思考理由
|
||||
planner_reasoning = ""
|
||||
@@ -896,6 +903,7 @@ class DefaultReplyer:
|
||||
mood_state=mood_state_prompt,
|
||||
# relation_info_block=relation_info,
|
||||
extra_info_block=extra_info_block,
|
||||
jargon_explanation=jargon_explanation,
|
||||
identity=personality_prompt,
|
||||
action_descriptions=actions_info,
|
||||
sender_name=sender,
|
||||
|
||||
@@ -37,6 +37,7 @@ from src.chat.replyer.prompt.lpmm_prompt import init_lpmm_prompt
|
||||
from src.chat.replyer.prompt.replyer_prompt import init_replyer_prompt
|
||||
from src.chat.replyer.prompt.rewrite_prompt import init_rewrite_prompt
|
||||
from src.memory_system.memory_retrieval import init_memory_retrieval_prompt, build_memory_retrieval_prompt
|
||||
from src.jargon.jargon_explainer import explain_jargon_in_context
|
||||
|
||||
init_lpmm_prompt()
|
||||
init_replyer_prompt()
|
||||
@@ -706,7 +707,7 @@ class PrivateReplyer:
|
||||
show_actions=True,
|
||||
)
|
||||
|
||||
# 并行执行八个构建任务
|
||||
# 并行执行九个构建任务(包括黑话解释)
|
||||
task_results = await asyncio.gather(
|
||||
self._time_and_run_task(
|
||||
self.build_expression_habits(chat_talking_prompt_short, target, reply_reason), "expression_habits"
|
||||
@@ -725,6 +726,10 @@ class PrivateReplyer:
|
||||
),
|
||||
"memory_retrieval",
|
||||
),
|
||||
self._time_and_run_task(
|
||||
explain_jargon_in_context(chat_id, message_list_before_short, chat_talking_prompt_short),
|
||||
"jargon_explanation",
|
||||
),
|
||||
)
|
||||
|
||||
# 任务名称中英文映射
|
||||
@@ -737,6 +742,7 @@ class PrivateReplyer:
|
||||
"personality_prompt": "人格信息",
|
||||
"mood_state_prompt": "情绪状态",
|
||||
"memory_retrieval": "记忆检索",
|
||||
"jargon_explanation": "黑话解释",
|
||||
}
|
||||
|
||||
# 处理结果
|
||||
@@ -767,6 +773,7 @@ class PrivateReplyer:
|
||||
mood_state_prompt: str = results_dict["mood_state_prompt"]
|
||||
memory_retrieval: str = results_dict["memory_retrieval"]
|
||||
keywords_reaction_prompt = await self.build_keywords_reaction_prompt(target)
|
||||
jargon_explanation: Optional[str] = results_dict.get("jargon_explanation")
|
||||
|
||||
# 从 chosen_actions 中提取 planner 的整体思考理由
|
||||
planner_reasoning = ""
|
||||
@@ -813,6 +820,7 @@ class PrivateReplyer:
|
||||
identity=personality_prompt,
|
||||
action_descriptions=actions_info,
|
||||
dialogue_prompt=dialogue_prompt,
|
||||
jargon_explanation=jargon_explanation,
|
||||
time_block=time_block,
|
||||
target=target,
|
||||
reason=reply_reason,
|
||||
@@ -835,6 +843,7 @@ class PrivateReplyer:
|
||||
identity=personality_prompt,
|
||||
action_descriptions=actions_info,
|
||||
dialogue_prompt=dialogue_prompt,
|
||||
jargon_explanation=jargon_explanation,
|
||||
time_block=time_block,
|
||||
reply_target_block=reply_target_block,
|
||||
reply_style=global_config.personality.reply_style,
|
||||
|
||||
@@ -8,7 +8,7 @@ def init_replyer_prompt():
|
||||
|
||||
Prompt(
|
||||
"""{knowledge_prompt}{tool_info_block}{extra_info_block}
|
||||
{expression_habits_block}{memory_retrieval}
|
||||
{expression_habits_block}{memory_retrieval}{jargon_explanation}
|
||||
|
||||
你正在qq群里聊天,下面是群里正在聊的内容,其中包含聊天记录和聊天中的图片
|
||||
其中标注 {bot_name}(你) 的发言是你自己的发言,请注意区分:
|
||||
@@ -29,7 +29,7 @@ def init_replyer_prompt():
|
||||
|
||||
Prompt(
|
||||
"""{knowledge_prompt}{tool_info_block}{extra_info_block}
|
||||
{expression_habits_block}{memory_retrieval}
|
||||
{expression_habits_block}{memory_retrieval}{jargon_explanation}
|
||||
|
||||
你正在和{sender_name}聊天,这是你们之前聊的内容:
|
||||
{time_block}
|
||||
@@ -48,7 +48,7 @@ def init_replyer_prompt():
|
||||
|
||||
Prompt(
|
||||
"""{knowledge_prompt}{tool_info_block}{extra_info_block}
|
||||
{expression_habits_block}{memory_retrieval}
|
||||
{expression_habits_block}{memory_retrieval}{jargon_explanation}
|
||||
|
||||
你正在和{sender_name}聊天,这是你们之前聊的内容:
|
||||
{time_block}
|
||||
|
||||
Reference in New Issue
Block a user