Spaces:
Sleeping
Sleeping
Cyber Catalyst Team commited on
Commit ·
173859b
1
Parent(s): 5a9cfc8
fix: serialize context_rules to JSON string if parsed as dict/list to avoid 422 Unprocessable Entity
Browse files- backend.py +4 -0
backend.py
CHANGED
|
@@ -2008,6 +2008,8 @@ async def execute_build_cycle(project_name: str, goal: str):
|
|
| 2008 |
task = json.loads(raw)
|
| 2009 |
task_prompt = task.get("prompt", "")
|
| 2010 |
context_rules = task.get("context_rules", "")
|
|
|
|
|
|
|
| 2011 |
except Exception as e:
|
| 2012 |
log_activity(f"[Build Mode Error] Plan JSON parsing failed: {e} | Raw: {raw}")
|
| 2013 |
return
|
|
@@ -2144,6 +2146,8 @@ async def execute_eternity_cycle(project_name: str, goal: str):
|
|
| 2144 |
task = json.loads(raw)
|
| 2145 |
task_prompt = task.get("prompt", "")
|
| 2146 |
context_rules = task.get("context_rules", "")
|
|
|
|
|
|
|
| 2147 |
except Exception as e:
|
| 2148 |
log_activity(f"[Eternity Mode Error] Plan JSON parsing failed: {e} | Raw: {raw}")
|
| 2149 |
return
|
|
|
|
| 2008 |
task = json.loads(raw)
|
| 2009 |
task_prompt = task.get("prompt", "")
|
| 2010 |
context_rules = task.get("context_rules", "")
|
| 2011 |
+
if isinstance(context_rules, (dict, list)):
|
| 2012 |
+
context_rules = json.dumps(context_rules)
|
| 2013 |
except Exception as e:
|
| 2014 |
log_activity(f"[Build Mode Error] Plan JSON parsing failed: {e} | Raw: {raw}")
|
| 2015 |
return
|
|
|
|
| 2146 |
task = json.loads(raw)
|
| 2147 |
task_prompt = task.get("prompt", "")
|
| 2148 |
context_rules = task.get("context_rules", "")
|
| 2149 |
+
if isinstance(context_rules, (dict, list)):
|
| 2150 |
+
context_rules = json.dumps(context_rules)
|
| 2151 |
except Exception as e:
|
| 2152 |
log_activity(f"[Eternity Mode Error] Plan JSON parsing failed: {e} | Raw: {raw}")
|
| 2153 |
return
|