fix: add transcription provider fallback
This commit is contained in:
@@ -33,6 +33,23 @@ def test_summarize_error_falls_back_to_string():
|
||||
assert summarize_error({"unexpected": True}, fallback="fallback") == "fallback"
|
||||
|
||||
|
||||
def test_summarize_error_compacts_cloudflare_html():
|
||||
html = """
|
||||
<!DOCTYPE html>
|
||||
<html><head><title>openrouter.ai | 502: Bad gateway</title></head>
|
||||
<body><h1>Bad gateway</h1><span class="code-label">Error code 502</span></body></html>
|
||||
"""
|
||||
|
||||
assert summarize_error(None, fallback=html) == "Cloudflare/OpenRouter returned HTTP 502 Bad gateway"
|
||||
|
||||
|
||||
def test_summarize_error_truncates_long_plain_text():
|
||||
message = summarize_error(None, fallback="x" * 600)
|
||||
|
||||
assert len(message) < 260
|
||||
assert message.endswith("…")
|
||||
|
||||
|
||||
def test_build_transcript_block_labels_transcript():
|
||||
block = build_transcript_block("Chris", "Discussed deadlines")
|
||||
assert block == "[Chris]\nDiscussed deadlines"
|
||||
|
||||
Reference in New Issue
Block a user