Remove chimes directory fallback — YAML only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 05:26:40 +00:00
parent 0a16bd6da3
commit 4dad948b73
2 changed files with 1 additions and 7 deletions

View File

@@ -26,7 +26,6 @@ import { Chatterbox_Tts } from './lib/chatterbox-tts.mjs'
const PORT = parseInt(process.env.TTS_PORT ?? '11500')
const VOICES_FILE = path.join(import.meta.dirname, 'voices.yaml')
const CHIMES_DIR = path.join(import.meta.dirname, 'chimes')
function reload_config() {
try {
@@ -117,11 +116,8 @@ const server = http.createServer(async (req, res) => {
}
const { name } = body
if (!name) return send(res, 400, { error: 'name required' })
// YAML mapping takes priority; fall back to chimes/<name>.wav or .ogg
;({ voices, chimes } = reload_config())
const wav = path.join(CHIMES_DIR, `${name}.wav`)
const ogg = path.join(CHIMES_DIR, `${name}.ogg`)
const file = chimes[name] ?? (fs.existsSync(wav) ? wav : fs.existsSync(ogg) ? ogg : null)
const file = chimes[name] ?? null
if (!file) return send(res, 404, { error: `chime not found: ${name}` })
try {
await enqueue(() => play_file(file))