Fix: Tweaks override ENV VARIABLES (#12152)

Modified tweak behaviour to be overridable if env variable is set on the GUI.
This commit is contained in:
Debojit Kaushik
2026-03-12 17:29:48 -04:00
committed by GitHub
parent 20934c833f
commit a6ca0643ec
2 changed files with 34 additions and 0 deletions
@@ -171,9 +171,15 @@ def apply_tweaks(node: dict[str, Any], node_tweaks: dict[str, Any]) -> None:
for k, v in tweak_value.items():
k_ = "file_path" if field_type == "file" else k
template_data[tweak_name][k_] = v
# If the user didn't explicitly set load_from_db in the dict,
# we default to False for the override.
if "load_from_db" not in tweak_value and "load_from_db" in template_data[tweak_name]:
template_data[tweak_name]["load_from_db"] = False
else:
key = "file_path" if field_type == "file" else "value"
template_data[tweak_name][key] = tweak_value
if "load_from_db" in template_data[tweak_name]:
template_data[tweak_name]["load_from_db"] = False
def apply_tweaks_on_vertex(vertex: Vertex, node_tweaks: dict[str, Any]) -> None:
@@ -181,6 +187,17 @@ def apply_tweaks_on_vertex(vertex: Vertex, node_tweaks: dict[str, Any]) -> None:
if tweak_name and tweak_value and tweak_name in vertex.params:
vertex.params[tweak_name] = tweak_value
# Determine if we should load from DB
tweak_load_from_db = False
if isinstance(tweak_value, dict):
tweak_load_from_db = tweak_value.get("load_from_db", False)
if tweak_load_from_db:
if tweak_name not in vertex.load_from_db_fields:
vertex.load_from_db_fields.append(tweak_name)
elif tweak_name in vertex.load_from_db_fields:
vertex.load_from_db_fields.remove(tweak_name)
def process_tweaks(
graph_data: dict[str, Any], tweaks: Tweaks | dict[str, dict[str, Any]], *, stream: bool = False
+17
View File
@@ -196,9 +196,15 @@ def apply_tweaks(node: dict[str, Any], node_tweaks: dict[str, Any]) -> None:
for k, v in tweak_value.items():
k_ = "file_path" if field_type == "file" else k
template_data[tweak_name][k_] = v
# If the user didn't explicitly set load_from_db in the dict,
# we default to False for the override.
if "load_from_db" not in tweak_value and "load_from_db" in template_data[tweak_name]:
template_data[tweak_name]["load_from_db"] = False
else:
key = "file_path" if field_type == "file" else "value"
template_data[tweak_name][key] = tweak_value
if "load_from_db" in template_data[tweak_name]:
template_data[tweak_name]["load_from_db"] = False
def apply_tweaks_on_vertex(vertex: Vertex, node_tweaks: dict[str, Any]) -> None:
@@ -206,6 +212,17 @@ def apply_tweaks_on_vertex(vertex: Vertex, node_tweaks: dict[str, Any]) -> None:
if tweak_name and tweak_value and tweak_name in vertex.params:
vertex.params[tweak_name] = tweak_value
# Determine if we should load from DB
tweak_load_from_db = False
if isinstance(tweak_value, dict):
tweak_load_from_db = tweak_value.get("load_from_db", False)
if tweak_load_from_db:
if tweak_name not in vertex.load_from_db_fields:
vertex.load_from_db_fields.append(tweak_name)
elif tweak_name in vertex.load_from_db_fields:
vertex.load_from_db_fields.remove(tweak_name)
def process_tweaks(
graph_data: dict[str, Any], tweaks: Tweaks | dict[str, dict[str, Any]], *, stream: bool = False