Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,7 +115,7 @@ def page1():
|
|
| 115 |
def process_question(question):
|
| 116 |
# Clear the previous run status
|
| 117 |
st.session_state.run = None
|
| 118 |
-
|
| 119 |
|
| 120 |
# Add message to the thread
|
| 121 |
client.beta.threads.messages.create(
|
|
@@ -147,8 +147,10 @@ def page1():
|
|
| 147 |
# Display the latest message from the assistant
|
| 148 |
last_assistant_message = next((message for message in reversed(st.session_state.messages.data) if message.role == "assistant"), None)
|
| 149 |
if last_assistant_message:
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
| 152 |
|
| 153 |
# Example query buttons
|
| 154 |
col3, col4 = st.columns(2) # Create two columns for buttons
|
|
|
|
| 115 |
def process_question(question):
|
| 116 |
# Clear the previous run status
|
| 117 |
st.session_state.run = None
|
| 118 |
+
|
| 119 |
|
| 120 |
# Add message to the thread
|
| 121 |
client.beta.threads.messages.create(
|
|
|
|
| 147 |
# Display the latest message from the assistant
|
| 148 |
last_assistant_message = next((message for message in reversed(st.session_state.messages.data) if message.role == "assistant"), None)
|
| 149 |
if last_assistant_message:
|
| 150 |
+
|
| 151 |
+
# Update chat history with only the latest assistant's response
|
| 152 |
+
st.session_state.chat_history = [("User", question), ("Assistant", last_assistant_message.content[0].text.value)]
|
| 153 |
+
|
| 154 |
|
| 155 |
# Example query buttons
|
| 156 |
col3, col4 = st.columns(2) # Create two columns for buttons
|