fix: cover whisper-server source toggle behavior

parent ac28d5c6
......@@ -1121,7 +1121,8 @@ async function loadCachedModels(){
}
function toggleWhisperModelSource(){
const source = document.getElementById('ws-model-source')?.value || 'cached-gguf';
const sourceSelect = document.getElementById('ws-model-source');
const source = sourceSelect ? sourceSelect.value : 'cached-gguf';
const ggufSelect = document.getElementById('ws-gguf-select');
const modelPath = document.getElementById('ws-model-path');
if(!ggufSelect || !modelPath) return;
......
......@@ -411,7 +411,21 @@ def test_models_template_preserves_whisper_server_manual_path_controls():
template = Path("codai/admin/templates/models.html").read_text()
assert "ws-model-path" in template
assert "Manual path" in template
assert 'placeholder="Manual path: /models/ggml-base.bin"' in template
assert "modelPath.style.display = useCached ? 'none' : '';" in template
def test_models_template_defines_whisper_server_source_toggle_behavior():
template = Path("codai/admin/templates/models.html").read_text()
assert "function toggleWhisperModelSource()" in template
assert "const sourceSelect = document.getElementById('ws-model-source');" in template
assert "const source = sourceSelect ? sourceSelect.value : 'cached-gguf';" in template
assert "const ggufSelect = document.getElementById('ws-gguf-select');" in template
assert "const modelPath = document.getElementById('ws-model-path');" in template
assert "const useCached = source === 'cached-gguf';" in template
assert "ggufSelect.style.display = useCached ? '' : 'none';" in template
assert "modelPath.style.display = useCached ? 'none' : '';" in template
def test_settings_template_no_longer_contains_whisper_server_section():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment