Spaces:
Sleeping
Sleeping
Update app.py
Browse files110 unmodified lines11111211311411511611724 unmodified lines14214314414414514614714820 unmodified lines16917017117117217217317417517617717817918018118218318418518618718818919019119219319419519619719813 unmodified lines212213214215110 unmodified lines color: #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'){document.getElementById('chat-submit-button').click();}"> <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 lines unsafe_allow_html=True)
# Save session buttonif st.button("Save Session", key="save_session", help="Save the current chat session", class_="save-session"):# 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