diff --git a/llm_team_ui.py b/llm_team_ui.py index 6539262..a82f078 100644 --- a/llm_team_ui.py +++ b/llm_team_ui.py @@ -7531,7 +7531,18 @@ def _run_optimize(job_id, run_id): j_e = analysis_raw.rfind("}") + 1 if j_s >= 0 and j_e > j_s: parsed = json.loads(analysis_raw[j_s:j_e]) - strategies = parsed.get("strategies", strategies)[:5] + raw_strats = parsed.get("strategies", strategies)[:5] + # Normalize — LLM might return strings or dicts + strategies = [] + for s in raw_strats: + if isinstance(s, str): + strategies.append(s) + elif isinstance(s, dict): + strategies.append(s.get("name", s.get("strategy", str(s)))) + else: + strategies.append(str(s)) + if not strategies: + strategies = ["clarity", "depth", "specificity"] except Exception: pass