Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
3617c7c
1
Parent(s): 2b4635e
fix: resolve template compilation error by removing unnecessary template wrapping
Browse files
app.py
CHANGED
|
@@ -99,10 +99,10 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 99 |
value = re.sub(r'{%([^{}]+)%}', lambda m: '{% ' + m.group(1).strip() + ' %}', value)
|
| 100 |
value = value.replace('\n', '\\n')
|
| 101 |
else:
|
| 102 |
-
# For other templates, wrap non-template content
|
| 103 |
if '{{' not in value and '{%' not in value:
|
| 104 |
-
|
| 105 |
-
value =
|
| 106 |
else:
|
| 107 |
# Ensure proper spacing in template expressions
|
| 108 |
value = re.sub(r'{{([^{}]+)}}', lambda m: '{{ ' + m.group(1).strip() + ' }}', value)
|
|
|
|
| 99 |
value = re.sub(r'{%([^{}]+)%}', lambda m: '{% ' + m.group(1).strip() + ' %}', value)
|
| 100 |
value = value.replace('\n', '\\n')
|
| 101 |
else:
|
| 102 |
+
# For other templates, only wrap non-template content
|
| 103 |
if '{{' not in value and '{%' not in value:
|
| 104 |
+
# Don't wrap in double curly braces, just return the string as is
|
| 105 |
+
value = value
|
| 106 |
else:
|
| 107 |
# Ensure proper spacing in template expressions
|
| 108 |
value = re.sub(r'{{([^{}]+)}}', lambda m: '{{ ' + m.group(1).strip() + ' }}', value)
|