Spaces:
Runtime error
Runtime error
Commit
·
1d3b1f7
1
Parent(s):
4d6273c
update UI
Browse files
app.py
CHANGED
|
@@ -598,19 +598,19 @@ def SetAgent(Choice):
|
|
| 598 |
global record
|
| 599 |
record = []
|
| 600 |
|
| 601 |
-
def LinkElement(
|
| 602 |
'''
|
| 603 |
Link chatbot display output with other UI
|
| 604 |
'''
|
| 605 |
global record
|
| 606 |
-
if record !=
|
| 607 |
-
last_response =
|
| 608 |
print("last response:", last_response)
|
| 609 |
-
record =
|
| 610 |
-
print(
|
| 611 |
# print("link element test")
|
| 612 |
else:
|
| 613 |
-
print("From linkelement: ",
|
| 614 |
pass
|
| 615 |
|
| 616 |
|
|
@@ -643,9 +643,9 @@ with gr.Blocks() as demo:
|
|
| 643 |
# logs = gr.Textbox()
|
| 644 |
logs = gr.Textbox()
|
| 645 |
upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
|
| 646 |
-
demo.load(read_logs, None, logs, every=0.5)
|
| 647 |
main.chatbot.change(LinkElement, main.chatbot, None)
|
| 648 |
agentchoice.change(SetAgent, agentchoice, None)
|
|
|
|
| 649 |
|
| 650 |
|
| 651 |
|
|
|
|
| 598 |
global record
|
| 599 |
record = []
|
| 600 |
|
| 601 |
+
def LinkElement(chatbot_history):
|
| 602 |
'''
|
| 603 |
Link chatbot display output with other UI
|
| 604 |
'''
|
| 605 |
global record
|
| 606 |
+
if record != chatbot_history:
|
| 607 |
+
last_response = chatbot_history[-1:][1]
|
| 608 |
print("last response:", last_response)
|
| 609 |
+
record = chatbot_history
|
| 610 |
+
print(chatbot_history)
|
| 611 |
# print("link element test")
|
| 612 |
else:
|
| 613 |
+
print("From linkelement: ", chatbot_history)
|
| 614 |
pass
|
| 615 |
|
| 616 |
|
|
|
|
| 643 |
# logs = gr.Textbox()
|
| 644 |
logs = gr.Textbox()
|
| 645 |
upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
|
|
|
|
| 646 |
main.chatbot.change(LinkElement, main.chatbot, None)
|
| 647 |
agentchoice.change(SetAgent, agentchoice, None)
|
| 648 |
+
demo.load(read_logs, None, logs, every=0.5)
|
| 649 |
|
| 650 |
|
| 651 |
|