feat(ml): presentation auto-hide settings + review table (#141 step 3)
MLSettings gains presentation_auto_apply_enabled / _threshold (default 0.90) + presentation_conflict_threshold (default 0.50): banner/editor auto-hide with a FLAT threshold (decoupled from content-head graduation), plus the "also looks like content" conflict cut. New presentation_review table (image, presentation tag, conflict tag + score, created/resolved_at) records auto-hides flagged for review. Migration 0082 (columns + table), ml_admin API (editable + get_settings + _validate bounds), settings roundtrip/bounds test. The sweep that reads these knobs + the Settings UI land in step 4. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
@@ -81,6 +81,35 @@ async def test_detector_settings_defaults_patch_and_validation(client):
|
||||
"/api/ml/settings", json={"detector_max_regions": 0})).status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_presentation_settings_defaults_patch_and_validation(client):
|
||||
# #141: presentation-chrome auto-hide knobs (banner/editor auto-apply +
|
||||
# the "also looks like content" conflict threshold) are exposed + editable.
|
||||
body = await (await client.get("/api/ml/settings")).get_json()
|
||||
assert body["presentation_auto_apply_enabled"] is True
|
||||
assert body["presentation_auto_apply_threshold"] == 0.90
|
||||
assert body["presentation_conflict_threshold"] == 0.50
|
||||
|
||||
ok = await client.patch("/api/ml/settings", json={
|
||||
"presentation_auto_apply_enabled": False,
|
||||
"presentation_auto_apply_threshold": 0.95,
|
||||
"presentation_conflict_threshold": 0.4,
|
||||
})
|
||||
assert ok.status_code == 200
|
||||
out = await ok.get_json()
|
||||
assert out["presentation_auto_apply_enabled"] is False
|
||||
assert out["presentation_auto_apply_threshold"] == 0.95
|
||||
assert out["presentation_conflict_threshold"] == 0.4
|
||||
|
||||
# Auto-apply threshold below the floor + conflict cut above 1 are rejected.
|
||||
assert (await client.patch(
|
||||
"/api/ml/settings",
|
||||
json={"presentation_auto_apply_threshold": 0.4})).status_code == 400
|
||||
assert (await client.patch(
|
||||
"/api/ml/settings",
|
||||
json={"presentation_conflict_threshold": 1.5})).status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_embedder_models_list(client):
|
||||
# #1203: the dropdown reads the supported-model list from the server.
|
||||
|
||||
Reference in New Issue
Block a user