Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -233,24 +233,24 @@ def select_db(db_name):
|
|
233 |
|
234 |
return redirect(url_for('chat'))
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
#
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
|
255 |
if __name__ == "__main__":
|
256 |
app.run(debug=False, use_reloader=False)
|
|
|
233 |
|
234 |
return redirect(url_for('chat'))
|
235 |
|
236 |
+
@app.route('/update-dbs/<db_name>', methods=['GET','POST'])
|
237 |
+
def update_db(db_name):
|
238 |
+
if request.method == 'POST':
|
239 |
+
db_name = request.form['db_name']
|
240 |
+
|
241 |
+
# Get all files from the uploaded folder
|
242 |
+
files = request.files.getlist('folder')
|
243 |
+
if not files:
|
244 |
+
return "No files uploaded", 400
|
245 |
+
print(f"Selected DB: {db_name}")
|
246 |
+
DB_PATH = os.path.join(VECTOR_DB_FOLDER, db_name)
|
247 |
+
DB_PATH = DB_PATH.replace("\\", "/")
|
248 |
+
print(f"Selected DB: {DB_PATH}")
|
249 |
+
|
250 |
+
generate_data_store(DB_PATH, db_name)
|
251 |
+
|
252 |
+
return redirect(url_for('list_dbs'))
|
253 |
+
return render_template('update_db.html')
|
254 |
|
255 |
if __name__ == "__main__":
|
256 |
app.run(debug=False, use_reloader=False)
|