feat: 配置写死与 baked 模块,Alembic 建表,百度仅 BAIDU_*

- 新增 app/baked/algorithm|pipeline,非部署参数不再走 env;Settings 保留 DB/HTTP/RTSP/海康/百度/MinIO/Demo
- 移除 init_db_schema 与 reload 配置;main 仅 check_database;start*.sh 在 uvicorn 前执行 alembic upgrade head
- 依赖 psycopg[binary] 供 Alembic 同步 URL;alembic/env 注释与预发清单更新
- 撕段门控消费管线、各视频/语音/归档调用改为 baked
- 百度环境变量仅 BAIDU_APP_ID、BAIDU_API_KEY、BAIDU_SECRET_KEY 与 BAIDU_* 超时/ASR;人脸脚本与 baidu_speech 文案同步
- 全量单测与 .env.example 更新;.gitignore 忽略 refs/(本地权重/视频不入库)

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-24 15:33:22 +08:00
parent b651364877
commit 8a4bad99d3
47 changed files with 1333 additions and 648 deletions

View File

@@ -8,7 +8,7 @@ from datetime import datetime, timezone
import pytest
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
from app.config import Settings
from app.baked import pipeline as bp
from app.domain.consumption import SurgeryConsumptionStored
from app.repositories.surgery_results import SurgeryResultRepository
from app.services.video.archive_persister import ArchivePersister
@@ -39,12 +39,12 @@ def _detail(item_id: str = "纱布") -> SurgeryConsumptionStored:
async def test_persist_or_archive_writes_durable_fallback(
tmp_path,
sqlite_session_factory: async_sessionmaker[AsyncSession],
monkeypatch: pytest.MonkeyPatch,
) -> None:
fallback_dir = tmp_path / "pending_archive"
settings = Settings(archive_persist_durable_fallback_dir=str(fallback_dir))
monkeypatch.setattr(bp, "ARCHIVE_PERSIST_DURABLE_FALLBACK_DIR", str(fallback_dir))
repo = _AlwaysFailRepo()
persister = ArchivePersister(
settings=settings,
repository=repo,
session_factory=sqlite_session_factory,
)
@@ -62,6 +62,7 @@ async def test_persist_or_archive_writes_durable_fallback(
async def test_recover_from_durable_fallback_reloads_pending_archive(
tmp_path,
sqlite_session_factory: async_sessionmaker[AsyncSession],
monkeypatch: pytest.MonkeyPatch,
) -> None:
fallback_dir = tmp_path / "pending_archive"
fallback_dir.mkdir()
@@ -82,9 +83,8 @@ async def test_recover_from_durable_fallback_reloads_pending_archive(
(fallback_dir / "recov01.json").write_text(
json.dumps(payload, ensure_ascii=False), encoding="utf-8"
)
settings = Settings(archive_persist_durable_fallback_dir=str(fallback_dir))
monkeypatch.setattr(bp, "ARCHIVE_PERSIST_DURABLE_FALLBACK_DIR", str(fallback_dir))
persister = ArchivePersister(
settings=settings,
repository=SurgeryResultRepository(),
session_factory=sqlite_session_factory,
)