Fix TTS
Rolling release / release (push) Successful in 14m2s

This commit is contained in:
2026-09-11 21:56:55 -04:00
parent 324f0d5e3a
commit e4546f8e95
11 changed files with 182 additions and 67 deletions
+13 -4
View File
@@ -2,15 +2,24 @@ import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
export function voiceSettings() {
let config = {};
try { config = JSON.parse(fs.readFileSync(path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'jarvis/config.json'), 'utf8')); } catch {}
function flag(value, fallback = true) {
if (value === undefined || value === null) return fallback;
if (typeof value === 'string') return !['false', '0', 'off', 'no'].includes(value.trim().toLowerCase());
return value !== false;
}
export function voiceSettings(source = null) {
let config = source;
if (!config) {
config = {};
try { config = JSON.parse(fs.readFileSync(path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'jarvis/config.json'), 'utf8')); } catch {}
}
const phrase = config.wakePhrase || config.wake_phrase || 'hey jarvis';
const aliases = Array.isArray(config.aliases) ? config.aliases : ['jarvis', 'okay jarvis'];
return {
command: process.env.JARVIS_WAKE_COMMAND || config.wakeCommand || config.wake_command || '',
phrases: [phrase, ...aliases].map((item) => String(item || '').trim()).filter(Boolean),
ttsEnabled: config.ttsEnabled !== false && config.tts_enabled !== false,
ttsEnabled: flag(config.ttsEnabled ?? config.tts_enabled, true),
modelProfile: config.modelProfile || config.model_profile || 'laptop-16gb',
};
}