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
ed9fe9a2
Commit
ed9fe9a2
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: align whisper-server id allocation
parent
87a45ca3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
routes.py
codai/admin/routes.py
+7
-1
test_whisper_server_local_models.py
tests/test_whisper_server_local_models.py
+30
-1
No files found.
codai/admin/routes.py
View file @
ed9fe9a2
...
...
@@ -61,6 +61,8 @@ def _next_whisper_server_model_id(audio_models) -> str:
for
model
in
audio_models
or
[]:
if
not
isinstance
(
model
,
dict
):
continue
if
model
.
get
(
"backend"
)
!=
"whisper-server"
:
continue
match
=
re
.
fullmatch
(
r"whisper(\d+)"
,
str
(
model
.
get
(
"id"
)
or
""
)
.
strip
())
if
match
:
used_suffixes
.
add
(
int
(
match
.
group
(
1
)))
...
...
@@ -1295,7 +1297,11 @@ async def api_model_configure(request: Request, username: str = Depends(require_
if
gpu_device
<
0
:
raise
HTTPException
(
status_code
=
400
,
detail
=
"gpu_device must be >= 0"
)
for
existing
in
config_manager
.
models_data
.
get
(
"audio_models"
,
[]):
if
isinstance
(
existing
,
dict
)
and
existing
.
get
(
"id"
)
==
model_id
:
if
(
isinstance
(
existing
,
dict
)
and
existing
.
get
(
"backend"
)
==
"whisper-server"
and
existing
.
get
(
"id"
)
==
model_id
):
raise
HTTPException
(
status_code
=
409
,
detail
=
f
"whisper-server model '{model_id}' already exists"
)
entry
=
{
"id"
:
model_id
,
...
...
tests/test_whisper_server_local_models.py
View file @
ed9fe9a2
...
...
@@ -211,7 +211,36 @@ def test_model_configure_defaults_missing_whisper_server_model_id_skips_non_whis
)
assert
response
.
status_code
==
200
assert
cfg
.
models_data
[
"audio_models"
][
-
1
][
"id"
]
==
"whisper1"
assert
cfg
.
models_data
[
"audio_models"
][
-
1
][
"id"
]
==
"whisper0"
app
.
dependency_overrides
.
clear
()
def
test_model_configure_allows_whisper_server_id_coexistence_with_other_audio_backends
(
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
=
{
"model_id"
:
"whisper0"
,
"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
[
m
[
"backend"
]
for
m
in
cfg
.
models_data
[
"audio_models"
]]
==
[
"faster-whisper"
,
"whisper-server"
]
assert
cfg
.
models_data
[
"audio_models"
][
-
1
][
"id"
]
==
"whisper0"
app
.
dependency_overrides
.
clear
()
...
...
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