Remove chimes directory fallback — YAML only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
# Drop .wav or .ogg chime files here. Names match POST /chime {"name": "..."}
|
||||
# Suggested: ready.wav, dispatch.wav, cancel.wav, error.wav
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user