feat(server): add workbench API, DSH planner worker and RAG pipeline
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
|
||||
from app.rag import rerank
|
||||
|
||||
|
||||
def test_rerank_disabled_is_stable(monkeypatch):
|
||||
monkeypatch.delenv("RAG_RERANKER_MODEL", raising=False)
|
||||
rows = [{"id": "a", "text": "第一"}, {"id": "b", "text": "第二"}]
|
||||
assert rerank.rerank(rows, "问题") == rows
|
||||
metric = rerank.last_metric()
|
||||
assert metric["fallback"] is True
|
||||
assert metric["reranked_count"] == 0
|
||||
|
||||
|
||||
def test_rerank_local_model_missing_falls_back(monkeypatch, tmp_path):
|
||||
monkeypatch.setenv("RAG_RERANKER_MODEL", str(tmp_path / "missing"))
|
||||
rows = [{"id": "a", "text": "第一"}, {"id": "b", "text": "第二"}]
|
||||
assert rerank.rerank(rows, "问题") == rows
|
||||
assert rerank.last_metric()["fallback"] is True
|
||||
Reference in New Issue
Block a user