fix: escape gguf whisper-server prefill action

parent 5284815f
...@@ -1126,7 +1126,7 @@ async function loadCachedModels(){ ...@@ -1126,7 +1126,7 @@ async function loadCachedModels(){
${f.in_config?(loaded ${f.in_config?(loaded
?`<button class="btn btn-ghost btn-sm" onclick="unloadModel(${idx})">Unload</button>` ?`<button class="btn btn-ghost btn-sm" onclick="unloadModel(${idx})">Unload</button>`
:`<button class="btn btn-primary btn-sm" onclick="loadModel(${idx})">Load now</button>`):''} :`<button class="btn btn-primary btn-sm" onclick="loadModel(${idx})">Load now</button>`):''}
<button class="btn btn-secondary btn-sm" onclick="prefillWhisperServerFromGguf('${esc(f.path)}')">Use with whisper-server</button> <button class="btn btn-secondary btn-sm" onclick='prefillWhisperServerFromGguf(${JSON.stringify(f.path)})'>Use with whisper-server</button>
<button class="btn btn-secondary btn-sm" onclick="openCfgModal(${idx})">${f.in_config?'Configure':'Add to CoderAI'}</button> <button class="btn btn-secondary btn-sm" onclick="openCfgModal(${idx})">${f.in_config?'Configure':'Add to CoderAI'}</button>
${f.in_config?`<button class="btn btn-ghost btn-sm" onclick="disableModel(${idx})">Remove</button>`:''} ${f.in_config?`<button class="btn btn-ghost btn-sm" onclick="disableModel(${idx})">Remove</button>`:''}
<button class="btn btn-danger btn-sm" onclick="deleteModelConfirm(${idx})">Delete</button> <button class="btn btn-danger btn-sm" onclick="deleteModelConfirm(${idx})">Delete</button>
......
...@@ -440,7 +440,8 @@ def test_models_template_adds_use_with_whisper_server_gguf_action(): ...@@ -440,7 +440,8 @@ def test_models_template_adds_use_with_whisper_server_gguf_action():
template = Path("codai/admin/templates/models.html").read_text() template = Path("codai/admin/templates/models.html").read_text()
assert "Use with whisper-server" in template assert "Use with whisper-server" in template
assert "onclick=\"prefillWhisperServerFromGguf('${esc(f.path)}')\"" in template assert "onclick='prefillWhisperServerFromGguf(${JSON.stringify(f.path)})'" in template
assert "prefillWhisperServerFromGguf('${esc(f.path)}')" not in template
def test_settings_template_no_longer_contains_whisper_server_section(): 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