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
fix: add type hints for App model and improve error handling in audio services (#12677)
-LAN-cb3499166355
diff --git a/api/controllers/console/app/audio.py b/api/controllers/console/app/audio.pyindex 9d26af276d2..12d9157dda5 100644--- a/api/controllers/console/app/audio.py+++ b/api/controllers/console/app/audio.py@@ -22,7 +22,7 @@ from controllers.console.wraps import account_initialization_required, setup_reqfrom core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededErrorfrom core.model_runtime.errors.invoke import InvokeErrorfrom libs.login import login_required-from models.model import AppMode+from models import App, AppModefrom services.audio_service import AudioServicefrom services.errors.audio import (AudioTooLargeServiceError,@@ -79,7 +79,7 @@ class ChatMessageTextApi(Resource):@login_required@account_initialization_required@get_app_model- def post(self, app_model):+ def post(self, app_model: App):from werkzeug.exceptions import InternalServerErrortry:@@ -98,9 +98,13 @@ class ChatMessageTextApi(Resource):and app_model.workflow.features_dict):text_to_speech = app_model.workflow.features_dict.get("text_to_speech")+ if text_to_speech is None:+ raise ValueError("TTS is not enabled")voice = args.get("voice") or text_to_speech.get("voice")else:try:+ if app_model.app_model_config is None:+ raise ValueError("AppModelConfig not found")voice = args.get("voice") or app_model.app_model_config.text_to_speech_dict.get("voice")except Exception:voice = Nonediff --git a/api/services/audio_service.py b/api/services/audio_service.pyindex f4178a69a4a..294dfe4c8c3 100644--- a/api/services/audio_service.py+++ b/api/services/audio_service.py@@ -82,7 +82,7 @@ class AudioService:from app import appfrom extensions.ext_database import db- def invoke_tts(text_content: str, app_model, voice: Optional[str] = None):+ def invoke_tts(text_content: str, app_model: App, voice: Optional[str] = None):with app.app_context():if app_model.mode in {AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value}:workflow = app_model.workflow@@ -95,6 +95,8 @@ class AudioService:voice = features_dict["text_to_speech"].get("voice") if voice is None else voiceelse:+ if app_model.app_model_config is None:+ raise ValueError("AppModelConfig not found")text_to_speech_dict = app_model.app_model_config.text_to_speech_dictif not text_to_speech_dict.get("enabled"):