fix:修复小bug
This commit is contained in:
@@ -211,7 +211,8 @@ class ExpressionLearner:
|
|||||||
chat_id: str = random_msg[0]["chat_id"]
|
chat_id: str = random_msg[0]["chat_id"]
|
||||||
# random_msg_str: str = await build_readable_messages(random_msg, timestamp_mode="normal")
|
# random_msg_str: str = await build_readable_messages(random_msg, timestamp_mode="normal")
|
||||||
random_msg_str: str = await build_anonymous_messages(random_msg)
|
random_msg_str: str = await build_anonymous_messages(random_msg)
|
||||||
|
# print(f"random_msg_str:{random_msg_str}")
|
||||||
|
|
||||||
prompt: str = await global_prompt_manager.format_prompt(
|
prompt: str = await global_prompt_manager.format_prompt(
|
||||||
prompt,
|
prompt,
|
||||||
chat_str=random_msg_str,
|
chat_str=random_msg_str,
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class ChattingInfoProcessor(BaseProcessor):
|
|||||||
|
|
||||||
async def chat_compress(self, obs: ChattingObservation):
|
async def chat_compress(self, obs: ChattingObservation):
|
||||||
if obs.compressor_prompt:
|
if obs.compressor_prompt:
|
||||||
|
summary = ""
|
||||||
try:
|
try:
|
||||||
summary_result, _, _ = await self.model_summary.generate_response(obs.compressor_prompt)
|
summary_result, _, _ = await self.model_summary.generate_response(obs.compressor_prompt)
|
||||||
summary = "没有主题的闲聊" # 默认值
|
summary = "没有主题的闲聊" # 默认值
|
||||||
|
|||||||
@@ -449,7 +449,11 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
|
|||||||
output_lines = []
|
output_lines = []
|
||||||
|
|
||||||
def get_anon_name(platform, user_id):
|
def get_anon_name(platform, user_id):
|
||||||
|
# print(f"get_anon_name: platform:{platform}, user_id:{user_id}")
|
||||||
|
# print(f"global_config.bot.qq_account:{global_config.bot.qq_account}")
|
||||||
|
|
||||||
if user_id == global_config.bot.qq_account:
|
if user_id == global_config.bot.qq_account:
|
||||||
|
# print("SELF11111111111111")
|
||||||
return "SELF"
|
return "SELF"
|
||||||
try:
|
try:
|
||||||
person_id = person_info_manager.get_person_id(platform, user_id)
|
person_id = person_info_manager.get_person_id(platform, user_id)
|
||||||
@@ -467,7 +471,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
|
|||||||
try:
|
try:
|
||||||
# user_info = msg.get("user_info", {})
|
# user_info = msg.get("user_info", {})
|
||||||
platform = msg.get("chat_info_platform")
|
platform = msg.get("chat_info_platform")
|
||||||
user_id = msg.get("chat_info_user_id")
|
user_id = msg.get("user_id")
|
||||||
timestamp = msg.get("time")
|
timestamp = msg.get("time")
|
||||||
# print(f"msg:{msg}")
|
# print(f"msg:{msg}")
|
||||||
# print(f"platform:{platform}")
|
# print(f"platform:{platform}")
|
||||||
@@ -497,6 +501,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
|
|||||||
bbb = match.group(2)
|
bbb = match.group(2)
|
||||||
try:
|
try:
|
||||||
anon_reply = get_anon_name(platform, bbb)
|
anon_reply = get_anon_name(platform, bbb)
|
||||||
|
# print(f"anon_reply:{anon_reply}")
|
||||||
except Exception:
|
except Exception:
|
||||||
anon_reply = "?"
|
anon_reply = "?"
|
||||||
content = re.sub(reply_pattern, f"回复 {anon_reply}", content, count=1)
|
content = re.sub(reply_pattern, f"回复 {anon_reply}", content, count=1)
|
||||||
@@ -513,6 +518,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
|
|||||||
bbb = m.group(2)
|
bbb = m.group(2)
|
||||||
try:
|
try:
|
||||||
anon_at = get_anon_name(platform, bbb)
|
anon_at = get_anon_name(platform, bbb)
|
||||||
|
# print(f"anon_at:{anon_at}")
|
||||||
except Exception:
|
except Exception:
|
||||||
anon_at = "?"
|
anon_at = "?"
|
||||||
new_content += f"@{anon_at}"
|
new_content += f"@{anon_at}"
|
||||||
|
|||||||
Reference in New Issue
Block a user