Fix generation JSON/Lyria errors, add Winamp player, and ship Echoes of the Sahel.
Harden DeepSeek JSON parsing with retry, pre-sanitize Lyria prompts, and instrumental fallback. Add pure HTML Winamp skin at /winamp with playlist export support. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from ozan_radio.dj import parse_llm_json
|
||||
|
||||
|
||||
def test_parse_llm_json_plain():
|
||||
data = parse_llm_json('{"title": "Test", "lyria_prompt": "one line"}')
|
||||
assert data["title"] == "Test"
|
||||
|
||||
|
||||
def test_parse_llm_json_fenced():
|
||||
raw = '```json\n{"title": "Fenced"}\n```'
|
||||
assert parse_llm_json(raw)["title"] == "Fenced"
|
||||
|
||||
|
||||
def test_parse_llm_json_wrapped_text():
|
||||
raw = 'Here is the plan:\n{"title": "Wrapped", "mood": "calm"}\nThanks.'
|
||||
assert parse_llm_json(raw)["title"] == "Wrapped"
|
||||
|
||||
|
||||
def test_parse_llm_json_invalid_raises():
|
||||
with pytest.raises(json.JSONDecodeError):
|
||||
parse_llm_json("not json at all")
|
||||
Reference in New Issue
Block a user