Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -247,14 +247,24 @@ def page1():
|
|
| 247 |
|
| 248 |
# Start timing
|
| 249 |
start_time = time.time()
|
| 250 |
-
|
| 251 |
with st.spinner('Bot is thinking...'):
|
| 252 |
chain = load_chatbot()
|
| 253 |
-
|
|
|
|
|
|
|
| 254 |
with get_openai_callback() as cb:
|
| 255 |
response = chain.run(input_documents=docs, question=full_query)
|
| 256 |
response = handle_no_answer(response) # Process the response through the new function
|
| 257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
|
| 260 |
# Stop timing
|
|
|
|
| 247 |
|
| 248 |
# Start timing
|
| 249 |
start_time = time.time()
|
| 250 |
+
|
| 251 |
with st.spinner('Bot is thinking...'):
|
| 252 |
chain = load_chatbot()
|
| 253 |
+
# Berücksichtige die gesamte bisherige Session-Historie bei der Suche
|
| 254 |
+
full_history = " ".join([chat[1] for chat in st.session_state['chat_history_page1']])
|
| 255 |
+
docs = VectorStore.similarity_search(query=full_history, k=5)
|
| 256 |
with get_openai_callback() as cb:
|
| 257 |
response = chain.run(input_documents=docs, question=full_query)
|
| 258 |
response = handle_no_answer(response) # Process the response through the new function
|
| 259 |
|
| 260 |
+
|
| 261 |
+
#with st.spinner('Bot is thinking...'):
|
| 262 |
+
# chain = load_chatbot()
|
| 263 |
+
# docs = VectorStore.similarity_search(query=query, k=5)
|
| 264 |
+
# with get_openai_callback() as cb:
|
| 265 |
+
# response = chain.run(input_documents=docs, question=full_query)
|
| 266 |
+
# response = handle_no_answer(response) # Process the response through the new function
|
| 267 |
+
|
| 268 |
|
| 269 |
|
| 270 |
# Stop timing
|