apolinario commited on
Commit
feede45
·
1 Parent(s): 3e35161

Add Voice Changer / Cleaner / Sound Effects / Transcribe to history

Browse files
Files changed (1) hide show
  1. index.html +21 -4
index.html CHANGED
@@ -2220,9 +2220,11 @@ window.transcribe = async function() {
2220
  else if (data.msg === "process_completed") {
2221
  if (data.success) {
2222
  const transcript = data.output.data[0];
 
2223
  document.getElementById("transcribe-text").textContent = transcript;
2224
  result.style.display = "block";
2225
- showTranscribeStatus("success", `Transcribed in ${((Date.now() - t0) / 1000).toFixed(1)}s`);
 
2226
  } else {
2227
  showTranscribeStatusWithCTA(data.output?.error || "Transcription failed");
2228
  }
@@ -3185,6 +3187,7 @@ window.voiceChange = async function() {
3185
  setPlayerMeta("vc", `${vcSource.name} → ${vcTarget.name}`);
3186
  result.classList.add("visible");
3187
  showStatusOn("vc-status", "success", `Converted in ${wallClock.toFixed(1)}s`);
 
3188
  } catch (err) {
3189
  showStatusCtaOn("vc-status", err.message);
3190
  } finally {
@@ -3255,6 +3258,7 @@ window.voiceIsolate = async function() {
3255
  setPlayerMeta("iso", isoFile.name);
3256
  result.classList.add("visible");
3257
  showStatusOn("iso-status", "success", `Done in ${wallClock.toFixed(1)}s`);
 
3258
  } catch (err) {
3259
  showStatusCtaOn("iso-status", err.message);
3260
  } finally {
@@ -3308,6 +3312,7 @@ window.soundEffect = async function() {
3308
  setPlayerMeta("sfx", `Prompt: "${prompt.slice(0,40)}${prompt.length>40?"...":""}"`);
3309
  result.classList.add("visible");
3310
  showStatusOn("sfx-status", "success", `Generated in ${wallClock.toFixed(1)}s`);
 
3311
  } catch (err) {
3312
  showStatusCtaOn("sfx-status", err.message);
3313
  } finally {
@@ -3472,14 +3477,26 @@ function renderHistory() {
3472
  if (!history.length) { c.innerHTML = '<div class="empty-state"><div class="empty-state-icon">🕐</div><div>No generations yet</div></div>'; return; }
3473
  c.innerHTML = '<div class="history-list">' + history.map((h, i) => {
3474
  const t = new Date(h.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
 
 
 
 
 
 
 
3475
  return `<div class="history-item">
3476
- <button class="history-play" onclick="playHistory(${i})"><svg viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3"/></svg></button>
3477
- <div class="history-info"><div class="history-text">${h.text}</div><div class="history-sub">${h.voiceName} · ${h.duration?.toFixed(1)}s · ${t}</div></div>
3478
- <button class="history-download" onclick="downloadHistoryItem(${i})">Download</button>
3479
  </div>`;
3480
  }).join("") + '</div>';
3481
  }
3482
 
 
 
 
 
 
3483
  window.playHistory = function(i) { const h = history[i]; if (h.url) { audioEl.src = h.url; audioEl.play(); } };
3484
  window.downloadHistoryItem = async function(i) {
3485
  const h = history[i]; if (!h.url) return;
 
2220
  else if (data.msg === "process_completed") {
2221
  if (data.success) {
2222
  const transcript = data.output.data[0];
2223
+ const wallSec = (Date.now() - t0) / 1000;
2224
  document.getElementById("transcribe-text").textContent = transcript;
2225
  result.style.display = "block";
2226
+ showTranscribeStatus("success", `Transcribed in ${wallSec.toFixed(1)}s`);
2227
+ addToHistory(transcript.slice(0, 120) + (transcript.length > 120 ? "…" : ""), `Transcribe (${transcribeFile.name})`, wallSec, null);
2228
  } else {
2229
  showTranscribeStatusWithCTA(data.output?.error || "Transcription failed");
2230
  }
 
3187
  setPlayerMeta("vc", `${vcSource.name} → ${vcTarget.name}`);
3188
  result.classList.add("visible");
3189
  showStatusOn("vc-status", "success", `Converted in ${wallClock.toFixed(1)}s`);
3190
+ addToHistory(`${vcSource.name} → ${vcTarget.name}`, "Voice Changer", wallClock, url);
3191
  } catch (err) {
3192
  showStatusCtaOn("vc-status", err.message);
3193
  } finally {
 
3258
  setPlayerMeta("iso", isoFile.name);
3259
  result.classList.add("visible");
3260
  showStatusOn("iso-status", "success", `Done in ${wallClock.toFixed(1)}s`);
3261
+ addToHistory(isoFile.name, denoiseOnly ? "Voice Cleaner (noise)" : "Voice Cleaner (enhance)", wallClock, url);
3262
  } catch (err) {
3263
  showStatusCtaOn("iso-status", err.message);
3264
  } finally {
 
3312
  setPlayerMeta("sfx", `Prompt: "${prompt.slice(0,40)}${prompt.length>40?"...":""}"`);
3313
  result.classList.add("visible");
3314
  showStatusOn("sfx-status", "success", `Generated in ${wallClock.toFixed(1)}s`);
3315
+ addToHistory(prompt, "Sound Effects", wallClock, url);
3316
  } catch (err) {
3317
  showStatusCtaOn("sfx-status", err.message);
3318
  } finally {
 
3477
  if (!history.length) { c.innerHTML = '<div class="empty-state"><div class="empty-state-icon">🕐</div><div>No generations yet</div></div>'; return; }
3478
  c.innerHTML = '<div class="history-list">' + history.map((h, i) => {
3479
  const t = new Date(h.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
3480
+ const safeText = (h.text || "").replace(/</g, "&lt;");
3481
+ const playOrIcon = h.url
3482
+ ? `<button class="history-play" onclick="playHistory(${i})"><svg viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3"/></svg></button>`
3483
+ : `<div class="history-play" style="opacity:0.4;cursor:default"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg></div>`;
3484
+ const action = h.url
3485
+ ? `<button class="history-download" onclick="downloadHistoryItem(${i})">Download</button>`
3486
+ : `<button class="history-download" onclick="copyHistoryText(${i})">Copy</button>`;
3487
  return `<div class="history-item">
3488
+ ${playOrIcon}
3489
+ <div class="history-info"><div class="history-text">${safeText}</div><div class="history-sub">${h.voiceName} · ${h.duration?.toFixed(1)}s · ${t}</div></div>
3490
+ ${action}
3491
  </div>`;
3492
  }).join("") + '</div>';
3493
  }
3494
 
3495
+ window.copyHistoryText = function(i) {
3496
+ const h = history[i];
3497
+ if (h?.text) navigator.clipboard.writeText(h.text);
3498
+ };
3499
+
3500
  window.playHistory = function(i) { const h = history[i]; if (h.url) { audioEl.src = h.url; audioEl.play(); } };
3501
  window.downloadHistoryItem = async function(i) {
3502
  const h = history[i]; if (!h.url) return;