Scott Cogan commited on
Commit
a43e558
·
1 Parent(s): fcf0961

fix: Simplify template processing to handle Jinja2 compilation

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -78,16 +78,15 @@ with open("prompts.yaml", 'r') as stream:
78
  if not isinstance(prompt_templates, dict):
79
  raise ValueError("prompt_templates must be a dictionary")
80
 
81
- # Ensure all template values are strings
82
- for key, value in prompt_templates.items():
83
- if isinstance(value, dict):
84
- for subkey, subvalue in value.items():
85
- if isinstance(subvalue, str):
86
- prompt_templates[key][subkey] = subvalue.strip()
87
- elif isinstance(subvalue, dict):
88
- for subsubkey, subsubvalue in subvalue.items():
89
- if isinstance(subsubvalue, str):
90
- prompt_templates[key][subkey][subsubkey] = subsubvalue.strip()
91
 
92
  agent = CodeAgent(
93
  model=model,
 
78
  if not isinstance(prompt_templates, dict):
79
  raise ValueError("prompt_templates must be a dictionary")
80
 
81
+ # Convert all template values to simple strings
82
+ def process_template(value):
83
+ if isinstance(value, str):
84
+ return value
85
+ elif isinstance(value, dict):
86
+ return {k: process_template(v) for k, v in value.items()}
87
+ return value
88
+
89
+ prompt_templates = process_template(prompt_templates)
 
90
 
91
  agent = CodeAgent(
92
  model=model,