설정 화면(음성 탭): 옛 Whisper.cpp/Piper/Edge/OpenAI 선택 카드 제거(저장하면 provider가 잘못 덮어써짐), 현재 사용 중인 엔진 정보 표시
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4761fe8ffe
commit
9f61933c45
3 files changed
+33
-59
No files matched your search
@@ -4,6 +4,8 @@ import path from 'path';
|
||||
import { getConfig, ConfigManager } from '../../config/config.js';
|
||||
import { resetProvider } from '../../providers/factory.js';
|
||||
import { readUsageRows, summarize } from '../../providers/cost-estimate.js';
|
||||
import { isEngineReady } from '../../tools/voice-engine-client.js';
|
||||
import { buildSttHotwords } from '../../tools/stt-correct.js';
|
||||
import { getClaudeSearchConfig, getClaudeSearchUsage } from '../../tools/claude-search.js';
|
||||
|
||||
// ── Helpers ──────────────────────────────────────────────────────────────────
|
||||
@@ -484,6 +486,15 @@ export function registerSettingsRoutes(app: Express): void {
|
||||
ttsSpeed: Math.min(1.4, Math.max(0.8, Number(e.ttsSpeed) || 1.15)),
|
||||
ttsVoice: voice,
|
||||
designedRefExists: voice !== 'clone' && fs.existsSync(designedRefPath(voice)),
|
||||
info: {
|
||||
online: (() => { try { return isEngineReady(); } catch { return false; } })(),
|
||||
port: e.port || 8765,
|
||||
sttModel: e.sttModel || 'medium',
|
||||
device: e.device || 'cuda',
|
||||
language: (cm.getConfig() as any).voice?.stt?.language || 'ko',
|
||||
ttsModel: 'OmniVoice (k2-fsa/OmniVoice)',
|
||||
hotwordCount: buildSttHotwords().split(/\s+/).filter(Boolean).length,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+5
-29
@@ -1892,35 +1892,11 @@
|
||||
</div>
|
||||
<div style="font-size:11px;color:var(--muted);margin-top:8px;line-height:1.6">저장한 뒤 <b>서버를 재시작</b>하면 적용됩니다. 속도는 0.8~1.4배(1.5배 이상은 숫자·단위가 빠지는 것을 확인했습니다). 기본 외의 목소리는 처음 한 번 만든 기준 음성을 저장해 계속 같은 음색으로 읽습니다. 마음에 안 들면 "목소리 다시 뽑기" 후 재시작하세요.</div>
|
||||
</div>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:14px">
|
||||
<!-- STT -->
|
||||
<div style="border:1px solid var(--line);border-radius:12px;padding:14px">
|
||||
<div class="right-section-title" style="margin-bottom:10px">음성 인식 (STT)</div>
|
||||
<label style="display:block;font-size:12px;color:var(--muted);margin-bottom:4px">제공자</label>
|
||||
<select id="voice-stt-provider" class="settings-input" style="margin-bottom:10px;font-size:13px">
|
||||
<option value="whisper_cpp">Whisper.cpp (로컬)</option>
|
||||
<option value="openai">OpenAI Whisper (API)</option>
|
||||
</select>
|
||||
<label style="display:block;font-size:12px;color:var(--muted);margin-bottom:4px">모델 파일</label>
|
||||
<input id="voice-stt-model" type="text" class="settings-input" placeholder="ggml-base.bin" style="margin-bottom:10px;font-size:12px" />
|
||||
<label style="display:block;font-size:12px;color:var(--muted);margin-bottom:4px">언어</label>
|
||||
<input id="voice-stt-language" type="text" class="settings-input" placeholder="ko" style="font-size:12px" />
|
||||
</div>
|
||||
<!-- TTS -->
|
||||
<div style="border:1px solid var(--line);border-radius:12px;padding:14px">
|
||||
<div class="right-section-title" style="margin-bottom:10px">음성 합성 (TTS)</div>
|
||||
<label style="display:block;font-size:12px;color:var(--muted);margin-bottom:4px">제공자</label>
|
||||
<select id="voice-tts-provider" class="settings-input" style="margin-bottom:10px;font-size:13px">
|
||||
<option value="piper">Piper (로컬)</option>
|
||||
<option value="edge_tts">Edge TTS (Microsoft)</option>
|
||||
<option value="openai">OpenAI TTS (API)</option>
|
||||
</select>
|
||||
<label style="display:block;font-size:12px;color:var(--muted);margin-bottom:4px">모델 / 목소리</label>
|
||||
<input id="voice-tts-model" type="text" class="settings-input" placeholder="ko_KR-kss-medium" style="font-size:12px" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top:14px;display:flex;justify-content:flex-end">
|
||||
<button class="btn btn-sm" onclick="saveVoiceSettings()">음성 설정 저장</button>
|
||||
<!-- 현재 사용 중인 엔진(읽기 전용) -->
|
||||
<div style="border:1px solid var(--line);border-radius:12px;padding:14px">
|
||||
<div class="right-section-title" style="margin-bottom:10px">현재 사용 중 <span id="ve-online" style="font-size:11px;font-weight:400;margin-left:6px"></span></div>
|
||||
<table id="ve-info" style="font-size:13px;border-collapse:collapse;width:100%"><tr><td style="color:var(--muted)">불러오는 중…</td></tr></table>
|
||||
<div style="font-size:11px;color:var(--muted);margin-top:8px;line-height:1.6">음성 인식과 합성은 모두 클로서버 GPU에서 로컬로 돌아가며, 음성 데이터는 외부로 나가지 않습니다. 인식 모델·장치는 <code>config.json</code>의 <code>voice.engine</code>에서 바꿉니다.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1226,16 +1226,7 @@ function toggleOrchAdvanced() {
|
||||
// ── Voice Settings ───────────────────────────────────────────────────────────
|
||||
|
||||
async function loadVoiceSettings() {
|
||||
try {
|
||||
const cfg = await api('/api/settings/voice');
|
||||
const v = (id, val) => { const el = document.getElementById(id); if (el && val !== undefined) el.value = val; };
|
||||
v('voice-stt-provider', cfg.stt?.provider);
|
||||
v('voice-stt-model', cfg.stt?.model);
|
||||
v('voice-stt-language', cfg.stt?.language);
|
||||
v('voice-tts-provider', cfg.tts?.provider);
|
||||
v('voice-tts-model', cfg.tts?.model);
|
||||
} catch (e) { console.warn('loadVoiceSettings:', e); }
|
||||
try { loadVoiceEngine(); } catch {}
|
||||
try { loadVoiceEngine(); } catch (e) { console.warn('loadVoiceSettings:', e); }
|
||||
}
|
||||
|
||||
// ── 실시간 음성 엔진: 낭독 속도·음성 종류 ──────────────────────────────────────────
|
||||
@@ -1256,10 +1247,26 @@ async function loadVoiceEngine() {
|
||||
const sp = document.getElementById('ve-speed'); sp.value = r.ttsSpeed;
|
||||
document.getElementById('ve-speed-val').textContent = Number(r.ttsSpeed).toFixed(2) + '배';
|
||||
veVoiceChanged();
|
||||
renderVoiceEngineInfo(r);
|
||||
if (st) st.textContent = r.ttsVoice === 'clone' ? '' : (r.designedRefExists ? '기준 음성 저장됨' : '기준 음성은 다음 시작 때 만들어집니다');
|
||||
} catch (e) { if (st) st.textContent = '불러오기 실패: ' + e.message; }
|
||||
}
|
||||
|
||||
function renderVoiceEngineInfo(r) {
|
||||
const i = r.info || {};
|
||||
const row = (k, v) => '<tr><td style="color:var(--muted);padding:3px 14px 3px 0;white-space:nowrap">' + k + '</td><td style="padding:3px 0">' + v + '</td></tr>';
|
||||
const on = document.getElementById('ve-online');
|
||||
if (on) { on.textContent = i.online ? '● 실행 중' : '○ 꺼져 있음'; on.style.color = i.online ? 'var(--ok)' : 'var(--err)'; }
|
||||
const t = document.getElementById('ve-info');
|
||||
if (t) t.innerHTML = [
|
||||
row('음성 인식 (STT)', 'Whisper <b>' + (i.sttModel || '-') + '</b> (faster-whisper, ' + (i.device || '-') + ') · 언어 ' + (i.language || 'ko')),
|
||||
row('인식 보정', '핫워드 ' + (i.hotwordCount ?? 0) + '개 · 확신도 낮은 인식은 버림'),
|
||||
row('음성 합성 (TTS)', '<b>' + (i.ttsModel || '-') + '</b> (' + (i.device || '-') + ')'),
|
||||
row('음성 종류 / 속도', (r.ttsVoice === 'clone' ? '기본 (등록된 목소리)' : r.ttsVoice) + ' · ' + Number(r.ttsSpeed).toFixed(2) + '배' + (i.runningSpeed ? '' : '')),
|
||||
row('엔진 주소', '127.0.0.1:' + (i.port || '-')),
|
||||
].join('');
|
||||
}
|
||||
|
||||
async function saveVoiceEngine() {
|
||||
const st = document.getElementById('ve-status');
|
||||
const sel = document.getElementById('ve-voice').value;
|
||||
@@ -1283,26 +1290,6 @@ async function rerollVoiceRef() {
|
||||
} catch (e) { if (st) st.textContent = '실패: ' + e.message; }
|
||||
}
|
||||
|
||||
async function saveVoiceSettings() {
|
||||
const body = {
|
||||
stt: {
|
||||
provider: document.getElementById('voice-stt-provider')?.value,
|
||||
model: document.getElementById('voice-stt-model')?.value?.trim(),
|
||||
language: document.getElementById('voice-stt-language')?.value?.trim(),
|
||||
},
|
||||
tts: {
|
||||
provider: document.getElementById('voice-tts-provider')?.value,
|
||||
model: document.getElementById('voice-tts-model')?.value?.trim(),
|
||||
},
|
||||
};
|
||||
try {
|
||||
await api('/api/settings/voice', { method: 'POST', body: JSON.stringify(body) });
|
||||
addProcessEntry('final', '음성 설정이 저장되었습니다.');
|
||||
} catch (err) {
|
||||
addProcessEntry('error', '음성 설정 저장 실패: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Session Settings ─────────────────────────────────────────────────────────
|
||||
|
||||
async function loadSessionSettings() {
|
||||
|
||||
Reference in new issue
Block a user