Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,9 @@ def add_text_to_chat_history(chat_history, user_input):
|
|
| 59 |
def show_history(chat_history):
|
| 60 |
return chat_history
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
def main():
|
| 64 |
with gr.Blocks() as demo:
|
| 65 |
gr.Markdown("## KadiAPY - AI Coding-Assistant")
|
|
@@ -94,11 +96,16 @@ def main():
|
|
| 94 |
)
|
| 95 |
|
| 96 |
# Use the state to persist chat history between interactions
|
|
|
|
|
|
|
| 97 |
submit_btn.click(add_text_to_chat_history, [chat_history, user_txt], [chat_history, user_txt]).then(show_history,[chat_history], [chatbot])\
|
| 98 |
-
.then(bot_kadi, [chat_history], [chatbot])
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
demo.launch()
|
| 103 |
|
| 104 |
if __name__ == "__main__":
|
|
|
|
| 59 |
def show_history(chat_history):
|
| 60 |
return chat_history
|
| 61 |
|
| 62 |
+
def reset_all():
|
| 63 |
+
return [], "", ""
|
| 64 |
+
|
| 65 |
def main():
|
| 66 |
with gr.Blocks() as demo:
|
| 67 |
gr.Markdown("## KadiAPY - AI Coding-Assistant")
|
|
|
|
| 96 |
)
|
| 97 |
|
| 98 |
# Use the state to persist chat history between interactions
|
| 99 |
+
user_txt.submit(add_text_to_chat_history, [chat_history, user_txt], [chat_history, user_txt]).then(show_history,[chat_history], [chatbot])\
|
| 100 |
+
.then(bot_kadi, [chat_history], [chatbot])
|
| 101 |
submit_btn.click(add_text_to_chat_history, [chat_history, user_txt], [chat_history, user_txt]).then(show_history,[chat_history], [chatbot])\
|
| 102 |
+
.then(bot_kadi, [chat_history], [chatbot])
|
| 103 |
+
clear_btn.click(
|
| 104 |
+
reset_all,
|
| 105 |
+
None,
|
| 106 |
+
[chat_history, chatbot, user_txt],
|
| 107 |
+
queue=False
|
| 108 |
+
)
|
| 109 |
demo.launch()
|
| 110 |
|
| 111 |
if __name__ == "__main__":
|