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

@@ -2,7 +2,7 @@
import pytest
from app.config import settings
from app.baked import pipeline as bp
from app.services.consumable_vision_algorithm import ClsTop3
from app.services.consumption_tsv_log import (
HEADER,
@@ -25,7 +25,7 @@ def test_short_camera_label() -> None:
def test_build_tsv_line_matches_sample_shape(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(settings, "consumption_log_timezone", "UTC")
monkeypatch.setattr(bp, "CONSUMPTION_LOG_TIMEZONE", "UTC")
best = ClsTop3(
t1_name="一次性医用灭菌棉签",
t1_conf=0.9997,
@@ -90,11 +90,11 @@ def test_replace_pending_line_with_voice_resolution_rewrites_one_row(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""语音确认后应替换 pending 行,而不是再多一行。"""
monkeypatch.setattr(settings, "consumption_tsv_log_enabled", True)
monkeypatch.setattr(settings, "consumption_log_timezone", "UTC")
monkeypatch.setattr(bp, "CONSUMPTION_TSV_LOG_ENABLED", True)
monkeypatch.setattr(bp, "CONSUMPTION_LOG_TIMEZONE", "UTC")
monkeypatch.setattr(
settings,
"consumption_tsv_log_path",
bp,
"CONSUMPTION_TSV_LOG_PATH",
str(tmp_path / "{surgery_id}.txt"),
)
init_consumption_log_file("SURG01")
@@ -126,10 +126,10 @@ def test_per_surgery_file_init_and_append(
tmp_path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(settings, "consumption_tsv_log_enabled", True)
monkeypatch.setattr(bp, "CONSUMPTION_TSV_LOG_ENABLED", True)
monkeypatch.setattr(
settings,
"consumption_tsv_log_path",
bp,
"CONSUMPTION_TSV_LOG_PATH",
str(tmp_path / "{surgery_id}.txt"),
)
init_consumption_log_file("or-001")
@@ -145,10 +145,10 @@ def test_append_consumption_log_summary_appends_three_column_block(
tmp_path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(settings, "consumption_tsv_log_enabled", True)
monkeypatch.setattr(bp, "CONSUMPTION_TSV_LOG_ENABLED", True)
monkeypatch.setattr(
settings,
"consumption_tsv_log_path",
bp,
"CONSUMPTION_TSV_LOG_PATH",
str(tmp_path / "{surgery_id}.txt"),
)
init_consumption_log_file("s1")
@@ -167,7 +167,7 @@ def test_append_consumption_log_summary_appends_three_column_block(
def test_build_consumption_markdown_top123_columns(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(settings, "consumption_log_timezone", "UTC")
monkeypatch.setattr(bp, "CONSUMPTION_LOG_TIMEZONE", "UTC")
best = ClsTop3(
t1_name="一次性医用灭菌棉签",
t1_conf=0.9997,