feat(evaluation): session catalog, user export import, and eval web UI
- Extend evaluation API: schemas, router, repo, admin and execution services - Improve user export markdown importer; add fixtures and importer tests - Session catalog repo/service updates; internal app wiring and docs - Add internal-eval.sh helper; refresh app-eval-web (App, styles, Vite)
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
from app.features.evaluation.importers.script_json import parse_script_json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from app.features.evaluation.importers.user_export_markdown import (
|
||||
extract_dialogue_turns_from_export_md,
|
||||
extract_user_utterances_from_export_md,
|
||||
)
|
||||
|
||||
@@ -27,3 +32,43 @@ hello
|
||||
hi
|
||||
"""
|
||||
assert extract_user_utterances_from_export_md(md) == ["hello"]
|
||||
|
||||
|
||||
def test_extract_dialogue_turns_from_export_md() -> None:
|
||||
md = """
|
||||
#### 轮次 1 — x
|
||||
|
||||
**用户:**
|
||||
|
||||
u1
|
||||
|
||||
**AI:**
|
||||
|
||||
a1
|
||||
|
||||
#### 轮次 2 — y
|
||||
|
||||
**用户:**
|
||||
|
||||
u2
|
||||
|
||||
**AI:**
|
||||
|
||||
a2
|
||||
"""
|
||||
turns = extract_dialogue_turns_from_export_md(md)
|
||||
assert turns == [("u1", "a1"), ("u2", "a2")]
|
||||
|
||||
|
||||
def test_extract_dialogue_turns_from_repo_user_export() -> None:
|
||||
p = (
|
||||
Path(__file__).resolve().parents[1]
|
||||
/ "user_exports"
|
||||
/ "13701020203_e27fcd97-fefa-43b8-a7a3-3ecd49ebf5f0.md"
|
||||
)
|
||||
if not p.is_file():
|
||||
pytest.skip("user export fixture not present")
|
||||
text = p.read_text(encoding="utf-8")
|
||||
turns = extract_dialogue_turns_from_export_md(text)
|
||||
assert len(turns) >= 5
|
||||
assert "你好" in turns[0][0]
|
||||
|
||||
Reference in New Issue
Block a user