mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
fix: enforce speech/LLM isolation in providers and models
SQL queries (CountProviders, CountModels, ListModels, ListEnabledModels, ListModelsByProviderID) now exclude speech types. Added IsLLMClientType guard to prevent cross-domain queries via /models?client_type and /providers/:id/import-models. Frontend provider forms no longer offer edge-speech as a client type option. Also fixed pre-existing SA5011 staticcheck warnings in proxy_test.go and executor_test.go.
This commit is contained in:
@@ -313,6 +313,14 @@ func (h *ProvidersHandler) ImportModels(c echo.Context) error {
|
||||
ctx = oauthctx.WithUserID(ctx, userID)
|
||||
}
|
||||
|
||||
provider, err := h.service.Get(ctx, id)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("provider not found: %v", err))
|
||||
}
|
||||
if !models.IsLLMClientType(models.ClientType(provider.ClientType)) {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "import models is not supported for speech providers")
|
||||
}
|
||||
|
||||
remoteModels, err := h.service.FetchRemoteModels(ctx, id)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("fetch remote models: %v", err))
|
||||
|
||||
Reference in New Issue
Block a user