Update maker.py
Browse files
maker.py
CHANGED
@@ -118,12 +118,25 @@ def extract_title_prompt_example(text):
|
|
118 |
|
119 |
|
120 |
def make_open_gpt(message, history, current_title, current_system_prompt, current_example_input, system_prompt=system_prompt):
|
|
|
121 |
response = predict_beta(message, history, system_prompt)
|
122 |
-
|
123 |
-
|
124 |
print("Extracted Title:", title)
|
125 |
print("Extracted System Prompt:", system_prompt)
|
126 |
print("Extracted Example Input:", example_input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
def set_title_example(title, example):
|
129 |
return [(None, welcome_preview_message.format(title, example))], example, gr.Column(visible=True), gr.Group(visible=True)
|
|
|
118 |
|
119 |
|
120 |
def make_open_gpt(message, history, current_title, current_system_prompt, current_example_input, system_prompt=system_prompt):
|
121 |
+
print("Response before extraction:", response) # Print the response before extraction
|
122 |
response = predict_beta(message, history, system_prompt)
|
123 |
+
response, title, system_prompt, example_input = extract_title_prompt_example(response)
|
124 |
+
|
125 |
print("Extracted Title:", title)
|
126 |
print("Extracted System Prompt:", system_prompt)
|
127 |
print("Extracted Example Input:", example_input)
|
128 |
+
# Ensure all expected outputs are returned
|
129 |
+
return (
|
130 |
+
"", # Placeholder for textbox
|
131 |
+
history + [(message, response)], # Updated chatbot history
|
132 |
+
title, # Extracted or default title
|
133 |
+
system_prompt, # Extracted or default system prompt
|
134 |
+
example_input, # Extracted or default example input
|
135 |
+
[(None, welcome_preview_message.format(title, example_input))], # Updated chatbot preview
|
136 |
+
example_input, # Example input for textbox_preview
|
137 |
+
gr.Column(visible=True), # Column visibility control
|
138 |
+
gr.Group(visible=True) # Group visibility control
|
139 |
+
)
|
140 |
|
141 |
def set_title_example(title, example):
|
142 |
return [(None, welcome_preview_message.format(title, example))], example, gr.Column(visible=True), gr.Group(visible=True)
|