feat:完善个人侧写

This commit is contained in:
SengokuCola
2025-06-03 18:13:48 +08:00
parent e888636ea0
commit 4cb3850d0c
7 changed files with 107 additions and 59 deletions

View File

@@ -30,7 +30,10 @@ def init_prompt():
"""
你的自我认知是:
{self_info_block}
请记住你的性格,身份和特点。
{relation_info_block}
{extra_info_block}
{memory_str}

View File

@@ -204,9 +204,9 @@ class DefaultReplyer:
reply = []
with Timer("选择表情", cycle_timers):
emoji_keyword = action_data.get("description", [])
emoji_base64, description = await self._choose_emoji(emoji_keyword)
emoji_base64, _description, emotion = await self._choose_emoji(emoji_keyword)
if emoji_base64:
logger.info(f"选择表情: {description}")
# logger.info(f"选择表情: {_description}")
reply.append(("emoji", emoji_base64))
else:
logger.warning(f"{self.log_prefix} 没有找到合适表情")
@@ -578,9 +578,9 @@ class DefaultReplyer:
description = ""
emoji_raw = await emoji_manager.get_emoji_for_text(send_emoji)
if emoji_raw:
emoji_path, description = emoji_raw
emoji_path, description, _emotion = emoji_raw
emoji_base64 = image_path_to_base64(emoji_path)
return emoji_base64, description
return emoji_base64, description, _emotion
async def _build_single_sending_message(
self,

View File

@@ -157,7 +157,7 @@ class ChatManager:
message.message_info.group_info,
)
self.last_messages[stream_id] = message
logger.debug(f"注册消息到聊天流: {stream_id}")
# logger.debug(f"注册消息到聊天流: {stream_id}")
@staticmethod
def _generate_stream_id(platform: str, user_info: UserInfo, group_info: Optional[GroupInfo] = None) -> str:

View File

@@ -168,7 +168,7 @@ class NormalChat:
if random() < global_config.normal_chat.emoji_chance:
emoji_raw = await emoji_manager.get_emoji_for_text(response)
if emoji_raw:
emoji_path, description = emoji_raw
emoji_path, description, _emotion = emoji_raw
emoji_cq = image_path_to_base64(emoji_path)
thinking_time_point = round(message.message_info.time, 2)

View File

@@ -100,7 +100,7 @@ class PromptManager:
return context_prompt
# 如果上下文中不存在,则使用全局提示模板
async with self._lock:
logger.debug(f"从全局获取提示词: {name}")
# logger.debug(f"从全局获取提示词: {name}")
if name not in self._prompts:
raise KeyError(f"Prompt '{name}' not found")
return self._prompts[name]