rafaldembski
commited on
Commit
•
1fd875a
1
Parent(s):
8389500
Update app.py
Browse files
app.py
CHANGED
@@ -63,8 +63,11 @@ def parse_response(response):
|
|
63 |
|
64 |
return answer, reflection, steps
|
65 |
|
66 |
-
def generate(message, history, model,
|
67 |
"""Generates the chatbot response."""
|
|
|
|
|
|
|
68 |
response, thinking_time = respond(message, history, model, system_prompt, thinking_budget, api_key)
|
69 |
|
70 |
if response.startswith("Error:"):
|
@@ -163,6 +166,7 @@ Analyze the user's emotions based on their language and tone. If the user seems
|
|
163 |
|
164 |
### **Critical Evaluation**:
|
165 |
Always aim to improve. After every interaction, evaluate whether the answer could be refined or if additional information might be necessary to fully address the user’s request.
|
|
|
166 |
"""
|
167 |
|
168 |
# Now, let's simplify the interface and remove unnecessary boxes like API Key and System Prompt
|
@@ -188,7 +192,7 @@ with gr.Blocks() as demo:
|
|
188 |
clear_button.click(lambda: ([], ""), inputs=None, outputs=[chatbot, msg])
|
189 |
|
190 |
# Submit messages by pressing Enter or clicking the Submit button
|
191 |
-
msg.submit(generate, inputs=[msg, chatbot, model,
|
192 |
-
submit_button.click(generate, inputs=[msg, chatbot, model,
|
193 |
|
194 |
demo.launch(share=True, show_api=False)
|
|
|
63 |
|
64 |
return answer, reflection, steps
|
65 |
|
66 |
+
def generate(message, history, model, thinking_budget, api_key):
|
67 |
"""Generates the chatbot response."""
|
68 |
+
# Use DEFAULT_SYSTEM_PROMPT inside the function
|
69 |
+
system_prompt = DEFAULT_SYSTEM_PROMPT
|
70 |
+
|
71 |
response, thinking_time = respond(message, history, model, system_prompt, thinking_budget, api_key)
|
72 |
|
73 |
if response.startswith("Error:"):
|
|
|
166 |
|
167 |
### **Critical Evaluation**:
|
168 |
Always aim to improve. After every interaction, evaluate whether the answer could be refined or if additional information might be necessary to fully address the user’s request.
|
169 |
+
|
170 |
"""
|
171 |
|
172 |
# Now, let's simplify the interface and remove unnecessary boxes like API Key and System Prompt
|
|
|
192 |
clear_button.click(lambda: ([], ""), inputs=None, outputs=[chatbot, msg])
|
193 |
|
194 |
# Submit messages by pressing Enter or clicking the Submit button
|
195 |
+
msg.submit(generate, inputs=[msg, chatbot, model, thinking_budget, None], outputs=[chatbot, msg])
|
196 |
+
submit_button.click(generate, inputs=[msg, chatbot, model, thinking_budget, None], outputs=[chatbot, msg])
|
197 |
|
198 |
demo.launch(share=True, show_api=False)
|