Srinivasulu kethanaboina commited on
Commit
ca13587
·
verified ·
1 Parent(s): 47c15ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
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
- # Use Gradio Blocks to wrap components
 
 
 
 
 
 
 
 
 
 
128
 
129
- chat = gr.ChatInterface(chat_interface, css=css, clear_btn=None, undo_btn=None, retry_btn=None).launch()
 
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