Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
5da278e
1
Parent(s): 0e88ff4
fix: Correct f-string syntax in template processing
Browse files
app.py
CHANGED
|
@@ -218,7 +218,8 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 218 |
content = re.sub(r'{%([^{}]+)%}', r'{% \1 %}', content)
|
| 219 |
# Wrap non-template content in a simple template expression
|
| 220 |
if '{{' not in content and '{%' not in content:
|
| 221 |
-
|
|
|
|
| 222 |
agent_templates[key][subkey] = content
|
| 223 |
elif isinstance(value, str):
|
| 224 |
# Ensure proper spacing in template expressions
|
|
@@ -228,7 +229,8 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 228 |
content = re.sub(r'{%([^{}]+)%}', r'{% \1 %}', content)
|
| 229 |
# Wrap non-template content in a simple template expression
|
| 230 |
if '{{' not in content and '{%' not in content:
|
| 231 |
-
|
|
|
|
| 232 |
agent_templates[key] = content
|
| 233 |
else:
|
| 234 |
agent_templates[key] = value
|
|
|
|
| 218 |
content = re.sub(r'{%([^{}]+)%}', r'{% \1 %}', content)
|
| 219 |
# Wrap non-template content in a simple template expression
|
| 220 |
if '{{' not in content and '{%' not in content:
|
| 221 |
+
escaped_content = content.replace('"', '\\"')
|
| 222 |
+
content = f'{{{{ "{escaped_content}" }}}}'
|
| 223 |
agent_templates[key][subkey] = content
|
| 224 |
elif isinstance(value, str):
|
| 225 |
# Ensure proper spacing in template expressions
|
|
|
|
| 229 |
content = re.sub(r'{%([^{}]+)%}', r'{% \1 %}', content)
|
| 230 |
# Wrap non-template content in a simple template expression
|
| 231 |
if '{{' not in content and '{%' not in content:
|
| 232 |
+
escaped_content = content.replace('"', '\\"')
|
| 233 |
+
content = f'{{{{ "{escaped_content}" }}}}'
|
| 234 |
agent_templates[key] = content
|
| 235 |
else:
|
| 236 |
agent_templates[key] = value
|