Skip to content

Self-hosted AI workspace.

Python

fix: bool('false') is True coerces endpoint toggles incorrectly (#2361)

Giuseppe39ad30298760
diff --git a/routes/model_routes.py b/routes/model_routes.py
index 30c656253..6220305d3 100644
--- a/routes/model_routes.py
+++ b/routes/model_routes.py
@@ -1899,9 +1899,10 @@ def setup_model_routes(model_discovery):
if body:
if "supports_tools" in body:
v = body["supports_tools"]
- ep.supports_tools = bool(v) if v in (True, False, "true", "false", 1, 0) else None
+ ep.supports_tools = {True: True, False: False, 'true': True, 'false': False, 1: True, 0: False}.get(v)
if "is_enabled" in body:
- ep.is_enabled = bool(body["is_enabled"])
+ v_ie = body['is_enabled']
+ ep.is_enabled = v_ie.lower() in ('true', '1', 'yes') if isinstance(v_ie, str) else bool(v_ie)
if "name" in body and isinstance(body["name"], str):
ep.name = body["name"].strip() or ep.name
if "model_type" in body and isinstance(body["model_type"], str):