77
88import json
99from astrbot .core import sp
10- from typing import Dict , List , Callable , Awaitable
10+
11+ from collections .abc import Callable , Awaitable
1112from astrbot .core .db import BaseDatabase
1213from astrbot .core .db .po import Conversation , ConversationV2
1314
@@ -16,12 +17,12 @@ class ConversationManager:
1617 """负责管理会话与 LLM 的对话,某个会话当前正在用哪个对话。"""
1718
1819 def __init__ (self , db_helper : BaseDatabase ):
19- self .session_conversations : Dict [str , str ] = {}
20+ self .session_conversations : dict [str , str ] = {}
2021 self .db = db_helper
2122 self .save_interval = 60 # 每 60 秒保存一次
2223
2324 # 会话删除回调函数列表(用于级联清理,如知识库配置)
24- self ._on_session_deleted_callbacks : List [Callable [[str ], Awaitable [None ]]] = []
25+ self ._on_session_deleted_callbacks : list [Callable [[str ], Awaitable [None ]]] = []
2526
2627 def register_on_session_deleted (
2728 self , callback : Callable [[str ], Awaitable [None ]]
@@ -182,7 +183,7 @@ async def get_conversation(
182183
183184 async def get_conversations (
184185 self , unified_msg_origin : str | None = None , platform_id : str | None = None
185- ) -> List [Conversation ]:
186+ ) -> list [Conversation ]:
186187 """获取对话列表
187188
188189 Args:
0 commit comments