|
|
|
@@ -22,7 +22,7 @@ from controllers.console.wraps import account_initialization_required, setup_req |
|
|
|
from core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededError |
|
|
|
from core.model_runtime.errors.invoke import InvokeError |
|
|
|
from libs.login import login_required |
|
|
|
from models.model import AppMode |
|
|
|
from models import App, AppMode |
|
|
|
from services.audio_service import AudioService |
|
|
|
from 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 InternalServerError |
|
|
|
|
|
|
|
try: |
|
|
|
@@ -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 = None |