Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -132,12 +132,11 @@ elif st.session_state.page == "sql":
|
|
| 132 |
|
| 133 |
# Streamlit A
|
| 134 |
|
| 135 |
-
st.markdown("Ask anything related to SQL interviews!")
|
| 136 |
|
| 137 |
# Initialize chat history
|
| 138 |
if "messages" not in st.session_state:
|
| 139 |
-
st.session_state.messages = [SystemMessage(content="Answer clearly like a technical SQL interviewer.")
|
| 140 |
-
]
|
| 141 |
|
| 142 |
# User input
|
| 143 |
user_input = st.text_input("💡 Ask your SQL interview question:", placeholder="e.g., give me 10 SQL interview questions with answers")
|
|
@@ -155,14 +154,14 @@ st.markdown("Ask anything related to SQL interviews!")
|
|
| 155 |
st.markdown(f"**Answer:** {answer}")
|
| 156 |
|
| 157 |
# Show chat history
|
| 158 |
-
st.markdown("### 📜 Chat History")
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
|
| 167 |
elif st.session_state.page == "powerbi":
|
| 168 |
st.title("Power BI Chatbot 📊")
|
|
|
|
| 132 |
|
| 133 |
# Streamlit A
|
| 134 |
|
| 135 |
+
st.markdown("Ask anything related to SQL interviews!")
|
| 136 |
|
| 137 |
# Initialize chat history
|
| 138 |
if "messages" not in st.session_state:
|
| 139 |
+
st.session_state.messages = [SystemMessage(content="Answer clearly like a technical SQL interviewer.")]
|
|
|
|
| 140 |
|
| 141 |
# User input
|
| 142 |
user_input = st.text_input("💡 Ask your SQL interview question:", placeholder="e.g., give me 10 SQL interview questions with answers")
|
|
|
|
| 154 |
st.markdown(f"**Answer:** {answer}")
|
| 155 |
|
| 156 |
# Show chat history
|
| 157 |
+
st.markdown("### 📜 Chat History")
|
| 158 |
+
for msg in st.session_state.messages[1:]: # Skip SystemMessage
|
| 159 |
+
if isinstance(msg, HumanMessage):
|
| 160 |
+
st.markdown(f"**You:** {msg.content}")
|
| 161 |
+
elif isinstance(msg, AIMessage):
|
| 162 |
+
st.markdown(f"**Bot:** {msg.content}")
|
| 163 |
+
st.button("⬅️ Back to Home", on_click=lambda: switch_page("home"))
|
| 164 |
+
# Load SQL chatbot here
|
| 165 |
|
| 166 |
elif st.session_state.page == "powerbi":
|
| 167 |
st.title("Power BI Chatbot 📊")
|