Spaces:
Runtime error
Runtime error
juanmartip95
commited on
Commit
•
658adc0
1
Parent(s):
9721bd7
Update app.py
Browse files
app.py
CHANGED
@@ -28,24 +28,12 @@ def res(prompt, historial):
|
|
28 |
return respuesta, historial
|
29 |
|
30 |
def respond(message, chat_history, history):
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
if "Hasta la vista" in message: # replace with your actual condition
|
38 |
-
# Get the assistant's last message
|
39 |
-
last_message = response[1][-1]['content'] # assuming the last message is from the assistant
|
40 |
-
# Pass the JSON output to the extract_info function
|
41 |
-
info = extract_info(last_message)
|
42 |
-
# Use the extracted info
|
43 |
-
WA(info)
|
44 |
-
|
45 |
-
return "", chat_history, response[1]
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
def WA(history):
|
51 |
sendWA("491771675218",history)
|
@@ -104,7 +92,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size="sm"),css=css) as demo:
|
|
104 |
history_button = gr.Button("Show history")
|
105 |
btn.click(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history])
|
106 |
msg.submit(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history]) #Press enter to submit
|
107 |
-
pedido.click(
|
108 |
|
109 |
clear.click(lambda: None, None, chatbot, queue=False)
|
110 |
history_box = gr.Textbox()
|
|
|
28 |
return respuesta, historial
|
29 |
|
30 |
def respond(message, chat_history, history):
|
31 |
+
#print(history,type(history))
|
32 |
+
response= res(message,history)
|
33 |
+
bot_message = response[0]
|
34 |
+
chat_history.append((message, bot_message))
|
35 |
+
upload_list_sharepoint(conversation_id,"Anonymous",message,bot_message)
|
36 |
+
return "", chat_history,response[1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
def WA(history):
|
39 |
sendWA("491771675218",history)
|
|
|
92 |
history_button = gr.Button("Show history")
|
93 |
btn.click(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history])
|
94 |
msg.submit(respond, inputs=[msg, chatbot,history], outputs=[msg, chatbot,history]) #Press enter to submit
|
95 |
+
pedido.click(WA, inputs=history,outputs=pedido)
|
96 |
|
97 |
clear.click(lambda: None, None, chatbot, queue=False)
|
98 |
history_box = gr.Textbox()
|