Spaces:
Running
on
Zero
Running
on
Zero
Update presets.py
Browse files- presets.py +16 -1
presets.py
CHANGED
|
@@ -92,7 +92,22 @@ def get_preset_info(preset_name):
|
|
| 92 |
dict or None: Preset configuration dictionary or None if not found
|
| 93 |
"""
|
| 94 |
return PRESETS.get(preset_name, None)
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
# To add presets at runtime:
|
| 97 |
# PRESETS["New Preset Name"] = {
|
| 98 |
# "count": 2,
|
|
|
|
| 92 |
dict or None: Preset configuration dictionary or None if not found
|
| 93 |
"""
|
| 94 |
return PRESETS.get(preset_name, None)
|
| 95 |
+
|
| 96 |
+
def update_preset_prompt(preset_name, prompt_index, new_prompt):
|
| 97 |
+
"""
|
| 98 |
+
Update a specific prompt in a preset.
|
| 99 |
+
|
| 100 |
+
Args:
|
| 101 |
+
preset_name (str): Name of the preset to update
|
| 102 |
+
prompt_index (int): Index of the prompt to update (0-3)
|
| 103 |
+
new_prompt (str): New prompt text
|
| 104 |
+
|
| 105 |
+
Returns:
|
| 106 |
+
dict: Updated PRESETS dictionary
|
| 107 |
+
"""
|
| 108 |
+
if preset_name in PRESETS and 0 <= prompt_index < len(PRESETS[preset_name]["prompts"]):
|
| 109 |
+
PRESETS[preset_name]["prompts"][prompt_index] = new_prompt
|
| 110 |
+
return PRESETS[preset_name] if preset_name in PRESETS else None
|
| 111 |
# To add presets at runtime:
|
| 112 |
# PRESETS["New Preset Name"] = {
|
| 113 |
# "count": 2,
|