你这api设置里面只有api站点和一个密钥,数量对不上,而且也没有具体调用模型的设置 - Follow Up Deployment
Browse files- index.html +57 -11
index.html
CHANGED
|
@@ -143,17 +143,54 @@
|
|
| 143 |
</button>
|
| 144 |
</div>
|
| 145 |
<div id="api-settings" class="p-4 hidden space-y-4">
|
| 146 |
-
<div>
|
| 147 |
-
<
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
</div>
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
</div>
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
</div>
|
| 158 |
<div class="flex justify-end">
|
| 159 |
<button id="save-api" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">
|
|
@@ -296,8 +333,11 @@
|
|
| 296 |
history: JSON.parse(localStorage.getItem('ttsHistory')) || [],
|
| 297 |
apiSettings: JSON.parse(localStorage.getItem('apiSettings')) || {
|
| 298 |
ttsApi: '',
|
|
|
|
| 299 |
nlpApi: '',
|
| 300 |
-
|
|
|
|
|
|
|
| 301 |
},
|
| 302 |
isPlaying: false,
|
| 303 |
audioDuration: 0,
|
|
@@ -919,8 +959,11 @@
|
|
| 919 |
// 加载API设置
|
| 920 |
const loadApiSettings = () => {
|
| 921 |
elements.ttsApi.value = state.apiSettings.ttsApi || '';
|
|
|
|
| 922 |
elements.nlpApi.value = state.apiSettings.nlpApi || '';
|
|
|
|
| 923 |
elements.apiKey.value = state.apiSettings.apiKey || '';
|
|
|
|
| 924 |
};
|
| 925 |
|
| 926 |
// 切换API设置显示
|
|
@@ -936,8 +979,11 @@
|
|
| 936 |
const saveApiSettings = () => {
|
| 937 |
state.apiSettings = {
|
| 938 |
ttsApi: elements.ttsApi.value.trim(),
|
|
|
|
| 939 |
nlpApi: elements.nlpApi.value.trim(),
|
| 940 |
-
|
|
|
|
|
|
|
| 941 |
};
|
| 942 |
|
| 943 |
localStorage.setItem('apiSettings', JSON.stringify(state.apiSettings));
|
|
|
|
| 143 |
</button>
|
| 144 |
</div>
|
| 145 |
<div id="api-settings" class="p-4 hidden space-y-4">
|
| 146 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 147 |
+
<div>
|
| 148 |
+
<label for="tts-api" class="block text-sm font-medium text-gray-700 mb-1">TTS API端点</label>
|
| 149 |
+
<input type="text" id="tts-api" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="https://api.example.com/tts">
|
| 150 |
+
</div>
|
| 151 |
+
<div>
|
| 152 |
+
<label for="tts-model" class="block text-sm font-medium text-gray-700 mb-1">TTS模型</label>
|
| 153 |
+
<select id="tts-model" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
|
| 154 |
+
<option value="vits">VITS (默认)</option>
|
| 155 |
+
<option value="fastspeech2">FastSpeech2</option>
|
| 156 |
+
<option value="tacotron2">Tacotron2</option>
|
| 157 |
+
<option value="glowtts">Glow-TTS</option>
|
| 158 |
+
</select>
|
| 159 |
+
</div>
|
| 160 |
</div>
|
| 161 |
+
|
| 162 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 163 |
+
<div>
|
| 164 |
+
<label for="nlp-api" class="block text-sm font-medium text-gray-700 mb-1">NLP API端点</label>
|
| 165 |
+
<input type="text" id="nlp-api" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="https://api.example.com/nlp">
|
| 166 |
+
</div>
|
| 167 |
+
<div>
|
| 168 |
+
<label for="nlp-model" class="block text-sm font-medium text-gray-700 mb-1">NLP模型</label>
|
| 169 |
+
<select id="nlp-model" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
|
| 170 |
+
<option value="bert">BERT (默认)</option>
|
| 171 |
+
<option value="gpt">GPT</option>
|
| 172 |
+
<option value="roberta">RoBERTa</option>
|
| 173 |
+
<option value="t5">T5</option>
|
| 174 |
+
</select>
|
| 175 |
+
</div>
|
| 176 |
</div>
|
| 177 |
+
|
| 178 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 179 |
+
<div>
|
| 180 |
+
<label for="api-key" class="block text-sm font-medium text-gray-700 mb-1">API密钥</label>
|
| 181 |
+
<input type="password" id="api-key" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="输入您的API密钥">
|
| 182 |
+
</div>
|
| 183 |
+
<div>
|
| 184 |
+
<label for="api-region" class="block text-sm font-medium text-gray-700 mb-1">服务区域</label>
|
| 185 |
+
<select id="api-region" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
|
| 186 |
+
<option value="global">全球 (默认)</option>
|
| 187 |
+
<option value="cn-east-1">华东1</option>
|
| 188 |
+
<option value="cn-north-1">华北1</option>
|
| 189 |
+
<option value="cn-south-1">华南1</option>
|
| 190 |
+
<option value="us-east-1">美东1</option>
|
| 191 |
+
<option value="eu-west-1">欧洲西部1</option>
|
| 192 |
+
</select>
|
| 193 |
+
</div>
|
| 194 |
</div>
|
| 195 |
<div class="flex justify-end">
|
| 196 |
<button id="save-api" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">
|
|
|
|
| 333 |
history: JSON.parse(localStorage.getItem('ttsHistory')) || [],
|
| 334 |
apiSettings: JSON.parse(localStorage.getItem('apiSettings')) || {
|
| 335 |
ttsApi: '',
|
| 336 |
+
ttsModel: 'vits',
|
| 337 |
nlpApi: '',
|
| 338 |
+
nlpModel: 'bert',
|
| 339 |
+
apiKey: '',
|
| 340 |
+
apiRegion: 'global'
|
| 341 |
},
|
| 342 |
isPlaying: false,
|
| 343 |
audioDuration: 0,
|
|
|
|
| 959 |
// 加载API设置
|
| 960 |
const loadApiSettings = () => {
|
| 961 |
elements.ttsApi.value = state.apiSettings.ttsApi || '';
|
| 962 |
+
elements.ttsModel.value = state.apiSettings.ttsModel || 'vits';
|
| 963 |
elements.nlpApi.value = state.apiSettings.nlpApi || '';
|
| 964 |
+
elements.nlpModel.value = state.apiSettings.nlpModel || 'bert';
|
| 965 |
elements.apiKey.value = state.apiSettings.apiKey || '';
|
| 966 |
+
elements.apiRegion.value = state.apiSettings.apiRegion || 'global';
|
| 967 |
};
|
| 968 |
|
| 969 |
// 切换API设置显示
|
|
|
|
| 979 |
const saveApiSettings = () => {
|
| 980 |
state.apiSettings = {
|
| 981 |
ttsApi: elements.ttsApi.value.trim(),
|
| 982 |
+
ttsModel: elements.ttsModel.value,
|
| 983 |
nlpApi: elements.nlpApi.value.trim(),
|
| 984 |
+
nlpModel: elements.nlpModel.value,
|
| 985 |
+
apiKey: elements.apiKey.value.trim(),
|
| 986 |
+
apiRegion: elements.apiRegion.value
|
| 987 |
};
|
| 988 |
|
| 989 |
localStorage.setItem('apiSettings', JSON.stringify(state.apiSettings));
|