kemuriririn commited on
Commit
48cff39
·
1 Parent(s): f491974

update arena page

Browse files
Files changed (1) hide show
  1. templates/arena.html +7 -1
templates/arena.html CHANGED
@@ -690,7 +690,7 @@
690
  function fetchCachedSentences() {
691
  fetch('/api/tts/cached-sentences')
692
  .then(response => response.ok ? response.json() : Promise.reject('Failed to fetch cached sentences'))
693
- .then(data => {
694
  cachedSentences = data;
695
  console.log(`Fetched ${cachedSentences.length} cached sentences.`);
696
  })
@@ -1011,6 +1011,12 @@
1011
  }
1012
  textInput.value = selectedText;
1013
  textInput.focus();
 
 
 
 
 
 
1014
  }
1015
 
1016
  function handleRandomVoice() {
 
690
  function fetchCachedSentences() {
691
  fetch('/api/tts/cached-sentences')
692
  .then(response => response.ok ? response.json() : Promise.reject('Failed to fetch cached sentences'))
693
+ .then( data => {
694
  cachedSentences = data;
695
  console.log(`Fetched ${cachedSentences.length} cached sentences.`);
696
  })
 
1011
  }
1012
  textInput.value = selectedText;
1013
  textInput.focus();
1014
+
1015
+ // 如果页面上没有prompt音频文件,则载入随机的prompt音频
1016
+ const voiceFileInput = document.getElementById('voice-file');
1017
+ if (voiceFileInput && voiceFileInput.files.length === 0) {
1018
+ handleRandomVoice();
1019
+ }
1020
  }
1021
 
1022
  function handleRandomVoice() {