Port the original #27 detected-language pipeline onto the verified PR #39 prerequisite while preserving the current-main conversation instrument and host continuity changes. Keep voice selection server-side with no user selector or client voice field. Reuse 207c16ab only for its stricter exact-code trust boundary, omitting malformed or absent language so Piper defaults to Amy.
14 lines
445 B
Python
14 lines
445 B
Python
"""Pinned upstream /api/transcribe response anchor used by image-patch tests."""
|
|
|
|
|
|
def j(handler, payload, status=200):
|
|
return {"status": status, "payload": payload}
|
|
|
|
|
|
def handle_transcribe(handler, result):
|
|
try:
|
|
transcript = str(result.get('transcript') or '').strip()
|
|
return j(handler, {'ok': True, 'transcript': transcript})
|
|
except ValueError as error:
|
|
return j(handler, {'error': str(error)}, status=400)
|