Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(api): inject TextToSpeechVoiceQuery into agent TTS voices via the decorator (#43006)
jeongeuna154a4d67401
diff --git a/api/controllers/console/app/audio.py b/api/controllers/console/app/audio.pyindex 14e9642408c..889db05569b 100644--- a/api/controllers/console/app/audio.py+++ b/api/controllers/console/app/audio.py@@ -455,14 +455,15 @@ class AgentTextToSpeechVoicesApi(Resource):@with_current_user@with_current_tenant_id@with_session(write=False)+ @model_validate(TextToSpeechVoiceQuery)def get(self,+ req_data: TextToSpeechVoiceQuery,session: Session,current_tenant_id: str,current_user: Account,agent_id: UUID,):- query = TextToSpeechVoiceQuery.model_validate(request.args.to_dict(flat=True))enforce_rbac_checks(tenant_id=current_tenant_id,account_id=current_user.id,@@ -474,4 +475,4 @@ class AgentTextToSpeechVoicesApi(Resource):tenant_id=current_tenant_id,agent_id=agent_id,)- return _get_text_to_speech_voices(tenant_id=app_model.tenant_id, language=query.language)+ return _get_text_to_speech_voices(tenant_id=app_model.tenant_id, language=req_data.language)diff --git a/api/tests/unit_tests/controllers/console/app/test_audio.py b/api/tests/unit_tests/controllers/console/app/test_audio.pyindex 8fa69b8fbcc..50aded215fa 100644--- a/api/tests/unit_tests/controllers/console/app/test_audio.py+++ b/api/tests/unit_tests/controllers/console/app/test_audio.py@@ -9,7 +9,7 @@ import pytestfrom flask import Flask, Responsefrom sqlalchemy.orm import Sessionfrom werkzeug.datastructures import FileStorage-from werkzeug.exceptions import Forbidden, InternalServerError+from werkzeug.exceptions import Forbidden, InternalServerError, UnprocessableEntityfrom controllers.console.app import audio as audio_modulefrom controllers.console.app.audio import (@@ -540,6 +540,7 @@ def test_agent_text_to_speech_voices_uses_backing_app_and_language(app: Flask, u):response = unwrap(api.get)(api,+ TextToSpeechVoiceQuery(language="en-US"),session=unbound_session,current_tenant_id="tenant-1",current_user=current_user,@@ -573,6 +574,7 @@ def test_agent_text_to_speech_voices_does_not_query_provider_without_permission():unwrap(api.get)(api,+ TextToSpeechVoiceQuery(language="en-US"),session=unbound_session,current_tenant_id="tenant-1",current_user=_account(),@@ -583,6 +585,30 @@ def test_agent_text_to_speech_voices_does_not_query_provider_without_permission(resolve_app.assert_not_called()+def test_agent_text_to_speech_voices_rejects_missing_language(app: Flask, unbound_session: Session) -> None:+ agent_id = UUID("019ef3d2-b24c-7803-b428-18b5ee8fb853")+ api = AgentTextToSpeechVoicesApi()+ view = unwrap(api.get)+ # Stop at the innermost decorator so request validation runs without the auth and session layers.+ handler = unwrap(api.get, stop=lambda f: f.__dict__.get("__wrapped__") is view)+ with (+ patch.object(audio_module, "resolve_existing_agent_runtime_app_model") as resolve_app,+ patch.object(audio_module, "enforce_rbac_checks") as check_access,+ app.test_request_context(f"/console/api/agent/{agent_id}/text-to-audio/voices", method="GET"),+ pytest.raises(UnprocessableEntity),+ ):+ handler(+ api,+ session=unbound_session,+ current_tenant_id="tenant-1",+ current_user=_account(),+ agent_id=agent_id,+ )++ check_access.assert_not_called()+ resolve_app.assert_not_called()++@pytest.mark.parametrize("message_id", [None, "019ef3d2-b24c-7803-b428-18b5ee8fb854"])def test_agent_text_to_speech_returns_audio_with_scoped_message(app: Flask, unbound_session: Session, message_id: str | None@@ -665,7 +691,9 @@ def test_agent_tts_preserves_missing_agent_error(app: Flask, unbound_session: Se"current_user": _account(),"agent_id": agent_id,}- if not voices:+ if voices:+ args["req_data"] = TextToSpeechVoiceQuery(language="en-US")+ else:args["req_data"] = TextToSpeechPayload(text="Preview")with (patch.object(audio_module, "resolve_existing_agent_runtime_app_model", side_effect=AgentNotFoundError()),