fix:修复willing和表情包不注册

This commit is contained in:
SengokuCola
2025-04-03 21:30:53 +08:00
parent 7734c5d895
commit 06ef607e77
3 changed files with 8 additions and 2 deletions

View File

@@ -50,6 +50,7 @@ class MainSystem:
# 初始化表情管理器 # 初始化表情管理器
emoji_manager.initialize() emoji_manager.initialize()
logger.success("表情包管理器初始化成功")
# 启动情绪管理器 # 启动情绪管理器
self.mood_manager.start_mood_update(update_interval=global_config.mood_update_interval) self.mood_manager.start_mood_update(update_interval=global_config.mood_update_interval)
@@ -106,6 +107,7 @@ class MainSystem:
self.print_mood_task(), self.print_mood_task(),
self.remove_recalled_message_task(), self.remove_recalled_message_task(),
emoji_manager.start_periodic_check(), emoji_manager.start_periodic_check(),
emoji_manager.start_periodic_register(),
self.app.run(), self.app.run(),
] ]
await asyncio.gather(*tasks) await asyncio.gather(*tasks)

View File

@@ -39,6 +39,8 @@ class EmojiManager:
model=global_config.llm_emotion_judge, max_tokens=600, temperature=0.8, request_type="emoji" model=global_config.llm_emotion_judge, max_tokens=600, temperature=0.8, request_type="emoji"
) # 更高的温度更少的token后续可以根据情绪来调整温度 ) # 更高的温度更少的token后续可以根据情绪来调整温度
logger.info("启动表情包管理器")
def _ensure_emoji_dir(self): def _ensure_emoji_dir(self):
"""确保表情存储目录存在""" """确保表情存储目录存在"""
os.makedirs(self.EMOJI_DIR, exist_ok=True) os.makedirs(self.EMOJI_DIR, exist_ok=True)
@@ -338,7 +340,7 @@ class EmojiManager:
except Exception: except Exception:
logger.exception("[错误] 扫描表情包失败") logger.exception("[错误] 扫描表情包失败")
async def _periodic_scan(self): async def start_periodic_register(self):
"""定期扫描新表情包""" """定期扫描新表情包"""
while True: while True:
logger.info("[扫描] 开始扫描新表情包...") logger.info("[扫描] 开始扫描新表情包...")

View File

@@ -191,7 +191,9 @@ class ThinkFlowChat:
# 计算回复意愿 # 计算回复意愿
current_willing_old = willing_manager.get_willing(chat_stream=chat) current_willing_old = willing_manager.get_willing(chat_stream=chat)
current_willing_new = (heartflow.get_subheartflow(chat.stream_id).current_state.willing - 5) / 4 current_willing_new = (heartflow.get_subheartflow(chat.stream_id).current_state.willing - 5) / 4
current_willing = (current_willing_old + current_willing_new) / 2 # current_willing = (current_willing_old + current_willing_new) / 2
# 有点bug
current_willing = current_willing_old
willing_manager.set_willing(chat.stream_id, current_willing) willing_manager.set_willing(chat.stream_id, current_willing)