Spaces:
Running
Running
fix: add missing name/description fields to configuration editor
Browse files
app.py
CHANGED
|
@@ -680,14 +680,13 @@ def create_interface() -> gr.Blocks:
|
|
| 680 |
gr.Markdown("## Configuration Management")
|
| 681 |
gr.Markdown(f"β
{HF_ACCESS_MESSAGE}")
|
| 682 |
|
| 683 |
-
#
|
| 684 |
-
gr.
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
)
|
| 691 |
|
| 692 |
# Configuration editor
|
| 693 |
with gr.Group():
|
|
@@ -755,11 +754,13 @@ def create_interface() -> gr.Blocks:
|
|
| 755 |
|
| 756 |
config_status = gr.Markdown("")
|
| 757 |
|
| 758 |
-
def save_configuration(system_prompt, model, temp, tokens, examples):
|
| 759 |
"""Save updated configuration"""
|
| 760 |
try:
|
| 761 |
updated_config = config.copy()
|
| 762 |
updated_config.update({
|
|
|
|
|
|
|
| 763 |
'system_prompt': system_prompt,
|
| 764 |
'model': model,
|
| 765 |
'temperature': temp,
|
|
@@ -797,6 +798,8 @@ def create_interface() -> gr.Blocks:
|
|
| 797 |
try:
|
| 798 |
if config_manager.save(DEFAULT_CONFIG):
|
| 799 |
return (
|
|
|
|
|
|
|
| 800 |
DEFAULT_CONFIG['system_prompt'],
|
| 801 |
DEFAULT_CONFIG['model'],
|
| 802 |
DEFAULT_CONFIG['temperature'],
|
|
@@ -805,19 +808,19 @@ def create_interface() -> gr.Blocks:
|
|
| 805 |
"β
Reset to default configuration"
|
| 806 |
)
|
| 807 |
else:
|
| 808 |
-
return (*[gr.update() for _ in range(
|
| 809 |
except Exception as e:
|
| 810 |
-
return (*[gr.update() for _ in range(
|
| 811 |
|
| 812 |
save_btn.click(
|
| 813 |
save_configuration,
|
| 814 |
-
inputs=[edit_system_prompt, edit_model, edit_temperature, edit_max_tokens, edit_examples],
|
| 815 |
outputs=[config_status]
|
| 816 |
)
|
| 817 |
|
| 818 |
reset_btn.click(
|
| 819 |
reset_configuration,
|
| 820 |
-
outputs=[edit_system_prompt, edit_model, edit_temperature, edit_max_tokens, edit_examples, config_status]
|
| 821 |
)
|
| 822 |
|
| 823 |
# Show config lock status
|
|
|
|
| 680 |
gr.Markdown("## Configuration Management")
|
| 681 |
gr.Markdown(f"β
{HF_ACCESS_MESSAGE}")
|
| 682 |
|
| 683 |
+
# Current configuration display
|
| 684 |
+
with gr.Accordion("Current Configuration", open=False):
|
| 685 |
+
current_config_display = gr.JSON(
|
| 686 |
+
value=config,
|
| 687 |
+
label="Current Configuration",
|
| 688 |
+
show_label=True
|
| 689 |
+
)
|
|
|
|
| 690 |
|
| 691 |
# Configuration editor
|
| 692 |
with gr.Group():
|
|
|
|
| 754 |
|
| 755 |
config_status = gr.Markdown("")
|
| 756 |
|
| 757 |
+
def save_configuration(name, description, system_prompt, model, temp, tokens, examples):
|
| 758 |
"""Save updated configuration"""
|
| 759 |
try:
|
| 760 |
updated_config = config.copy()
|
| 761 |
updated_config.update({
|
| 762 |
+
'name': name,
|
| 763 |
+
'description': description,
|
| 764 |
'system_prompt': system_prompt,
|
| 765 |
'model': model,
|
| 766 |
'temperature': temp,
|
|
|
|
| 798 |
try:
|
| 799 |
if config_manager.save(DEFAULT_CONFIG):
|
| 800 |
return (
|
| 801 |
+
DEFAULT_CONFIG['name'],
|
| 802 |
+
DEFAULT_CONFIG['description'],
|
| 803 |
DEFAULT_CONFIG['system_prompt'],
|
| 804 |
DEFAULT_CONFIG['model'],
|
| 805 |
DEFAULT_CONFIG['temperature'],
|
|
|
|
| 808 |
"β
Reset to default configuration"
|
| 809 |
)
|
| 810 |
else:
|
| 811 |
+
return (*[gr.update() for _ in range(7)], "β Failed to reset")
|
| 812 |
except Exception as e:
|
| 813 |
+
return (*[gr.update() for _ in range(7)], f"β Error: {str(e)}")
|
| 814 |
|
| 815 |
save_btn.click(
|
| 816 |
save_configuration,
|
| 817 |
+
inputs=[edit_name, edit_description, edit_system_prompt, edit_model, edit_temperature, edit_max_tokens, edit_examples],
|
| 818 |
outputs=[config_status]
|
| 819 |
)
|
| 820 |
|
| 821 |
reset_btn.click(
|
| 822 |
reset_configuration,
|
| 823 |
+
outputs=[edit_name, edit_description, edit_system_prompt, edit_model, edit_temperature, edit_max_tokens, edit_examples, config_status]
|
| 824 |
)
|
| 825 |
|
| 826 |
# Show config lock status
|