fix Qdrant

This commit is contained in:
2026-06-18 12:25:15 +03:00
parent b4cc07b9f8
commit 99565ca107
3 changed files with 15 additions and 3 deletions
+3 -2
View File
@@ -1,7 +1,6 @@
import asyncio
import json
import logging
import threading
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timezone
from typing import Any
@@ -23,6 +22,8 @@ DEFAULT_PROFILE: dict[str, Any] = {
logger = logging.getLogger(__name__)
_RAG_EXECUTOR = ThreadPoolExecutor(max_workers=2, thread_name_prefix="rag")
class MemoryService:
def __init__(self, db: Session, user_id: int):
@@ -47,7 +48,7 @@ class MemoryService:
except Exception:
logger.exception("RAG background task failed")
threading.Thread(target=runner, daemon=True).start()
_RAG_EXECUTOR.submit(runner)
@staticmethod
def _rag_fact_payload(fact: MemoryFact) -> dict[str, Any]:
+4 -1
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
from functools import lru_cache
from typing import Any
from qdrant_client import QdrantClient
@@ -14,11 +15,13 @@ COLLECTION_FACTS = "memory_facts"
COLLECTION_SUMMARIES = "session_summaries"
COLLECTION_DOC_CHUNKS = "document_chunks"
VECTOR_SIZE = 1536
QDRANT_TIMEOUT_SEC = 30.0
@lru_cache
def _client() -> QdrantClient:
settings = get_settings()
return QdrantClient(url=settings.qdrant_url)
return QdrantClient(url=settings.qdrant_url, timeout=QDRANT_TIMEOUT_SEC)
def ensure_collections() -> None:
+8
View File
@@ -21,6 +21,10 @@ services:
- "${QDRANT_GRPC_PORT:-6334}:6334"
volumes:
- qdrant_data:/qdrant/storage
ulimits:
nofile:
soft: 65535
hard: 65535
restart: unless-stopped
backend:
@@ -31,6 +35,10 @@ services:
environment:
QDRANT_URL: ${QDRANT_URL:-http://qdrant:6333}
DATABASE_URL: postgresql+psycopg2://${POSTGRES_USER:-assistant}:${POSTGRES_PASSWORD:-assistant}@postgres:5432/${POSTGRES_DB:-assistant}
ulimits:
nofile:
soft: 65535
hard: 65535
depends_on:
postgres:
condition: service_healthy