I am building a Streamlit app that integrates Snowflake Cortex for natural language to SQL translation. Each project in my app has a dedicated YAML file that configures the Cortex model. I implemented a multi-tab interface where each tab represents a project, and each project should have an independent chat history and process queries using its specific YAML file.
Chatbox placement issues – I want the chatbox to always stay at the bottom of each tab, ensuring a smooth user experience.
The question is coming at the bottom. Chatbox still is at the top.
Is there anything that can be easily looked upon to fix this issue quickly…
Please advise.
— Streamlit Main Content —
tabs = st.tabs(list(PROJECT_FILES.keys()))
for tab_name, file in PROJECT_FILES.items():
with tabs[list(PROJECT_FILES.keys()).index(tab_name)]:
st.title(f"{tab_name} Status")
st.markdown(f"Semantic Model: {file}
")
# Initialize unique session state for each project
session_key = f"session_{file}"
if session_key not in st.session_state:
st.session_state[session_key] = {"messages": [], "active_suggestion": None, "error": None}
for message_index, message in enumerate(st.session_state[session_key]["messages"]):
with st.chat_message(message["role"]):
display_content(content=message["content"], message_index=message_index, file=file)
if user_input := st.chat_input("What is your question?", key=f"chat_input_{tab_name}"):
process_message(prompt=user_input, file=file)
# del st.session_state[""]