feat: persist isolated vector snapshots and exact retrieval

This commit is contained in:
2026-10-16 09:52:02 +08:00
parent 1c07d9ed16
commit 5e5cba2698
24 changed files with 1729 additions and 20 deletions
+15 -3
View File
@@ -8,7 +8,17 @@ from sqlalchemy import text
from sqlalchemy.exc import IntegrityError, OperationalError, ProgrammingError
from sqlalchemy.orm.exc import StaleDataError
from app.api.routes import auth, chat, documents, health, indexes, knowledge, retrieval, sources
from app.api.routes import (
auth,
chat,
documents,
health,
indexes,
knowledge,
retrieval,
sources,
vectors,
)
from app.core.config import settings
from app.db.session import engine
from app.services.auth import dummy_hash
@@ -21,7 +31,7 @@ def create_app(db_engine=engine) -> FastAPI:
try:
with db_engine.connect() as connection:
revision = connection.scalar(text("SELECT version_num FROM alembic_version"))
if revision != "0005_chunk_indexes":
if revision != "0006_vectors":
raise RuntimeError(
"数据库版本不匹配,请先在 backend 目录执行 alembic upgrade head"
)
@@ -36,7 +46,7 @@ def create_app(db_engine=engine) -> FastAPI:
finally:
db_engine.dispose()
app = FastAPI(title=settings.app_name, version="0.5.0", lifespan=lifespan)
app = FastAPI(title=settings.app_name, version="0.6.0", lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=settings.cors_origin_list,
@@ -48,6 +58,8 @@ def create_app(db_engine=engine) -> FastAPI:
health.router,
auth.router,
indexes.router,
vectors.router,
vectors.retrieval_router,
chat.router,
knowledge.router,
sources.router,