Spaces:
Sleeping
Sleeping
ElouarnLC
commited on
Commit
·
c7680f3
1
Parent(s):
3c479ae
clear history
Browse files
app.py
CHANGED
@@ -18,12 +18,6 @@ context_input = gr.Textbox(
|
|
18 |
)
|
19 |
|
20 |
|
21 |
-
def update_context(context):
|
22 |
-
global global_context
|
23 |
-
global_context["hidden_context"] = context
|
24 |
-
return None
|
25 |
-
|
26 |
-
|
27 |
def format_prompt(message, history):
|
28 |
prompt = "<s>"
|
29 |
|
@@ -99,18 +93,22 @@ def reset_history(chatbot):
|
|
99 |
return []
|
100 |
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
chatbot_interface = gr.ChatInterface(
|
103 |
fn=generate,
|
104 |
chatbot=mychatbot,
|
105 |
title="Tavernier 🍺",
|
106 |
retry_btn=None,
|
107 |
undo_btn=None,
|
108 |
-
clear_btn=gr.ClearButton(value="Effacer l'historique"),
|
109 |
)
|
110 |
|
111 |
-
clear_button = chatbot_interface.clear_btn
|
112 |
-
clear_button.click(reset_history, inputs=[mychatbot], outputs=[mychatbot])
|
113 |
-
|
114 |
|
115 |
# Ajouter le champ de texte pour le contexte caché à l'interface
|
116 |
context_interface = gr.Interface(
|
|
|
18 |
)
|
19 |
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
def format_prompt(message, history):
|
22 |
prompt = "<s>"
|
23 |
|
|
|
93 |
return []
|
94 |
|
95 |
|
96 |
+
def update_context(context):
|
97 |
+
global global_context
|
98 |
+
global_context["hidden_context"] = context
|
99 |
+
global mychatbot
|
100 |
+
mychatbot.history = reset_history(mychatbot)
|
101 |
+
return None
|
102 |
+
|
103 |
+
|
104 |
chatbot_interface = gr.ChatInterface(
|
105 |
fn=generate,
|
106 |
chatbot=mychatbot,
|
107 |
title="Tavernier 🍺",
|
108 |
retry_btn=None,
|
109 |
undo_btn=None,
|
|
|
110 |
)
|
111 |
|
|
|
|
|
|
|
112 |
|
113 |
# Ajouter le champ de texte pour le contexte caché à l'interface
|
114 |
context_interface = gr.Interface(
|