Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,6 +69,8 @@ if "openai_model" not in st.session_state:
|
|
| 69 |
# Corrected initialization of display_messages:
|
| 70 |
if "display_messages" not in st.session_state:
|
| 71 |
st.session_state["display_messages"] = [initial_context]
|
|
|
|
|
|
|
| 72 |
|
| 73 |
# Get user input
|
| 74 |
prompt = st.chat_input("Type your message here...")
|
|
@@ -83,6 +85,8 @@ if prompt:
|
|
| 83 |
# Function to reset all chat-related session state
|
| 84 |
def reset_chat_history():
|
| 85 |
st.session_state["display_messages"] = [initial_context]
|
|
|
|
|
|
|
| 86 |
st.rerun()
|
| 87 |
|
| 88 |
# Main chat container
|
|
|
|
| 69 |
# Corrected initialization of display_messages:
|
| 70 |
if "display_messages" not in st.session_state:
|
| 71 |
st.session_state["display_messages"] = [initial_context]
|
| 72 |
+
# Add the bot's opening message to the chat history
|
| 73 |
+
st.session_state["display_messages"].append({"role": "assistant", "content": config.opening_message})
|
| 74 |
|
| 75 |
# Get user input
|
| 76 |
prompt = st.chat_input("Type your message here...")
|
|
|
|
| 85 |
# Function to reset all chat-related session state
|
| 86 |
def reset_chat_history():
|
| 87 |
st.session_state["display_messages"] = [initial_context]
|
| 88 |
+
# Re-add the opening message when chat is reset
|
| 89 |
+
st.session_state["display_messages"].append({"role": "assistant", "content": config.opening_message})
|
| 90 |
st.rerun()
|
| 91 |
|
| 92 |
# Main chat container
|