Spaces:
Runtime error
Runtime error
jess commited on
Commit Β·
9d13f89
1
Parent(s): 69cbcdc
chore: remove unused code
Browse files- app.py +3 -32
- config_classes.py +2 -2
app.py
CHANGED
|
@@ -320,10 +320,10 @@ def create_quotation_generator_section():
|
|
| 320 |
# Add system prompts tab
|
| 321 |
with gr.Tab(label="System Prompts"):
|
| 322 |
with gr.Row():
|
| 323 |
-
refresh_button = gr.Button("π Refresh All Prompts")
|
| 324 |
bulk_save_button = gr.Button("Save Prompts")
|
| 325 |
with gr.Row():
|
| 326 |
-
refresh_status = gr.Markdown("")
|
| 327 |
bulk_save_status = gr.Markdown("")
|
| 328 |
gr.Markdown("Edit the system prompts below to customize the generation process.")
|
| 329 |
# Function to refresh all prompts from the database
|
|
@@ -376,14 +376,6 @@ def create_quotation_generator_section():
|
|
| 376 |
if step not in prompts_by_step:
|
| 377 |
prompts_by_step[step] = []
|
| 378 |
prompts_by_step[step].append((prompt_key, prompt_config))
|
| 379 |
-
|
| 380 |
-
# prompts_by_step = {}
|
| 381 |
-
# state.quotation_project.load_config_from_db()
|
| 382 |
-
# for prompt_key, prompt_config in state.quotation_project.prompts.items():
|
| 383 |
-
# step = prompt_config.step
|
| 384 |
-
# if step not in prompts_by_step:
|
| 385 |
-
# prompts_by_step[step] = []
|
| 386 |
-
# prompts_by_step[step].append((prompt_key, prompt_config))
|
| 387 |
|
| 388 |
# Create an accordion for each step
|
| 389 |
for step, prompt_configs in prompts_by_step.items():
|
|
@@ -484,9 +476,6 @@ def create_quotation_generator_section():
|
|
| 484 |
except Exception as e:
|
| 485 |
print(f"ERROR in bulk_save_prompts: {str(e)}")
|
| 486 |
return f"β Error updating prompts: {str(e)}"
|
| 487 |
-
|
| 488 |
-
# bulk_save_button = gr.Button("Save Prompts")
|
| 489 |
-
# bulk_save_status = gr.Markdown("")
|
| 490 |
|
| 491 |
# Connect the refresh button to the refresh function
|
| 492 |
def wait_and_clear(wait_time=4):
|
|
@@ -516,10 +505,6 @@ def create_quotation_generator_section():
|
|
| 516 |
# outputs=bulk_save_status
|
| 517 |
# )
|
| 518 |
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
setup_all_handlers(
|
| 524 |
step_buttons,
|
| 525 |
all_components,
|
|
@@ -556,21 +541,7 @@ with gr.Blocks(title="Quotation Chatbot (with SOW)", css=custom_css) as demo:
|
|
| 556 |
gr.Markdown("1. **Start a New Session**: Begin answering questions for a new project at the Edit Area.")
|
| 557 |
gr.Markdown("2. **Load an Existing Project**: Navigate to the **Load Project** tab.")
|
| 558 |
gr.Markdown("**π Note**: You may edit the system prompts for the chatbot as below : ")
|
| 559 |
-
|
| 560 |
-
# with gr.Row():
|
| 561 |
-
# # Add chatbot prompt editors section using create_section_components
|
| 562 |
-
# chatbot_editors = {}
|
| 563 |
-
# with gr.Accordion("Chatbot Prompt Editors", open=False):
|
| 564 |
-
# chatbot_prompts = {
|
| 565 |
-
# key: config for key, config in PROMPTS.items()
|
| 566 |
-
# if config.step == "Chatbot Prompt Editors"
|
| 567 |
-
# }
|
| 568 |
-
|
| 569 |
-
# for prompt_key, prompt_config in chatbot_prompts.items():
|
| 570 |
-
# with gr.Accordion(prompt_config.description, open=False):
|
| 571 |
-
# components = create_prompt_editor_components(prompt_config)
|
| 572 |
-
# chatbot_editors[prompt_key] = components
|
| 573 |
-
|
| 574 |
with gr.Row():
|
| 575 |
start_btn = gr.Button("Start New Session")
|
| 576 |
|
|
|
|
| 320 |
# Add system prompts tab
|
| 321 |
with gr.Tab(label="System Prompts"):
|
| 322 |
with gr.Row():
|
| 323 |
+
refresh_button = gr.Button("π Refresh All Prompts",visible= False)
|
| 324 |
bulk_save_button = gr.Button("Save Prompts")
|
| 325 |
with gr.Row():
|
| 326 |
+
refresh_status = gr.Markdown("", visible= False)
|
| 327 |
bulk_save_status = gr.Markdown("")
|
| 328 |
gr.Markdown("Edit the system prompts below to customize the generation process.")
|
| 329 |
# Function to refresh all prompts from the database
|
|
|
|
| 376 |
if step not in prompts_by_step:
|
| 377 |
prompts_by_step[step] = []
|
| 378 |
prompts_by_step[step].append((prompt_key, prompt_config))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
# Create an accordion for each step
|
| 381 |
for step, prompt_configs in prompts_by_step.items():
|
|
|
|
| 476 |
except Exception as e:
|
| 477 |
print(f"ERROR in bulk_save_prompts: {str(e)}")
|
| 478 |
return f"β Error updating prompts: {str(e)}"
|
|
|
|
|
|
|
|
|
|
| 479 |
|
| 480 |
# Connect the refresh button to the refresh function
|
| 481 |
def wait_and_clear(wait_time=4):
|
|
|
|
| 505 |
# outputs=bulk_save_status
|
| 506 |
# )
|
| 507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
setup_all_handlers(
|
| 509 |
step_buttons,
|
| 510 |
all_components,
|
|
|
|
| 541 |
gr.Markdown("1. **Start a New Session**: Begin answering questions for a new project at the Edit Area.")
|
| 542 |
gr.Markdown("2. **Load an Existing Project**: Navigate to the **Load Project** tab.")
|
| 543 |
gr.Markdown("**π Note**: You may edit the system prompts for the chatbot as below : ")
|
| 544 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
with gr.Row():
|
| 546 |
start_btn = gr.Button("Start New Session")
|
| 547 |
|
config_classes.py
CHANGED
|
@@ -4,8 +4,8 @@ from typing import List, Dict, Any, Optional
|
|
| 4 |
import re
|
| 5 |
|
| 6 |
class ModelType(Enum):
|
| 7 |
-
|
| 8 |
-
O1_MINI = "gpt-4o-mini"
|
| 9 |
GPT_4O_MINI = "gpt-4o-mini"
|
| 10 |
|
| 11 |
class UIComponentType(Enum):
|
|
|
|
| 4 |
import re
|
| 5 |
|
| 6 |
class ModelType(Enum):
|
| 7 |
+
O1_MINI = "o1-mini"
|
| 8 |
+
# O1_MINI = "gpt-4o-mini"
|
| 9 |
GPT_4O_MINI = "gpt-4o-mini"
|
| 10 |
|
| 11 |
class UIComponentType(Enum):
|