mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 22:38:59 +08:00
Fix tts api err (#6349)
Co-authored-by: luowei <glpat-EjySCyNjWiLqAED-YmwM> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
parent
0de224b153
commit
06fcc0c650
@ -78,10 +78,12 @@ class ChatTextApi(InstalledAppResource):
|
|||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument('message_id', type=str, required=False, location='json')
|
parser.add_argument('message_id', type=str, required=False, location='json')
|
||||||
parser.add_argument('voice', type=str, location='json')
|
parser.add_argument('voice', type=str, location='json')
|
||||||
|
parser.add_argument('text', type=str, location='json')
|
||||||
parser.add_argument('streaming', type=bool, location='json')
|
parser.add_argument('streaming', type=bool, location='json')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
message_id = args.get('message_id')
|
message_id = args.get('message_id', None)
|
||||||
|
text = args.get('text', None)
|
||||||
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
||||||
and app_model.workflow
|
and app_model.workflow
|
||||||
and app_model.workflow.features_dict):
|
and app_model.workflow.features_dict):
|
||||||
@ -95,7 +97,8 @@ class ChatTextApi(InstalledAppResource):
|
|||||||
response = AudioService.transcript_tts(
|
response = AudioService.transcript_tts(
|
||||||
app_model=app_model,
|
app_model=app_model,
|
||||||
message_id=message_id,
|
message_id=message_id,
|
||||||
voice=voice
|
voice=voice,
|
||||||
|
text=text
|
||||||
)
|
)
|
||||||
return response
|
return response
|
||||||
except services.errors.app_model_config.AppModelConfigBrokenError:
|
except services.errors.app_model_config.AppModelConfigBrokenError:
|
||||||
|
@ -76,10 +76,12 @@ class TextApi(Resource):
|
|||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument('message_id', type=str, required=False, location='json')
|
parser.add_argument('message_id', type=str, required=False, location='json')
|
||||||
parser.add_argument('voice', type=str, location='json')
|
parser.add_argument('voice', type=str, location='json')
|
||||||
|
parser.add_argument('text', type=str, location='json')
|
||||||
parser.add_argument('streaming', type=bool, location='json')
|
parser.add_argument('streaming', type=bool, location='json')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
message_id = args.get('message_id')
|
message_id = args.get('message_id', None)
|
||||||
|
text = args.get('text', None)
|
||||||
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
||||||
and app_model.workflow
|
and app_model.workflow
|
||||||
and app_model.workflow.features_dict):
|
and app_model.workflow.features_dict):
|
||||||
@ -87,15 +89,15 @@ class TextApi(Resource):
|
|||||||
voice = args.get('voice') if args.get('voice') else text_to_speech.get('voice')
|
voice = args.get('voice') if args.get('voice') else text_to_speech.get('voice')
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
voice = args.get('voice') if args.get('voice') else app_model.app_model_config.text_to_speech_dict.get(
|
voice = args.get('voice') if args.get('voice') else app_model.app_model_config.text_to_speech_dict.get('voice')
|
||||||
'voice')
|
|
||||||
except Exception:
|
except Exception:
|
||||||
voice = None
|
voice = None
|
||||||
response = AudioService.transcript_tts(
|
response = AudioService.transcript_tts(
|
||||||
app_model=app_model,
|
app_model=app_model,
|
||||||
message_id=message_id,
|
message_id=message_id,
|
||||||
end_user=end_user.external_user_id,
|
end_user=end_user.external_user_id,
|
||||||
voice=voice
|
voice=voice,
|
||||||
|
text=text
|
||||||
)
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
@ -74,10 +74,12 @@ class TextApi(WebApiResource):
|
|||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument('message_id', type=str, required=False, location='json')
|
parser.add_argument('message_id', type=str, required=False, location='json')
|
||||||
parser.add_argument('voice', type=str, location='json')
|
parser.add_argument('voice', type=str, location='json')
|
||||||
|
parser.add_argument('text', type=str, location='json')
|
||||||
parser.add_argument('streaming', type=bool, location='json')
|
parser.add_argument('streaming', type=bool, location='json')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
message_id = args.get('message_id')
|
message_id = args.get('message_id', None)
|
||||||
|
text = args.get('text', None)
|
||||||
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
if (app_model.mode in [AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value]
|
||||||
and app_model.workflow
|
and app_model.workflow
|
||||||
and app_model.workflow.features_dict):
|
and app_model.workflow.features_dict):
|
||||||
@ -94,7 +96,8 @@ class TextApi(WebApiResource):
|
|||||||
app_model=app_model,
|
app_model=app_model,
|
||||||
message_id=message_id,
|
message_id=message_id,
|
||||||
end_user=end_user.external_user_id,
|
end_user=end_user.external_user_id,
|
||||||
voice=voice
|
voice=voice,
|
||||||
|
text=text
|
||||||
)
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
Loading…
x
Reference in New Issue
Block a user