Spaces:
Running on Zero
Running on Zero
Commit ·
ce260d2
1
Parent(s): b122899
Fix quick prompt buttons: HTML-escape JSON to avoid breaking onclick attribute
Browse files
app.py
CHANGED
|
@@ -156,7 +156,7 @@ def load_example_data(idx_str):
|
|
| 156 |
def build_suggestion_chips_html():
|
| 157 |
chips = []
|
| 158 |
for s in SUGGESTIONS_CONFIG:
|
| 159 |
-
prompt_json = json.dumps(s["prompt"])
|
| 160 |
label = html_lib.escape(s["label"])
|
| 161 |
chips.append(f'<button class="suggestion-chip" onclick="window.__setPrompt({prompt_json})">{label}</button>')
|
| 162 |
return "".join(chips)
|
|
|
|
| 156 |
def build_suggestion_chips_html():
|
| 157 |
chips = []
|
| 158 |
for s in SUGGESTIONS_CONFIG:
|
| 159 |
+
prompt_json = html_lib.escape(json.dumps(s["prompt"]))
|
| 160 |
label = html_lib.escape(s["label"])
|
| 161 |
chips.append(f'<button class="suggestion-chip" onclick="window.__setPrompt({prompt_json})">{label}</button>')
|
| 162 |
return "".join(chips)
|