fix(voice): recover dialogue after abandoned message recordings

This commit is contained in:
stu2not
2026-10-28 12:22:58 +08:00
parent a02e0d5f13
commit 9ebb1a78ec
10 changed files with 622 additions and 85 deletions
@@ -3,6 +3,7 @@ from config import settings
from services.audio_session import audio_session_manager
from utils.logger import session_logger
from services.conversation_history import conversation_history_manager
from services.device_target_cache import device_target_cache
async def run_in_executor(func, *args):
loop = asyncio.get_running_loop()
@@ -12,6 +13,7 @@ async def background_cleanup_task():
try:
while True:
await asyncio.sleep(settings.cleanup_interval)
await device_target_cache.get_all_targets()
current_time = asyncio.get_running_loop().time()
audio_sessions_to_clean = []
@@ -54,4 +56,4 @@ async def background_cleanup_task():
except asyncio.CancelledError:
session_logger.info("system", "cleanup", "后台清理任务已取消")
except Exception as e:
session_logger.error("system", "cleanup", f"后台清理任务出错: {str(e)}")
session_logger.error("system", "cleanup", f"后台清理任务出错: {str(e)}")