Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -111,6 +111,7 @@ st.markdown(
|
|
111 |
color: #e1e1e1;
|
112 |
padding: 0.5rem 2rem;
|
113 |
font-size: 1rem;
|
|
|
114 |
}
|
115 |
</style>
|
116 |
""",
|
@@ -141,7 +142,7 @@ st.markdown("</div>", unsafe_allow_html=True)
|
|
141 |
st.markdown(
|
142 |
"""
|
143 |
<div class="chat-input">
|
144 |
-
<input type="text" id="chat-input-field" placeholder="Type your message here..." onkeydown="if(event.key === 'Enter'){
|
145 |
<button id="chat-submit-button" onclick="sendChat()">Send</button>
|
146 |
</div>
|
147 |
<script>
|
@@ -168,8 +169,30 @@ st.markdown(
|
|
168 |
unsafe_allow_html=True
|
169 |
)
|
170 |
|
171 |
-
# Save
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
st.session_state.previous_sessions.append(st.session_state.chat_history)
|
174 |
st.session_state.chat_history = [
|
175 |
{"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."}
|
@@ -189,3 +212,4 @@ st.markdown(
|
|
189 |
|
190 |
|
191 |
|
|
|
|
111 |
color: #e1e1e1;
|
112 |
padding: 0.5rem 2rem;
|
113 |
font-size: 1rem;
|
114 |
+
cursor: pointer;
|
115 |
}
|
116 |
</style>
|
117 |
""",
|
|
|
142 |
st.markdown(
|
143 |
"""
|
144 |
<div class="chat-input">
|
145 |
+
<input type="text" id="chat-input-field" placeholder="Type your message here..." onkeydown="if(event.key === 'Enter'){sendChat();}">
|
146 |
<button id="chat-submit-button" onclick="sendChat()">Send</button>
|
147 |
</div>
|
148 |
<script>
|
|
|
169 |
unsafe_allow_html=True
|
170 |
)
|
171 |
|
172 |
+
# Custom Save Session button
|
173 |
+
st.markdown(
|
174 |
+
"""
|
175 |
+
<button class="save-session" onclick="saveSession()">Save Session</button>
|
176 |
+
<script>
|
177 |
+
function saveSession() {
|
178 |
+
fetch('/save-session', {
|
179 |
+
method: 'POST',
|
180 |
+
headers: {
|
181 |
+
'Content-Type': 'application/json'
|
182 |
+
},
|
183 |
+
}).then(response => {
|
184 |
+
if (response.ok) {
|
185 |
+
location.reload();
|
186 |
+
}
|
187 |
+
});
|
188 |
+
}
|
189 |
+
</script>
|
190 |
+
""",
|
191 |
+
unsafe_allow_html=True
|
192 |
+
)
|
193 |
+
|
194 |
+
# Handling Save Session in Streamlit
|
195 |
+
if st.button("Trigger Save Session", key="trigger_save_session", help="Hidden button to handle session saving"):
|
196 |
st.session_state.previous_sessions.append(st.session_state.chat_history)
|
197 |
st.session_state.chat_history = [
|
198 |
{"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."}
|
|
|
212 |
|
213 |
|
214 |
|
215 |
+
|