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
ad4b9243
Commit
ad4b9243
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: cover whisper-server gguf submit defaults
parent
e31826f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
9 deletions
+56
-9
routes.py
codai/admin/routes.py
+1
-5
models.html
codai/admin/templates/models.html
+2
-2
test_whisper_server_local_models.py
tests/test_whisper_server_local_models.py
+53
-2
No files found.
codai/admin/routes.py
View file @
ad4b9243
...
@@ -202,11 +202,7 @@ async def admin_dashboard(request: Request, username: str = Depends(require_auth
...
@@ -202,11 +202,7 @@ async def admin_dashboard(request: Request, username: str = Depends(require_auth
@
router
.
get
(
"/admin/models"
,
response_class
=
HTMLResponse
)
@
router
.
get
(
"/admin/models"
,
response_class
=
HTMLResponse
)
async
def
models_page
(
request
:
Request
,
username
:
str
=
Depends
(
require_admin
)):
async
def
models_page
(
request
:
Request
,
username
:
str
=
Depends
(
require_admin
)):
return
templates
.
TemplateResponse
(
request
,
"models.html"
,
{
return
templates
.
TemplateResponse
(
request
,
"models.html"
,
{
"username"
:
username
,
"is_admin"
:
True
})
"username"
:
username
,
"is_admin"
:
True
,
"whisper_server_default_source"
:
"cached-gguf"
,
})
@
router
.
get
(
"/admin/tokens"
,
response_class
=
HTMLResponse
)
@
router
.
get
(
"/admin/tokens"
,
response_class
=
HTMLResponse
)
...
...
codai/admin/templates/models.html
View file @
ad4b9243
...
@@ -102,8 +102,8 @@
...
@@ -102,8 +102,8 @@
<input
id=
"ws-model-id"
class=
"form-input"
placeholder=
"whisper-vulkan-base"
>
<input
id=
"ws-model-id"
class=
"form-input"
placeholder=
"whisper-vulkan-base"
>
<input
id=
"ws-server-path"
class=
"form-input"
placeholder=
"/usr/local/bin/whisper-server"
>
<input
id=
"ws-server-path"
class=
"form-input"
placeholder=
"/usr/local/bin/whisper-server"
>
<select
id=
"ws-model-source"
class=
"form-input"
onchange=
"toggleWhisperModelSource()"
>
<select
id=
"ws-model-source"
class=
"form-input"
onchange=
"toggleWhisperModelSource()"
>
<option
value=
"cached-gguf"
{%
if
whisper_server_default_source =
=
'
cached-gguf
'
%}
selected
{%
endif
%}
>
Downloaded GGUF
</option>
<option
value=
"cached-gguf"
selected
>
Downloaded GGUF
</option>
<option
value=
"manual-path"
{%
if
whisper_server_default_source =
=
'
manual-path
'
%}
selected
{%
endif
%}
>
Manual path
</option>
<option
value=
"manual-path"
>
Manual path
</option>
</select>
</select>
<select
id=
"ws-gguf-select"
class=
"form-input"
>
<select
id=
"ws-gguf-select"
class=
"form-input"
>
<option
value=
""
>
Select downloaded GGUF
</option>
<option
value=
""
>
Select downloaded GGUF
</option>
...
...
tests/test_whisper_server_local_models.py
View file @
ad4b9243
...
@@ -174,6 +174,47 @@ def test_model_configure_accepts_cached_gguf_whisper_server_model(monkeypatch, t
...
@@ -174,6 +174,47 @@ def test_model_configure_accepts_cached_gguf_whisper_server_model(monkeypatch, t
app
.
dependency_overrides
.
clear
()
app
.
dependency_overrides
.
clear
()
def
test_model_configure_defaults_missing_whisper_server_model_source_to_cached_gguf
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
from
codai.api.app
import
app
cfg
=
_build_config
(
tmp_path
)
monkeypatch
.
setattr
(
routes
,
"config_manager"
,
cfg
,
raising
=
False
)
app
.
dependency_overrides
[
routes
.
require_admin
]
=
lambda
:
"admin"
client
=
TestClient
(
app
)
response
=
client
.
post
(
"/admin/api/model-configure"
,
json
=
{
"model_id"
:
"whisper-vulkan-base"
,
"model_type"
:
"audio_models"
,
"backend"
:
"whisper-server"
,
"server_path"
:
"/usr/local/bin/whisper-server"
,
"model_path"
:
"/models/base.en.gguf"
,
"port"
:
8744
,
"gpu_device"
:
0
,
"load_mode"
:
"on-request"
,
},
)
assert
response
.
status_code
==
200
assert
cfg
.
models_data
[
"audio_models"
]
==
[
{
"id"
:
"whisper-vulkan-base"
,
"backend"
:
"whisper-server"
,
"server_path"
:
"/usr/local/bin/whisper-server"
,
"model_path"
:
"/models/base.en.gguf"
,
"port"
:
8744
,
"gpu_device"
:
0
,
"load_mode"
:
"on-request"
,
"model_type"
:
"audio_models"
,
"model_types"
:
[
"audio_models"
],
}
]
app
.
dependency_overrides
.
clear
()
def
test_model_configure_rejects_cached_gguf_whisper_server_without_model_path
(
monkeypatch
,
tmp_path
):
def
test_model_configure_rejects_cached_gguf_whisper_server_without_model_path
(
monkeypatch
,
tmp_path
):
from
codai.admin
import
routes
from
codai.admin
import
routes
from
codai.api.app
import
app
from
codai.api.app
import
app
...
@@ -440,12 +481,22 @@ def test_models_template_submits_whisper_server_source_and_resolved_gguf_path():
...
@@ -440,12 +481,22 @@ 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
()
assert
"function getWhisperServerModelPath()"
in
template
assert
"function getWhisperServerModelPath()"
in
template
assert
"const sourceSelect = document.getElementById('ws-model-source');"
in
template
assert
"const modelSource = document.getElementById('ws-model-source').value;"
in
template
assert
"const ggufSelect = document.getElementById('ws-gguf-select');"
in
template
assert
"? document.getElementById('ws-gguf-select').value"
in
template
assert
": document.getElementById('ws-model-path').value.trim()) || null;"
in
template
assert
"model_source: modelSource,"
in
template
assert
"model_source: modelSource,"
in
template
assert
"model_path: getWhisperServerModelPath(),"
in
template
assert
"model_path: getWhisperServerModelPath(),"
in
template
def
test_models_template_uses_fixed_cached_gguf_default_without_route_context
():
template
=
Path
(
"codai/admin/templates/models.html"
)
.
read_text
()
routes_content
=
Path
(
"codai/admin/routes.py"
)
.
read_text
()
assert
'<option value="cached-gguf" selected>Downloaded GGUF</option>'
in
template
assert
"whisper_server_default_source"
not
in
template
assert
"whisper_server_default_source"
not
in
routes_content
def
test_models_template_adds_use_with_whisper_server_gguf_action
():
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
()
...
...
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