mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
TTS now continues speaking the next chunk if one exists.
This commit is contained in:
@@ -3167,20 +3167,17 @@ function retry_from_here() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function speak_audio() {
|
function speak_audio(summonEvent) {
|
||||||
let chunk = null;
|
let action_id = null;
|
||||||
for (element of document.getElementsByClassName("editing")) {
|
if (summonEvent.target.parentElement.id == "story_prompt") {
|
||||||
if (element.id == 'story_prompt') {
|
action_id = -1;
|
||||||
chunk = -1
|
} else {
|
||||||
} else {
|
action_id = summonEvent.target.parentElement.id.split(" ").at(-1);
|
||||||
chunk = parseInt(element.id.split(" ").at(-1));
|
|
||||||
}
|
|
||||||
element.classList.remove("editing");
|
|
||||||
}
|
}
|
||||||
if (chunk != null) {
|
if (action_id != null) {
|
||||||
action_count = parseInt(document.getElementById("action_count").textContent);
|
|
||||||
//console.log(chunk);
|
//console.log(chunk);
|
||||||
document.getElementById("reader").src = "/audio?id="+chunk;
|
document.getElementById("reader").src = "/audio?id="+action_id;
|
||||||
|
document.getElementById("reader").setAttribute("action_id", action_id);
|
||||||
document.getElementById("reader").play();
|
document.getElementById("reader").play();
|
||||||
document.getElementById("play_tts").textContent = "pause";
|
document.getElementById("play_tts").textContent = "pause";
|
||||||
}
|
}
|
||||||
@@ -3202,6 +3199,19 @@ function stop_tts() {
|
|||||||
document.getElementById("play_tts").textContent = "play_arrow";
|
document.getElementById("play_tts").textContent = "play_arrow";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function finished_tts() {
|
||||||
|
next_action = parseInt(document.getElementById("reader").getAttribute("action_id"))+1;
|
||||||
|
action_count = parseInt(document.getElementById("action_count").textContent);
|
||||||
|
if (next_action <= action_count) {
|
||||||
|
document.getElementById("reader").src = "/audio?id="+next_action;
|
||||||
|
document.getElementById("reader").setAttribute("action_id", next_action);
|
||||||
|
document.getElementById("reader").play();
|
||||||
|
document.getElementById("play_tts").textContent = "pause";
|
||||||
|
} else {
|
||||||
|
document.getElementById("play_tts").textContent = "play_arrow";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function view_selection_probabilities() {
|
function view_selection_probabilities() {
|
||||||
// Not quite sure how this should work yet. Probabilities are obviously on
|
// Not quite sure how this should work yet. Probabilities are obviously on
|
||||||
// the token level, which we have no UI representation of. There are other
|
// the token level, which we have no UI representation of. There are other
|
||||||
|
@@ -84,7 +84,7 @@
|
|||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
<div id="tts" class="var_sync_alt_system_experimental_features">
|
<div id="tts" class="var_sync_alt_system_experimental_features">
|
||||||
<audio id="reader" preload=none src="/audio" />
|
<audio id="reader" preload=none src="/audio" onended="finished_tts()" />
|
||||||
</div>
|
</div>
|
||||||
<div class="setting_tile_area">
|
<div class="setting_tile_area">
|
||||||
{% with menu='Home' %}
|
{% with menu='Home' %}
|
||||||
|
Reference in New Issue
Block a user