fix: degrade distractor pool gracefully on malformed VLM response
This commit is contained in:
@@ -55,6 +55,14 @@ class _Material:
|
||||
source_nodes = ("n1",)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generate_pool_degrades_on_malformed_response():
|
||||
from app.question_gen.distractor_selector import _generate_pool
|
||||
vlm = _FakeVLM(['["not", "a", "dict"]']) # 顶层是 list 不是 dict
|
||||
out = await _generate_pool(vlm, "?", "蒸", _Material(), 4, session_id="s")
|
||||
assert out == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_grounded_options_happy_path():
|
||||
pool = '{"distractors": ["炒", "煮", "炸", "烤"]}'
|
||||
|
||||
Reference in New Issue
Block a user