Spaces:
Sleeping
Sleeping
Update app.py
Browse files110 unmodified lines11111211311411511624 unmodified lines14114214314414514614720 unmodified lines16816917017117217317417513 unmodified lines189190191110 unmodified linescolor: #e1e1e1;padding: 0.5rem 2rem;font-size: 1rem;}</style>""",24 unmodified linesst.markdown("""<div class="chat-input"><input type="text" id="chat-input-field" placeholder="Type your message here..." onkeydown="if(event.key === 'Enter'){document.getElementById('chat-submit-button').click();}"><button id="chat-submit-button" onclick="sendChat()">Send</button></div><script>20 unmodified linesunsafe_allow_html=True)# Save session buttonif st.button("Save Session", key="save_session", help="Save the current chat session", class_="save-session"):st.session_state.previous_sessions.append(st.session_state.chat_history)st.session_state.chat_history = [{"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper examples to help the user. Try to mention references or provide citations to make it more detail-oriented."}13 unmodified lines110 unmodified lines11111211311411511611724 unmodified lines14214314414514614714820 unmodified lines16917017117217317417517617717817918018118218318418518618718818919019119219319419519619719813 unmodified lines212213214215110 unmodified linescolor: #e1e1e1;padding: 0.5rem 2rem;font-size: 1rem;cursor: pointer;}</style>""",24 unmodified linesst.markdown("""<div class="chat-input"><input type="text" id="chat-input-field" placeholder="Type your message here..." onkeydown="if(event.key === 'Enter'){sendChat();}"><button id="chat-submit-button" onclick="sendChat()">Send</button></div><script>20 unmodified linesunsafe_allow_html=True)# Custom Save Session buttonst.markdown("""<button class="save-session" onclick="saveSession()">Save Session</button><script>function saveSession() {fetch('/save-session', {method: 'POST',headers: {'Content-Type': 'application/json'},}).then(response => {if (response.ok) {location.reload();}});}</script>""",unsafe_allow_html=True)# Handling Save Session in Streamlitif st.button("Trigger Save Session", key="trigger_save_session", help="Hidden button to handle session saving"):st.session_state.previous_sessions.append(st.session_state.chat_history)st.session_state.chat_history = [{"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper examples to help the user. Try to mention references or provide citations to make it more detail-oriented."}13 unmodified lines
app.py+27-3