Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -87,6 +87,18 @@ if not os.path.exists(db_path):
|
|
87 |
# Create a Chroma database instance from the SQLite file
|
88 |
vectordb = Chroma(persist_directory="./data", embedding_function=OpenAIEmbeddings())
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
# Define Streamlit app
|
91 |
def main():
|
92 |
st.title("AI Chat Application")
|
@@ -151,15 +163,7 @@ chat_history = []
|
|
151 |
|
152 |
|
153 |
|
154 |
-
|
155 |
-
global chat_history
|
156 |
-
result = pdf_qa(
|
157 |
-
{"question": query, "chat_history": chat_history, "vectordb": vectordb})
|
158 |
-
chat_history.append((query, result["answer"]))
|
159 |
-
|
160 |
-
# Log the user query and system response
|
161 |
-
log_query(query, result["answer"])
|
162 |
-
return result["answer"]
|
163 |
|
164 |
|
165 |
|
|
|
87 |
# Create a Chroma database instance from the SQLite file
|
88 |
vectordb = Chroma(persist_directory="./data", embedding_function=OpenAIEmbeddings())
|
89 |
|
90 |
+
|
91 |
+
def ask_alans_ai(query, vectordb):
|
92 |
+
global chat_history
|
93 |
+
result = pdf_qa(
|
94 |
+
{"question": query, "chat_history": chat_history, "vectordb": vectordb})
|
95 |
+
chat_history.append((query, result["answer"]))
|
96 |
+
|
97 |
+
# Log the user query and system response
|
98 |
+
log_query(query, result["answer"])
|
99 |
+
return result["answer"]
|
100 |
+
|
101 |
+
|
102 |
# Define Streamlit app
|
103 |
def main():
|
104 |
st.title("AI Chat Application")
|
|
|
163 |
|
164 |
|
165 |
|
166 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
|
169 |
|