Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,7 @@ def get_data(search_term):
|
|
| 44 |
f"search for {search_term} grants\n\n"
|
| 45 |
"List me all grants or funds with:\n"
|
| 46 |
"- Grant name/title\n"
|
| 47 |
-
"- Short summary
|
| 48 |
"- Funding organization\n"
|
| 49 |
"- Grant value (numeric only)\n"
|
| 50 |
"- Application deadline\n"
|
|
@@ -251,9 +251,11 @@ def main():
|
|
| 251 |
response = chat_with_knowledge_base(query)
|
| 252 |
answer = response["answer"] if isinstance(response, dict) and "answer" in response else response
|
| 253 |
st.session_state.chat_history.append({"query": query, "response": answer})
|
|
|
|
| 254 |
if st.session_state.chat_history:
|
| 255 |
st.subheader("Chat History")
|
| 256 |
-
|
|
|
|
| 257 |
# User message: dark grey background with white text
|
| 258 |
st.markdown(
|
| 259 |
f"<div style='padding: 10px; border-radius: 5px; margin-bottom: 5px; background-color:#444444; color: white;'><strong>You:</strong> {chat['query']}</div>",
|
|
|
|
| 44 |
f"search for {search_term} grants\n\n"
|
| 45 |
"List me all grants or funds with:\n"
|
| 46 |
"- Grant name/title\n"
|
| 47 |
+
"- Short summary \n"
|
| 48 |
"- Funding organization\n"
|
| 49 |
"- Grant value (numeric only)\n"
|
| 50 |
"- Application deadline\n"
|
|
|
|
| 251 |
response = chat_with_knowledge_base(query)
|
| 252 |
answer = response["answer"] if isinstance(response, dict) and "answer" in response else response
|
| 253 |
st.session_state.chat_history.append({"query": query, "response": answer})
|
| 254 |
+
|
| 255 |
if st.session_state.chat_history:
|
| 256 |
st.subheader("Chat History")
|
| 257 |
+
# Reverse the chat history to show the latest messages first
|
| 258 |
+
for chat in reversed(st.session_state.chat_history):
|
| 259 |
# User message: dark grey background with white text
|
| 260 |
st.markdown(
|
| 261 |
f"<div style='padding: 10px; border-radius: 5px; margin-bottom: 5px; background-color:#444444; color: white;'><strong>You:</strong> {chat['query']}</div>",
|