fix(frontend): use ENGINE_CONFIG instead of hardcoded engine names
- Replace ternary engine name checks in generateAudio and downloadAudio - Use ENGINE_CONFIG[engine].name for consistent engine naming
This commit is contained in:
+2
-2
@@ -243,7 +243,7 @@ async function generateAudio() {
|
||||
</div>`;
|
||||
elements.audioControls.style.display = 'flex';
|
||||
elements.audioInfo.style.display = 'block';
|
||||
elements.infoEngine.textContent = state.currentEngine === 'minimax' ? 'MiniMax' : 'CosyVoice';
|
||||
elements.infoEngine.textContent = ENGINE_CONFIG[state.currentEngine].name;
|
||||
audioElement.src = audioUrl;
|
||||
addToHistory(text);
|
||||
showToast('音频生成成功!', 'success');
|
||||
@@ -312,7 +312,7 @@ function downloadAudio() {
|
||||
if (!state.generatedAudio) return;
|
||||
|
||||
// 文件命名规则:节目名_引擎名_日期_随机数.mp3
|
||||
const engineName = state.currentEngine === 'minimax' ? 'MiniMax' : 'CosyVoice';
|
||||
const engineName = ENGINE_CONFIG[state.currentEngine].name;
|
||||
const date = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
||||
const randomNum = Math.floor(Math.random() * 10000).toString().padStart(4, '0');
|
||||
const fileName = `军事科技_${engineName}_${date}_${randomNum}.mp3`;
|
||||
|
||||
Reference in New Issue
Block a user