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
parent f4404e09ef
commit 86377d983f
8 changed files with 215 additions and 112 deletions

View File

@@ -9,7 +9,7 @@ class ReplyerManager:
def __init__(self):
self._repliers: dict[str, DefaultReplyer] = {}
def get_replyer(
async def get_replyer(
self,
chat_stream: ChatStream | None = None,
chat_id: str | None = None,
@@ -37,7 +37,8 @@ class ReplyerManager:
target_stream = chat_stream
if not target_stream:
if chat_manager := get_chat_manager():
target_stream = chat_manager.get_stream(stream_id)
# get_stream 为异步,需要等待
target_stream = await chat_manager.get_stream(stream_id)
if not target_stream:
logger.warning(f"[ReplyerManager] 未找到 stream_id='{stream_id}' 的聊天流,无法创建回复器。")