Refactor replyer retrieval to async and add memory formatter

Changed get_replyer and related calls to async across multiple modules for proper coroutine handling. Added format_memories_bracket_style utility for memory formatting. Improved video analysis caching logic and type annotations. Updated error logging for message processing.
This commit is contained in:
雅诺狐
2025-10-05 17:48:28 +08:00
committed by Windpicker-owo
parent a9c592b203
commit 97dc145b76
7 changed files with 202 additions and 104 deletions

View File

@@ -4,7 +4,7 @@
提供回复器相关功能采用标准Python包设计模式
使用方式:
from src.plugin_system.apis import generator_api
replyer = generator_api.get_replyer(chat_stream)
replyer = await generator_api.get_replyer(chat_stream)
success, reply_set, _ = await generator_api.generate_reply(chat_stream, action_data, reasoning)
"""
@@ -57,8 +57,6 @@ async def get_replyer(
raise ValueError("chat_stream 和 chat_id 不可均为空")
try:
logger.debug(f"[GeneratorAPI] 正在获取回复器chat_id: {chat_id}, chat_stream: {'' if chat_stream else ''}")
# 动态导入避免循环依赖
from src.chat.replyer.replyer_manager import replyer_manager
return await replyer_manager.get_replyer(
chat_stream=chat_stream,
chat_id=chat_id,