kingkont 0.7.26 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +20 -10
- package/package.json +1 -1
package/index.html
CHANGED
|
@@ -6964,11 +6964,12 @@ const ELEVENLABS_V3_VOICES = [
|
|
|
6964
6964
|
'Priyanka', 'Alexandra', 'Monika', 'Mark', 'Grimblewood',
|
|
6965
6965
|
];
|
|
6966
6966
|
|
|
6967
|
-
function populateVoicesSelect(voices) {
|
|
6967
|
+
function populateVoicesSelect(voices, useEnum) {
|
|
6968
6968
|
const select = $('genVoice');
|
|
6969
6969
|
select.innerHTML = '';
|
|
6970
|
-
//
|
|
6971
|
-
|
|
6970
|
+
// Через KingKont elevenlabs/v3 принимает только hardcoded enum 26 имён.
|
|
6971
|
+
// Через прямой ElevenLabs — полный список из его API.
|
|
6972
|
+
if (useEnum) {
|
|
6972
6973
|
for (const name of ELEVENLABS_V3_VOICES) {
|
|
6973
6974
|
const opt = document.createElement('option');
|
|
6974
6975
|
opt.value = name; // value = name (для KingKont)
|
|
@@ -6980,7 +6981,6 @@ function populateVoicesSelect(voices) {
|
|
|
6980
6981
|
if (last && ELEVENLABS_V3_VOICES.includes(last)) select.value = last;
|
|
6981
6982
|
return;
|
|
6982
6983
|
}
|
|
6983
|
-
// Иначе — список из ElevenLabs API (для прямого ElevenLabs, не KingKont).
|
|
6984
6984
|
voices.sort((a, b) => a.name.localeCompare(b.name));
|
|
6985
6985
|
for (const v of voices) {
|
|
6986
6986
|
const opt = document.createElement('option');
|
|
@@ -7004,7 +7004,7 @@ async function loadVoices() {
|
|
|
7004
7004
|
if (raw) cached = JSON.parse(raw);
|
|
7005
7005
|
} catch {}
|
|
7006
7006
|
if (cached?.voices?.length) {
|
|
7007
|
-
populateVoicesSelect(cached.voices);
|
|
7007
|
+
populateVoicesSelect(cached.voices, !!state._ttsUseEnum);
|
|
7008
7008
|
voicesLoaded = true;
|
|
7009
7009
|
}
|
|
7010
7010
|
// 2) Если кэш свежий — выходим
|
|
@@ -7016,7 +7016,7 @@ async function loadVoices() {
|
|
|
7016
7016
|
const { voices } = await r.json();
|
|
7017
7017
|
if (!voices?.length) return;
|
|
7018
7018
|
localStorage.setItem(VOICES_CACHE_KEY, JSON.stringify({ ts: Date.now(), voices }));
|
|
7019
|
-
populateVoicesSelect(voices);
|
|
7019
|
+
populateVoicesSelect(voices, !!state._ttsUseEnum);
|
|
7020
7020
|
voicesLoaded = true;
|
|
7021
7021
|
} catch (e) { console.error('voices load failed', e); }
|
|
7022
7022
|
}
|
|
@@ -7062,12 +7062,22 @@ document.querySelectorAll('#genModal [data-tts-model]').forEach(b => {
|
|
|
7062
7062
|
syncTtsVoiceList();
|
|
7063
7063
|
});
|
|
7064
7064
|
});
|
|
7065
|
-
function syncTtsVoiceList() {
|
|
7065
|
+
async function syncTtsVoiceList() {
|
|
7066
7066
|
const showVoice = state.ttsModel === 'elevenlabs/v3';
|
|
7067
7067
|
$('voiceRow').style.display = showVoice ? '' : 'none';
|
|
7068
|
-
if (showVoice)
|
|
7069
|
-
|
|
7070
|
-
|
|
7068
|
+
if (!showVoice) return;
|
|
7069
|
+
// Через KingKont — hardcoded enum (validation требует одно из 26 имён).
|
|
7070
|
+
// Через прямой ElevenLabs — полный список из ElevenLabs API.
|
|
7071
|
+
const provider = await plannedProvider('tts');
|
|
7072
|
+
const useEnum = provider === 'kingkont';
|
|
7073
|
+
state._ttsUseEnum = useEnum;
|
|
7074
|
+
if (useEnum) {
|
|
7075
|
+
populateVoicesSelect([], true);
|
|
7076
|
+
} else {
|
|
7077
|
+
// Сбрасываем кэш-флаг и подгружаем свежий список (loadVoices
|
|
7078
|
+
// переиспользует populateVoicesSelect внутри).
|
|
7079
|
+
voicesLoaded = false;
|
|
7080
|
+
await loadVoices();
|
|
7071
7081
|
}
|
|
7072
7082
|
}
|
|
7073
7083
|
function syncTtsModelActive() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kingkont",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.27",
|
|
4
4
|
"description": "KingKont \u00b7 Chatium \u2014 \u043d\u043e\u0434-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u0446\u0435\u043d \u0441 AI-\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438/\u0432\u0438\u0434\u0435\u043e/\u0433\u043e\u043b\u043e\u0441/SFX/\u043c\u0443\u0437\u044b\u043a\u0430/\u0442\u0435\u043a\u0441\u0442)",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"bin": {
|