refactor(eval+memoir):精简内部评测路由与服务,composite/对话摘要与 judge 能力补强

- 访谈:新增 interview_state_hints,联动 orchestrator 与提示词
- 回忆录:story_pipeline_sync/state/memory/post_commit 与 Celery 任务调整
- 基建:开发用 celery broker、compose/development 脚本、依赖注入
- eval-web:移除数据集/实验/版本等页面与流式轮询,突出 Playground
- 文档与单测同步
This commit is contained in:
Kevin
2026-04-08 21:36:12 +08:00
parent 2a0c80987d
commit 064ad2161d
64 changed files with 3412 additions and 3068 deletions

View File

@@ -4,11 +4,12 @@ import pytest
from httpx import ASGITransport, AsyncClient
from app.features.evaluation.internal_auth import get_internal_eval_principal
from app.features.evaluation.router import router
@pytest.mark.asyncio
async def test_internal_eval_list_sets_requires_config(monkeypatch: pytest.MonkeyPatch):
async def test_internal_eval_list_fixtures_requires_config(
monkeypatch: pytest.MonkeyPatch,
):
from fastapi import FastAPI
monkeypatch.setattr(
@@ -16,16 +17,20 @@ async def test_internal_eval_list_sets_requires_config(monkeypatch: pytest.Monke
"",
raising=False,
)
from app.features.evaluation.router import router
app = FastAPI()
app.include_router(router, prefix="/internal/api/evaluation")
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://t") as client:
r = await client.get("/internal/api/evaluation/regression-sets")
r = await client.get("/internal/api/evaluation/fixtures/user-exports")
assert r.status_code == 503
@pytest.mark.asyncio
async def test_internal_eval_with_override_lists_empty(monkeypatch: pytest.MonkeyPatch):
async def test_internal_eval_with_override_lists_fixtures(
monkeypatch: pytest.MonkeyPatch,
):
from fastapi import FastAPI
monkeypatch.setattr(
@@ -33,6 +38,17 @@ async def test_internal_eval_with_override_lists_empty(monkeypatch: pytest.Monke
"secret",
raising=False,
)
def _empty_fixtures() -> list[str]:
return []
monkeypatch.setattr(
"app.features.evaluation.admin_service.list_user_export_md_filenames",
_empty_fixtures,
raising=False,
)
from app.features.evaluation.router import router
app = FastAPI()
app.include_router(router, prefix="/internal/api/evaluation")
@@ -42,24 +58,12 @@ async def test_internal_eval_with_override_lists_empty(monkeypatch: pytest.Monke
return InternalEvalPrincipal()
app.dependency_overrides[get_internal_eval_principal] = _override_auth
from app.core.db import get_async_db
from unittest.mock import AsyncMock, MagicMock
mock_session = AsyncMock()
mock_result = MagicMock()
mock_result.scalars.return_value.unique.return_value.all.return_value = []
mock_session.execute = AsyncMock(return_value=mock_result)
async def _db():
yield mock_session
app.dependency_overrides[get_async_db] = _db
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://t") as client:
r = await client.get(
"/internal/api/evaluation/regression-sets",
"/internal/api/evaluation/fixtures/user-exports",
headers={"X-Internal-Eval-Key": "secret"},
)
assert r.status_code == 200
assert r.json() == []
assert r.json() == {"items": []}