[Cleanup] Style and type annotation improvements extracted from #28688 (#29224)

This commit is contained in:
Lianmin Zheng
2026-06-25 12:51:15 -07:00
committed by GitHub
parent 3344b73c80
commit 118d6b2e5e
5 changed files with 217 additions and 247 deletions
+6 -27
View File
@@ -1416,17 +1416,8 @@ async def load_lora_adapter(
):
"""Load a new LoRA adapter without re-launching the server."""
result = await _global_state.tokenizer_manager.load_lora_adapter(obj, request)
if result.success:
return ORJSONResponse(
result,
status_code=HTTPStatus.OK,
)
else:
return ORJSONResponse(
result,
status_code=HTTPStatus.BAD_REQUEST,
)
status_code = HTTPStatus.OK if result.success else HTTPStatus.BAD_REQUEST
return ORJSONResponse(result, status_code=status_code)
@app.api_route("/load_lora_adapter_from_tensors", methods=["POST"])
@@ -1437,11 +1428,8 @@ async def load_lora_adapter_from_tensors(
result = await _global_state.tokenizer_manager.load_lora_adapter_from_tensors(
obj, request
)
if result.success:
return ORJSONResponse(result, status_code=HTTPStatus.OK)
else:
return ORJSONResponse(result, status_code=HTTPStatus.BAD_REQUEST)
status_code = HTTPStatus.OK if result.success else HTTPStatus.BAD_REQUEST
return ORJSONResponse(result, status_code=status_code)
@app.api_route("/unload_lora_adapter", methods=["POST"])
@@ -1451,17 +1439,8 @@ async def unload_lora_adapter(
):
"""Load a new LoRA adapter without re-launching the server."""
result = await _global_state.tokenizer_manager.unload_lora_adapter(obj, request)
if result.success:
return ORJSONResponse(
result,
status_code=HTTPStatus.OK,
)
else:
return ORJSONResponse(
result,
status_code=HTTPStatus.BAD_REQUEST,
)
status_code = HTTPStatus.OK if result.success else HTTPStatus.BAD_REQUEST
return ORJSONResponse(result, status_code=status_code)
@app.api_route("/open_session", methods=["GET", "POST"])