Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -197,6 +197,8 @@ with tab2:
|
|
197 |
if "tech_thread_id" not in st.session_state:
|
198 |
st.session_state.tech_thread_id = None
|
199 |
if "tech_results" not in st.session_state:
|
|
|
|
|
200 |
st.session_state.tech_results = []
|
201 |
if "tech_lightbox" not in st.session_state:
|
202 |
st.session_state.tech_lightbox = None
|
@@ -205,10 +207,14 @@ with tab2:
|
|
205 |
|
206 |
tech_input = st.chat_input("Ask about plans, drawings or components")
|
207 |
if tech_input:
|
|
|
208 |
st.session_state.tech_messages.append({"role": "user", "content": tech_input})
|
209 |
st.session_state.tech_new_input = True
|
210 |
|
211 |
if st.session_state.tech_new_input:
|
|
|
|
|
|
|
212 |
try:
|
213 |
if st.session_state.tech_thread_id is None:
|
214 |
thread = client.beta.threads.create()
|
@@ -263,6 +269,9 @@ with tab2:
|
|
263 |
page_size = 8
|
264 |
page = st.number_input("Page", min_value=1, step=1, value=1)
|
265 |
|
|
|
|
|
|
|
266 |
if st.session_state.tech_results:
|
267 |
st.subheader("📂 Results")
|
268 |
results = [r for r in st.session_state.tech_results if selected == "All" or r.get("discipline") == selected]
|
|
|
197 |
if "tech_thread_id" not in st.session_state:
|
198 |
st.session_state.tech_thread_id = None
|
199 |
if "tech_results" not in st.session_state:
|
200 |
+
if "tech_last_input" not in st.session_state:
|
201 |
+
st.session_state.tech_last_input = None
|
202 |
st.session_state.tech_results = []
|
203 |
if "tech_lightbox" not in st.session_state:
|
204 |
st.session_state.tech_lightbox = None
|
|
|
207 |
|
208 |
tech_input = st.chat_input("Ask about plans, drawings or components")
|
209 |
if tech_input:
|
210 |
+
st.session_state.tech_last_input = tech_input
|
211 |
st.session_state.tech_messages.append({"role": "user", "content": tech_input})
|
212 |
st.session_state.tech_new_input = True
|
213 |
|
214 |
if st.session_state.tech_new_input:
|
215 |
+
# Always start fresh thread for each query
|
216 |
+
thread = client.beta.threads.create()
|
217 |
+
st.session_state.tech_thread_id = thread.id
|
218 |
try:
|
219 |
if st.session_state.tech_thread_id is None:
|
220 |
thread = client.beta.threads.create()
|
|
|
269 |
page_size = 8
|
270 |
page = st.number_input("Page", min_value=1, step=1, value=1)
|
271 |
|
272 |
+
if st.session_state.get("tech_last_input"):
|
273 |
+
st.markdown(f"#### 🧑 You asked: `{st.session_state.tech_last_input}`")
|
274 |
+
|
275 |
if st.session_state.tech_results:
|
276 |
st.subheader("📂 Results")
|
277 |
results = [r for r in st.session_state.tech_results if selected == "All" or r.get("discipline") == selected]
|