drop unused functions
This commit is contained in:
parent
2c15c026c8
commit
e21758be39
54
main.py
54
main.py
@ -5,11 +5,6 @@ import json
|
||||
import os
|
||||
from streamlit_cookies_manager import CookieManager
|
||||
|
||||
# Inject the scroll control HTML/JS
|
||||
def load_html(file_name):
|
||||
with open(file_name, 'r', encoding='utf-8') as file:
|
||||
return file.read()
|
||||
|
||||
# Initialize the Cookie Manager (no encryption)
|
||||
cookies = CookieManager(prefix="ktosiek/streamlit-cookies-manager/")
|
||||
if not cookies.ready():
|
||||
@ -68,48 +63,6 @@ def send_post_request(prompt):
|
||||
else:
|
||||
return json
|
||||
|
||||
# Custom CSS to fix the input box at the bottom of the page
|
||||
st.markdown(
|
||||
"""
|
||||
<style>
|
||||
.fixed-input-container {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.1);
|
||||
z-index: 999;
|
||||
}
|
||||
.input-container input {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.input-container button {
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.input-container button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
.prompt-history {
|
||||
margin-bottom: 120px; /* Space to ensure prompt history doesn't overlap input box */
|
||||
}
|
||||
</style>
|
||||
""",
|
||||
unsafe_allow_html=True
|
||||
)
|
||||
|
||||
st.title('Ask Maargdarshak')
|
||||
|
||||
if 'messages' not in st.session_state:
|
||||
@ -128,7 +81,12 @@ if prompt:
|
||||
st.session_state.messages.append({'role': 'user', 'content': prompt})
|
||||
|
||||
# Get the bot's response via a POST request
|
||||
response = send_post_request(prompt)
|
||||
with st.spinner("Fetching data..."):
|
||||
try:
|
||||
response = send_post_request(prompt)
|
||||
except Exception as e:
|
||||
response = f"An error occurred: {e}"
|
||||
st.success("Data fetched successfully!")
|
||||
|
||||
# Display the bot's response in the chat UI
|
||||
st.chat_message('bot').markdown(response)
|
||||
|
Loading…
Reference in New Issue
Block a user