Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,19 +113,27 @@ def page1():
|
|
| 113 |
|
| 114 |
# Function to process the question
|
| 115 |
def process_question(question):
|
| 116 |
-
|
|
|
|
| 117 |
st.session_state.messages = client.beta.threads.messages.create(
|
| 118 |
thread_id=st.session_state.thread.id,
|
| 119 |
role="user",
|
| 120 |
content=question
|
| 121 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
#
|
| 124 |
st.session_state.run = client.beta.threads.runs.create(
|
| 125 |
thread_id=st.session_state.thread.id,
|
| 126 |
assistant_id=st.session_state.assistant.id,
|
| 127 |
)
|
| 128 |
|
|
|
|
| 129 |
# Wait and rerun logic
|
| 130 |
if st.session_state.retry_error < 3:
|
| 131 |
time.sleep(1) # Wait 1 second before checking run status
|
|
|
|
| 113 |
|
| 114 |
# Function to process the question
|
| 115 |
def process_question(question):
|
| 116 |
+
st.session_state.messages = []
|
| 117 |
+
|
| 118 |
st.session_state.messages = client.beta.threads.messages.create(
|
| 119 |
thread_id=st.session_state.thread.id,
|
| 120 |
role="user",
|
| 121 |
content=question
|
| 122 |
)
|
| 123 |
+
# Add new message to the thread
|
| 124 |
+
response = client.beta.threads.messages.create(
|
| 125 |
+
thread_id=st.session_state.thread.id,
|
| 126 |
+
role="user",
|
| 127 |
+
content=question
|
| 128 |
+
)
|
| 129 |
|
| 130 |
+
# Create a new run to process the messages in the thread
|
| 131 |
st.session_state.run = client.beta.threads.runs.create(
|
| 132 |
thread_id=st.session_state.thread.id,
|
| 133 |
assistant_id=st.session_state.assistant.id,
|
| 134 |
)
|
| 135 |
|
| 136 |
+
|
| 137 |
# Wait and rerun logic
|
| 138 |
if st.session_state.retry_error < 3:
|
| 139 |
time.sleep(1) # Wait 1 second before checking run status
|