mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
## Summary - centralize TokenHub chat request validation for chat and streaming calls - reject blank TokenHub model names before sending provider requests - send TokenHub model listing requests as bodyless GET requests ## What changed - Added shared TokenHub chat request validation for API key, model name, and messages. - Updated `ListModels` to call `GET /models` without a request body. - Added focused tests for blank model names and accidental GET request bodies. - Replaced an httptest handler callback `t.Fatalf` with `t.Errorf` plus an HTTP error and return. ## Why TokenHub chat requests should fail locally for invalid model names instead of sending avoidable malformed requests upstream. Model listing should also match normal GET semantics and avoid sending an empty JSON body. Closes #14736 Co-authored-by: Jin Hai <haijin.chn@gmail.com>