Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
517a59b8
Commit
517a59b8
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: prefill whisper-server builder defaults
parent
d3d5896a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
models.html
codai/admin/templates/models.html
+22
-0
test_whisper_server_local_models.py
tests/test_whisper_server_local_models.py
+32
-0
No files found.
codai/admin/templates/models.html
View file @
517a59b8
...
...
@@ -1051,6 +1051,25 @@ function prefillWhisperServerFromGguf(path){
}
}
function
nextWhisperServerModelId
(){
const
whisperModels
=
_localModels
.
filter
(
m
=>
m
.
cacheType
===
'whisper-server'
);
const
existingIds
=
new
Set
(
whisperModels
.
map
(
m
=>
m
.
id
||
''
));
let
suffix
=
0
;
while
(
existingIds
.
has
(
`whisper
${
suffix
}
`
))
suffix
+=
1
;
return
`whisper
${
suffix
}
`
;
}
function
defaultWhisperServerPath
(){
return
'/usr/local/bin/whisper-server'
;
}
function
resetWhisperServerBuilderDefaults
(){
const
modelIdInput
=
document
.
getElementById
(
'ws-model-id'
);
const
serverPathInput
=
document
.
getElementById
(
'ws-server-path'
);
if
(
modelIdInput
&&
!
modelIdInput
.
value
.
trim
())
modelIdInput
.
value
=
nextWhisperServerModelId
();
if
(
serverPathInput
&&
!
serverPathInput
.
value
.
trim
())
serverPathInput
.
value
=
defaultWhisperServerPath
();
}
async
function
loadCachedModels
(){
_localModels
=
[];
const
hfEl
=
document
.
getElementById
(
'hf-models-list'
);
...
...
@@ -1142,6 +1161,7 @@ async function loadCachedModels(){
'<th></th></tr></thead><tbody>'
+
rows
.
join
(
''
)
+
'</tbody></table>'
;
}
ggufEl
.
insertAdjacentHTML
(
'afterend'
,
_renderWhisperServerRows
(
whisperModels
));
resetWhisperServerBuilderDefaults
();
}
catch
(
e
){
hfEl
.
innerHTML
=
ggufEl
.
innerHTML
=
`<span class="muted small">Error:
${
esc
(
e
.
message
)}
</span>`
;
}
...
...
@@ -1399,6 +1419,8 @@ async function addWhisperServerModel(){
});
const
d
=
await
r
.
json
();
if
(
!
r
.
ok
)
throw
new
Error
(
d
.
detail
||
'Failed to add whisper-server model'
);
document
.
getElementById
(
'ws-model-id'
).
value
=
''
;
document
.
getElementById
(
'ws-server-path'
).
value
=
''
;
refreshLocal
();
}
catch
(
e
){
alert
(
'Error: '
+
e
.
message
);
}
}
...
...
tests/test_whisper_server_local_models.py
View file @
517a59b8
...
...
@@ -603,6 +603,38 @@ def test_models_template_defines_whisper_server_gguf_prefill_helpers():
assert
"prefillWhisperServerFromGguf(path)"
in
template
def
test_models_template_defines_next_whisper_server_model_id_helper
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
assert
"function nextWhisperServerModelId()"
in
template
assert
"whisperModels.map(m => m.id || '')"
in
template
assert
"while(existingIds.has(`whisper${suffix}`)) suffix += 1;"
in
template
assert
"return `whisper${suffix}`;"
in
template
def
test_models_template_defines_whisper_server_builder_default_helpers
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
assert
"function defaultWhisperServerPath()"
in
template
assert
"return '/usr/local/bin/whisper-server';"
in
template
assert
"function resetWhisperServerBuilderDefaults()"
in
template
assert
"const modelIdInput = document.getElementById('ws-model-id');"
in
template
assert
"const serverPathInput = document.getElementById('ws-server-path');"
in
template
assert
"if(modelIdInput && !modelIdInput.value.trim())"
in
template
assert
"if(serverPathInput && !serverPathInput.value.trim())"
in
template
assert
"modelIdInput.value = nextWhisperServerModelId();"
in
template
assert
"serverPathInput.value = defaultWhisperServerPath();"
in
template
def
test_models_template_resets_whisper_server_builder_defaults_after_refresh_and_add
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
assert
"resetWhisperServerBuilderDefaults();"
in
template
assert
"document.getElementById('ws-model-id').value = '';"
in
template
assert
"document.getElementById('ws-server-path').value = '';"
in
template
assert
"refreshLocal();"
in
template
def
test_models_template_submits_whisper_server_source_and_resolved_gguf_path
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment