feat: generate smart filenames for TTS downloads using Hermes
- Use generateTitleForTTS to create dash-separated filenames based on textarea content - Hermes analyzes the text and generates descriptive filenames like 'hello-world-tts.mp3' - Fallback to default filename if generation fails
This commit is contained in:
parent
69fd142004
commit
76bd27bea8
1 changed files with 12 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// TTS Modal functionality
|
||||
import { initializeChunkFiveFont } from "./ui-themes.js";
|
||||
import { getUIText } from "./ui-translations.js";
|
||||
import { handleTTS, downloadAudio } from "./tts.js";
|
||||
import { handleTTS, downloadAudio, generateTitleForTTS } from "./tts.js";
|
||||
|
||||
// Get USE_CUSTOM_STYLING from window or default
|
||||
const USE_CUSTOM_STYLING = window.UNCLOSEAI_CUSTOM_STYLING !== false;
|
||||
|
|
@ -403,7 +403,17 @@ export function openTTSModal() {
|
|||
padding: 8px 16px;
|
||||
`;
|
||||
}
|
||||
downloadBtn.onclick = () => downloadAudio(result.blobUrl, "tts-audio.mp3");
|
||||
downloadBtn.onclick = async () => {
|
||||
try {
|
||||
// Generate filename based on textarea content
|
||||
const filename = await generateTitleForTTS(text);
|
||||
downloadAudio(result.blobUrl, `${filename}.mp3`);
|
||||
} catch (error) {
|
||||
console.error("Error generating filename:", error);
|
||||
// Fallback to default filename
|
||||
downloadAudio(result.blobUrl, "tts-audio.mp3");
|
||||
}
|
||||
};
|
||||
|
||||
// Assemble controls
|
||||
controlsContainer.appendChild(playPauseBtn);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue