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
d3d5896a
Commit
d3d5896a
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: align whisper-server id defaults with duplicate checks
parent
a83749bf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
routes.py
codai/admin/routes.py
+1
-1
test_whisper_server_local_models.py
tests/test_whisper_server_local_models.py
+54
-0
No files found.
codai/admin/routes.py
View file @
d3d5896a
...
...
@@ -59,7 +59,7 @@ def set_config_manager(mgr):
def
_next_whisper_server_model_id
(
audio_models
)
->
str
:
used_suffixes
=
set
()
for
model
in
audio_models
or
[]:
if
not
isinstance
(
model
,
dict
)
or
model
.
get
(
"backend"
)
!=
"whisper-server"
:
if
not
isinstance
(
model
,
dict
):
continue
match
=
re
.
fullmatch
(
r"whisper(\d+)"
,
str
(
model
.
get
(
"id"
)
or
""
)
.
strip
())
if
match
:
...
...
tests/test_whisper_server_local_models.py
View file @
d3d5896a
...
...
@@ -189,6 +189,33 @@ def test_model_configure_defaults_missing_whisper_server_model_id_to_smallest_fr
app
.
dependency_overrides
.
clear
()
def
test_model_configure_defaults_missing_whisper_server_model_id_skips_non_whisper_server_collision
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
cfg
=
_build_config
(
tmp_path
)
cfg
.
models_data
[
"audio_models"
]
=
[
{
"id"
:
"whisper0"
,
"backend"
:
"faster-whisper"
},
]
monkeypatch
.
setattr
(
routes
,
"config_manager"
,
cfg
,
raising
=
False
)
app
,
client
=
_build_admin_test_client
(
routes
)
response
=
client
.
post
(
"/admin/api/model-configure"
,
json
=
{
"backend"
:
"whisper-server"
,
"server_path"
:
"/usr/local/bin/whisper-server"
,
"model_path"
:
"/models/ggml-base.bin"
,
"port"
:
8744
,
"gpu_device"
:
0
,
"load_mode"
:
"on-request"
,
},
)
assert
response
.
status_code
==
200
assert
cfg
.
models_data
[
"audio_models"
][
-
1
][
"id"
]
==
"whisper1"
app
.
dependency_overrides
.
clear
()
def
test_model_configure_defaults_missing_whisper_server_path_to_usr_local_bin
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
...
...
@@ -216,6 +243,33 @@ def test_model_configure_defaults_missing_whisper_server_path_to_usr_local_bin(m
app
.
dependency_overrides
.
clear
()
def
test_model_configure_defaults_missing_whisper_server_path_uses_shutil_which_when_present
(
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"
:
"whisper-vulkan-base"
,
"model_type"
:
"audio_models"
,
"backend"
:
"whisper-server"
,
"server_path"
:
""
,
"model_path"
:
"/models/ggml-base.bin"
,
"port"
:
8744
,
"gpu_device"
:
0
,
"load_mode"
:
"on-request"
,
},
)
assert
response
.
status_code
==
200
assert
cfg
.
models_data
[
"audio_models"
][
0
][
"server_path"
]
==
"/opt/bin/whisper-server"
app
.
dependency_overrides
.
clear
()
def
test_model_configure_accepts_cached_gguf_whisper_server_model
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
...
...
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