fix update
Browse files
app.py
CHANGED
@@ -25,12 +25,18 @@ def update_token_visibility(api):
|
|
25 |
|
26 |
def update_prompt_template(prompt_format):
|
27 |
"""Update the template content when a preset is selected"""
|
|
|
|
|
28 |
if prompt_format in PROMPT_TEMPLATES:
|
29 |
-
return
|
30 |
return ""
|
31 |
|
32 |
def handle_template_edit(prompt_format, new_template):
|
33 |
"""Handle when user edits the template"""
|
|
|
|
|
|
|
|
|
34 |
# If the template matches a preset exactly, keep the preset name
|
35 |
for format_name, template in PROMPT_TEMPLATES.items():
|
36 |
if template.strip() == new_template.strip():
|
|
|
25 |
|
26 |
def update_prompt_template(prompt_format):
|
27 |
"""Update the template content when a preset is selected"""
|
28 |
+
if prompt_format == "custom": # Don't update content when switching to custom
|
29 |
+
return gr.update() # Skip update
|
30 |
if prompt_format in PROMPT_TEMPLATES:
|
31 |
+
return PROMPT_TEMPLATES[prompt_format]
|
32 |
return ""
|
33 |
|
34 |
def handle_template_edit(prompt_format, new_template):
|
35 |
"""Handle when user edits the template"""
|
36 |
+
# If we're already in custom mode, don't trigger another format change
|
37 |
+
if prompt_format == "custom":
|
38 |
+
return gr.update()
|
39 |
+
|
40 |
# If the template matches a preset exactly, keep the preset name
|
41 |
for format_name, template in PROMPT_TEMPLATES.items():
|
42 |
if template.strip() == new_template.strip():
|