Spaces:
Runtime error
Runtime error
Srinivasulu kethanaboina
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -124,9 +124,19 @@ div.svelte-1rjryqp{display: none;}
|
|
124 |
div.progress-text.svelte-z7cif2.meta-text {display: none;}
|
125 |
'''
|
126 |
|
127 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
-
|
|
|
130 |
|
131 |
# Launch the Gradio interface
|
132 |
-
|
|
|
124 |
div.progress-text.svelte-z7cif2.meta-text {display: none;}
|
125 |
'''
|
126 |
|
127 |
+
# JavaScript to handle chat history saving
|
128 |
+
js_code = '''
|
129 |
+
<script>
|
130 |
+
function saveHistory(message, response) {
|
131 |
+
// Store message and response in session storage
|
132 |
+
let history = JSON.parse(sessionStorage.getItem('chatHistory') || '[]');
|
133 |
+
history.push({message, response});
|
134 |
+
sessionStorage.setItem('chatHistory', JSON.stringify(history));
|
135 |
+
}
|
136 |
+
</script>
|
137 |
+
'''
|
138 |
|
139 |
+
# Use Gradio Blocks to wrap components
|
140 |
+
chat = gr.ChatInterface(chat_interface, css=css, clear_btn=None, undo_btn=None, retry_btn=None, js=js_code).launch()
|
141 |
|
142 |
# Launch the Gradio interface
|
|