Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
a43e558
1
Parent(s): fcf0961
fix: Simplify template processing to handle Jinja2 compilation
Browse files
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 |
-
#
|
| 82 |
-
|
| 83 |
-
if isinstance(value,
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 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,
|