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
87a45ca3
Commit
87a45ca3
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add whisper-server builder defaults
parent
6b937272
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
7 deletions
+54
-7
routes.py
codai/admin/routes.py
+1
-1
models.html
codai/admin/templates/models.html
+11
-3
test_whisper_server_local_models.py
tests/test_whisper_server_local_models.py
+42
-3
No files found.
codai/admin/routes.py
View file @
87a45ca3
...
@@ -1312,7 +1312,7 @@ async def api_model_configure(request: Request, username: str = Depends(require_
...
@@ -1312,7 +1312,7 @@ async def api_model_configure(request: Request, username: str = Depends(require_
entry
[
"used_vram_gb"
]
=
data
[
"used_vram_gb"
]
entry
[
"used_vram_gb"
]
=
data
[
"used_vram_gb"
]
config_manager
.
models_data
.
setdefault
(
"audio_models"
,
[])
.
append
(
entry
)
config_manager
.
models_data
.
setdefault
(
"audio_models"
,
[])
.
append
(
entry
)
config_manager
.
save_models
()
config_manager
.
save_models
()
return
{
"success"
:
True
}
return
{
"success"
:
True
,
"model_id"
:
model_id
,
"model_path"
:
model_path
,
"server_path"
:
server_path
}
path
=
data
.
get
(
"path"
)
or
data
.
get
(
"model_id"
,
""
)
path
=
data
.
get
(
"path"
)
or
data
.
get
(
"model_id"
,
""
)
valid
=
{
"text_models"
,
"image_models"
,
"audio_models"
,
"tts_models"
,
"vision_models"
,
"video_models"
,
valid
=
{
"text_models"
,
"image_models"
,
"audio_models"
,
"tts_models"
,
"vision_models"
,
"video_models"
,
"audio_gen_models"
,
"embedding_models"
}
"audio_gen_models"
,
"embedding_models"
}
...
...
codai/admin/templates/models.html
View file @
87a45ca3
...
@@ -1038,6 +1038,7 @@ function prefillWhisperServerFromGguf(path){
...
@@ -1038,6 +1038,7 @@ function prefillWhisperServerFromGguf(path){
const
sourceSelect
=
document
.
getElementById
(
'ws-model-source'
);
const
sourceSelect
=
document
.
getElementById
(
'ws-model-source'
);
const
ggufSelect
=
document
.
getElementById
(
'ws-gguf-select'
);
const
ggufSelect
=
document
.
getElementById
(
'ws-gguf-select'
);
const
builder
=
document
.
getElementById
(
'ws-model-builder'
);
const
builder
=
document
.
getElementById
(
'ws-model-builder'
);
resetWhisperServerBuilderDefaults
();
if
(
sourceSelect
){
if
(
sourceSelect
){
sourceSelect
.
value
=
'cached-gguf'
;
sourceSelect
.
value
=
'cached-gguf'
;
}
}
...
@@ -1419,9 +1420,16 @@ async function addWhisperServerModel(){
...
@@ -1419,9 +1420,16 @@ async function addWhisperServerModel(){
});
});
const
d
=
await
r
.
json
();
const
d
=
await
r
.
json
();
if
(
!
r
.
ok
)
throw
new
Error
(
d
.
detail
||
'Failed to add whisper-server model'
);
if
(
!
r
.
ok
)
throw
new
Error
(
d
.
detail
||
'Failed to add whisper-server model'
);
document
.
getElementById
(
'ws-model-id'
).
value
=
''
;
document
.
getElementById
(
'ws-model-id'
).
value
=
nextWhisperServerModelId
();
document
.
getElementById
(
'ws-server-path'
).
value
=
''
;
document
.
getElementById
(
'ws-server-path'
).
value
=
defaultWhisperServerPath
();
resetWhisperServerBuilderDefaults
();
document
.
getElementById
(
'ws-model-source'
).
value
=
'cached-gguf'
;
document
.
getElementById
(
'ws-gguf-select'
).
value
=
d
.
model_path
||
''
;
document
.
getElementById
(
'ws-model-path'
).
value
=
''
;
document
.
getElementById
(
'ws-port'
).
value
=
'8744'
;
document
.
getElementById
(
'ws-gpu-device'
).
value
=
'0'
;
document
.
getElementById
(
'ws-load-mode'
).
value
=
'on-request'
;
document
.
getElementById
(
'ws-used-vram'
).
value
=
''
;
toggleWhisperModelSource
();
refreshLocal
();
refreshLocal
();
}
catch
(
e
){
alert
(
'Error: '
+
e
.
message
);
}
}
catch
(
e
){
alert
(
'Error: '
+
e
.
message
);
}
}
}
...
...
tests/test_whisper_server_local_models.py
View file @
87a45ca3
...
@@ -270,6 +270,34 @@ def test_model_configure_defaults_missing_whisper_server_path_uses_shutil_which_
...
@@ -270,6 +270,34 @@ def test_model_configure_defaults_missing_whisper_server_path_uses_shutil_which_
app
.
dependency_overrides
.
clear
()
app
.
dependency_overrides
.
clear
()
def
test_model_configure_preserves_explicit_whisper_server_model_id_and_server_path_overrides
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
cfg
=
_build_config
(
tmp_path
)
monkeypatch
.
setattr
(
routes
,
"config_manager"
,
cfg
,
raising
=
False
)
monkeypatch
.
setattr
(
routes
.
shutil
,
"which"
,
lambda
_
:
"/opt/bin/whisper-server"
)
app
,
client
=
_build_admin_test_client
(
routes
)
response
=
client
.
post
(
"/admin/api/model-configure"
,
json
=
{
"model_id"
:
"custom-whisper-id"
,
"model_type"
:
"audio_models"
,
"backend"
:
"whisper-server"
,
"server_path"
:
"/custom/bin/whisper-server"
,
"model_path"
:
"/models/custom.gguf"
,
"port"
:
9123
,
"gpu_device"
:
2
,
"load_mode"
:
"load"
,
},
)
assert
response
.
status_code
==
200
assert
cfg
.
models_data
[
"audio_models"
][
0
][
"id"
]
==
"custom-whisper-id"
assert
cfg
.
models_data
[
"audio_models"
][
0
][
"server_path"
]
==
"/custom/bin/whisper-server"
app
.
dependency_overrides
.
clear
()
def
test_model_configure_accepts_cached_gguf_whisper_server_model
(
monkeypatch
,
tmp_path
):
def
test_model_configure_accepts_cached_gguf_whisper_server_model
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
from
codai.admin
import
routes
...
@@ -630,12 +658,23 @@ def test_models_template_resets_whisper_server_builder_defaults_after_refresh_an
...
@@ -630,12 +658,23 @@ def test_models_template_resets_whisper_server_builder_defaults_after_refresh_an
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
assert
"resetWhisperServerBuilderDefaults();"
in
template
assert
"resetWhisperServerBuilderDefaults();"
in
template
assert
"document.getElementById('ws-model-id').value = '';"
in
template
assert
"document.getElementById('ws-model-id').value = nextWhisperServerModelId();"
in
template
assert
"document.getElementById('ws-server-path').value = '';"
in
template
assert
"document.getElementById('ws-server-path').value = defaultWhisperServerPath();"
in
template
assert
"resetWhisperServerBuilderDefaults();
\n
refreshLocal();"
in
template
assert
"document.getElementById('ws-model-path').value = '';"
in
template
assert
"document.getElementById('ws-model-source').value = 'cached-gguf';"
in
template
assert
"document.getElementById('ws-gguf-select').value = d.model_path || '';"
in
template
assert
"toggleWhisperModelSource();
\n
refreshLocal();"
in
template
assert
"refreshLocal();"
in
template
assert
"refreshLocal();"
in
template
def
test_models_template_prefill_uses_reset_defaults_before_selecting_gguf
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
assert
"resetWhisperServerBuilderDefaults();"
in
template
assert
"sourceSelect.value = 'cached-gguf';"
in
template
assert
"ggufSelect.value = path;"
in
template
def
test_models_template_submits_whisper_server_source_and_resolved_gguf_path
():
def
test_models_template_submits_whisper_server_source_and_resolved_gguf_path
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
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