internal/server: support Open WebUI model unload - #924
Conversation
Add the llama.cpp-compatible named unload endpoint so Open WebUI can unload configured models and aliases without using the management API.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| internal/server/apigroup.go | Adds the shared unload helper and the Open WebUI JSON unload handler. |
| internal/server/server.go | Registers the new POST /models/unload endpoint on the API middleware chain. |
| internal/server/server_test.go | Extends the test router to record unload targets for assertions. |
| internal/server/unload_test.go | Adds tests for canonical unloads, alias unloads, invalid requests, and existing route behavior. |
Reviews (1): Last reviewed commit: "internal/server: support Open WebUI mode..." | Re-trigger Greptile
| requested := strings.TrimSpace(body.Model) | ||
| if requested == "" { | ||
| shared.SendResponse(w, r, http.StatusBadRequest, "model is required") | ||
| return |
There was a problem hiding this comment.
Whitespace Trims Configured Names
When a configured model or alias intentionally begins or ends with whitespace, this endpoint changes the requested name before RealModelName performs its exact lookup. That makes a valid configured model unreachable through POST /models/unload, returning model not found while the same literal name can still be represented in JSON.
Context Used: AGENTS.md (source)
There was a problem hiding this comment.
Fixed in 4d3f4ba. The handler now trims only to reject whitespace-only requests and passes the original model string to canonical lookup. Added regression coverage for an alias with surrounding whitespace. Focused tests and make test-all pass.
Keep exact configured model IDs and aliases during Open WebUI unload lookup while still rejecting whitespace-only requests.
Add the llama.cpp-compatible named unload endpoint so Open WebUI can unload configured models and aliases without using the management API.