Timothy Jaeryang Baek 2 months ago
parent
commit
63a5ee3adb
1 changed files with 6 additions and 6 deletions
  1. 6 6
      backend/open_webui/utils/payload.py

+ 6 - 6
backend/open_webui/utils/payload.py

@@ -14,6 +14,12 @@ def apply_model_system_prompt_to_body(
     if not system:
         return form_data
 
+    # Metadata (WebUI Usage)
+    if metadata:
+        variables = metadata.get("variables", {})
+        if variables:
+            system = prompt_variables_template(system, variables)
+
     # Legacy (API Usage)
     if user:
         template_params = {
@@ -25,12 +31,6 @@ def apply_model_system_prompt_to_body(
 
     system = prompt_template(system, **template_params)
 
-    # Metadata (WebUI Usage)
-    if metadata:
-        variables = metadata.get("variables", {})
-        if variables:
-            system = prompt_variables_template(system, variables)
-
     form_data["messages"] = add_or_update_system_message(
         system, form_data.get("messages", [])
     )