mirror of
https://gitee.com/qqtt-ah/ai-crm.git
synced 2026-11-24 09:49:20 +08:00
refactor: 移除 Redis/Rabbit 依赖,Agent Mongo 切至 ai_crm_angent_dev
This commit is contained in:
@@ -13,17 +13,16 @@ from domain.models import Actor
|
||||
from infrastructure.auth.jwt import parse_actor
|
||||
from infrastructure.llm.factory import OpenAICompatibleStreamer
|
||||
from infrastructure.llm.gateway import ServerLlmRuntimeGateway
|
||||
from infrastructure.persistence.memory.cache import (
|
||||
NoopLlmProtocolCapabilityCache,
|
||||
NoopLlmRuntimeCache,
|
||||
)
|
||||
from infrastructure.persistence.mongo.client import get_db
|
||||
from infrastructure.persistence.mongo.repositories import (
|
||||
MongoMemoryRepository,
|
||||
MongoMessageRepository,
|
||||
MongoSessionRepository,
|
||||
)
|
||||
from infrastructure.persistence.redis.cache import (
|
||||
RedisLlmProtocolCapabilityCache,
|
||||
RedisLlmRuntimeCache,
|
||||
get_redis,
|
||||
)
|
||||
|
||||
|
||||
async def current_actor(
|
||||
@@ -41,8 +40,9 @@ async def current_actor(
|
||||
async def llm_runtime_service(
|
||||
settings: Settings = Depends(get_settings),
|
||||
) -> LlmRuntimeService:
|
||||
cache = RedisLlmRuntimeCache(get_redis(settings))
|
||||
return LlmRuntimeService(settings, cache, ServerLlmRuntimeGateway(settings))
|
||||
return LlmRuntimeService(
|
||||
settings, NoopLlmRuntimeCache(), ServerLlmRuntimeGateway(settings)
|
||||
)
|
||||
|
||||
|
||||
async def session_service(
|
||||
@@ -77,7 +77,7 @@ async def chat_service(
|
||||
llm_runtime=llm_svc,
|
||||
memory=mem_svc,
|
||||
streamer=OpenAICompatibleStreamer(
|
||||
RedisLlmProtocolCapabilityCache(get_redis(settings)),
|
||||
NoopLlmProtocolCapabilityCache(),
|
||||
capability_ttl_seconds=settings.llm_capability_ttl_seconds,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -12,7 +12,6 @@ from api.response import fail
|
||||
from api.routers import chat, memories, sessions
|
||||
from config.settings import get_settings
|
||||
from infrastructure.persistence.mongo.client import close_mongo, ensure_indexes, get_db
|
||||
from infrastructure.persistence.redis.cache import close_redis
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -22,7 +21,6 @@ async def lifespan(_app: FastAPI):
|
||||
await ensure_indexes(db)
|
||||
yield
|
||||
await close_mongo()
|
||||
await close_redis()
|
||||
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
|
||||
Reference in New Issue
Block a user