Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,9 +30,10 @@ def get_response(user_message, history):
|
|
30 |
|
31 |
# Access the text response
|
32 |
if response.choices:
|
33 |
-
bot_message = response.choices[0].message
|
34 |
else:
|
35 |
bot_message = "No response generated."
|
|
|
36 |
return bot_message
|
37 |
|
38 |
with gr.Blocks() as demo:
|
@@ -52,4 +53,4 @@ with gr.Blocks() as demo:
|
|
52 |
msg.submit(user, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
53 |
clear.click(clear_chat, inputs=None, outputs=[msg, chatbot])
|
54 |
|
55 |
-
demo.launch()
|
|
|
30 |
|
31 |
# Access the text response
|
32 |
if response.choices:
|
33 |
+
bot_message = response.choices[0].message.content.strip() if response.choices[0].message.content.strip() else "No response generated."
|
34 |
else:
|
35 |
bot_message = "No response generated."
|
36 |
+
|
37 |
return bot_message
|
38 |
|
39 |
with gr.Blocks() as demo:
|
|
|
53 |
msg.submit(user, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
54 |
clear.click(clear_chat, inputs=None, outputs=[msg, chatbot])
|
55 |
|
56 |
+
demo.launch()
|