feat: 字数限制2000 + MiniMax emotion参数 + 前端情绪全局选择模式

This commit is contained in:
lanhao
2026-06-30 23:47:23 +08:00
parent d6edc69c65
commit 81460f06d7
4 changed files with 57 additions and 104 deletions
+5 -3
View File
@@ -25,12 +25,13 @@ def synthesize():
pitch = data.get('pitch', 0)
volume = data.get('volume', 1.0)
instruction = data.get('instruction') # 用于CosyVoice的情绪指令
emotion = data.get('emotion', 'neutral') # 用于MiniMax的情绪参数
if not text.strip():
return jsonify({'error': '文本不能为空'}), 400
if len(text) > 500:
return jsonify({'error': '文本不能超过500字'}), 400
if len(text) > 2000:
return jsonify({'error': '文本不能超过2000字'}), 400
try:
if engine == 'cosyvoice':
@@ -46,7 +47,8 @@ def synthesize():
text=text,
speed=speed,
pitch=pitch,
volume=volume
volume=volume,
emotion=emotion
)
return jsonify({