Fix TTS model default: use tts-1-qwen instead of tts-1
The backend only has tts-1-qwen registered. Requests with model=tts-1 were failing with KeyError: 'tts-1'.
This commit is contained in:
parent
7018490249
commit
10c67ae4e2
5 changed files with 10 additions and 10 deletions
|
|
@ -14,9 +14,9 @@ export async function readPageWithHermes(button = null) {
|
|||
|
||||
const processedContent = await processContentWithHermes(content);
|
||||
|
||||
// Get voice preference from settings (format: "model:voice", e.g., "tts-1:onyx")
|
||||
// Get voice preference from settings (format: "model:voice", e.g., "tts-1-qwen:onyx")
|
||||
let voice = "alloy";
|
||||
let model = "tts-1";
|
||||
let model = "tts-1-qwen";
|
||||
try {
|
||||
const savedVoice = localStorage.getItem("uncloseai_selected_voice");
|
||||
if (savedVoice && savedVoice.includes(":")) {
|
||||
|
|
|
|||
|
|
@ -294,8 +294,8 @@ export function openTTSModal() {
|
|||
const selectedValue = document.querySelector('input[name="tts-voice"]:checked').value;
|
||||
const speed = parseFloat(speedSlider.value);
|
||||
|
||||
// Parse model:voice format (e.g., "tts-1:alloy" or legacy "alloy")
|
||||
let model = 'tts-1';
|
||||
// Parse model:voice format (e.g., "tts-1-qwen:alloy" or legacy "alloy")
|
||||
let model = 'tts-1-qwen';
|
||||
let voice = selectedValue;
|
||||
|
||||
if (selectedValue.includes(':')) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function cleanTextForTTS(text) {
|
|||
}
|
||||
|
||||
// Function to read text using TTS - for Read Page button (uses Hermes)
|
||||
export async function speakText(text, voice = "alloy", rate = 0.9, model = "tts-1") {
|
||||
export async function speakText(text, voice = "alloy", rate = 0.9, model = "tts-1-qwen") {
|
||||
try {
|
||||
// Preprocess the text using Hermes to get spoken tokens
|
||||
const spokenText = await extractSpokenTokens(text);
|
||||
|
|
@ -61,7 +61,7 @@ export async function speakText(text, voice = "alloy", rate = 0.9, model = "tts-
|
|||
}
|
||||
|
||||
// Direct TTS function for modal - no Hermes preprocessing
|
||||
export async function speakTextDirect(text, voice = "alloy", rate = 0.9, model = "tts-1") {
|
||||
export async function speakTextDirect(text, voice = "alloy", rate = 0.9, model = "tts-1-qwen") {
|
||||
try {
|
||||
// Clean text with simple JavaScript instead of Hermes
|
||||
const cleanedText = cleanTextForTTS(text);
|
||||
|
|
@ -251,7 +251,7 @@ export async function generateTitleForTTS(text) {
|
|||
}
|
||||
|
||||
// Handle TTS from element (for modal usage - uses direct TTS without Hermes)
|
||||
export async function handleTTS(text, voice = "alloy", rate = 0.9, model = "tts-1") {
|
||||
export async function handleTTS(text, voice = "alloy", rate = 0.9, model = "tts-1-qwen") {
|
||||
try {
|
||||
const result = await speakTextDirect(text, voice, rate, model);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ async function speakChatText(text, voice = "alloy", rate = 1.0) {
|
|||
Authorization: `Bearer ${API_KEY}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: "tts-1",
|
||||
model: "tts-1-qwen",
|
||||
voice: voice,
|
||||
input: text,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ function parseVoiceSelection(selectedValue) {
|
|||
const [model, voice] = selectedValue.split(":");
|
||||
return { model, voice };
|
||||
}
|
||||
// Legacy format - assume tts-1 model
|
||||
return { model: "tts-1", voice: selectedValue };
|
||||
// Legacy format - assume tts-1-qwen model
|
||||
return { model: "tts-1-qwen", voice: selectedValue };
|
||||
}
|
||||
|
||||
// Import required functions dynamically to avoid circular dependencies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue