mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
fix(agent): close async chat persistence lifecycle
This commit is contained in:
@@ -4,6 +4,7 @@ from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.api.context import (
|
||||
get_agent_chat_runtime,
|
||||
get_agent_chat_repository,
|
||||
get_agent_chat_transaction,
|
||||
get_async_session,
|
||||
@@ -11,6 +12,7 @@ from app.api.context import (
|
||||
)
|
||||
from app.application.messaging.chat import (
|
||||
AgentChatService,
|
||||
AgentChatPersistenceService,
|
||||
AsyncAgentChatRepository,
|
||||
AsyncUnitOfWork,
|
||||
)
|
||||
@@ -26,6 +28,13 @@ def get_agent_chat_service(
|
||||
return AgentChatService(chat_repository, unit_of_work)
|
||||
|
||||
|
||||
def get_agent_chat_persistence(
|
||||
runtime: HostRuntime = Depends(get_agent_chat_runtime),
|
||||
) -> AgentChatPersistenceService:
|
||||
"""从类型化 Agent 运行时获取有界会话写入端口。"""
|
||||
return runtime.persistence
|
||||
|
||||
|
||||
def get_message_query_service(
|
||||
db: AsyncSession = Depends(get_async_session),
|
||||
runtime: HostRuntime = Depends(get_host_runtime),
|
||||
|
||||
Reference in New Issue
Block a user