Update app.py
Browse files233 unmodified lines23423523623723823924023 unmodified lines264265266267268269270233 unmodified linesif os.path.exists("faiss_database"):database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)else:# If no database exists, we'll create it with the first web search or document uploaddatabase = Noneif web_search:23 unmodified linesformatted_prompt = prompt_val.format(context=context_str, question=question)else:if database is None:return "No documents or web search results available. Please upload documents or enable web search."history_str = "\n".join([f"Q: {item['question']}\nA: {item['answer']}" for item in conversation_history])233 unmodified lines23423523623723823923 unmodified lines263264265266267268269233 unmodified linesif os.path.exists("faiss_database"):database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)else:database = Noneif web_search:23 unmodified linesformatted_prompt = prompt_val.format(context=context_str, question=question)else:if database is None:return "No documents available. Please upload documents or enable web search to answer questions."history_str = "\n".join([f"Q: {item['question']}\nA: {item['answer']}" for item in conversation_history])
app.py+1-2