Update app.py
Browse files
app.py
CHANGED
@@ -168,6 +168,31 @@ async def download_vectorstore(
|
|
168 |
except Exception as e:
|
169 |
raise HTTPException(status_code=500, detail=str(e))
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
if __name__ == "__main__":
|
173 |
import os
|
|
|
168 |
except Exception as e:
|
169 |
raise HTTPException(status_code=500, detail=str(e))
|
170 |
|
171 |
+
@app.get("/vectorstore/list", tags=["List VectorStores"])
|
172 |
+
async def list_vectorstores():
|
173 |
+
try:
|
174 |
+
vectorstores = [
|
175 |
+
f for f in os.listdir(path_db) if os.path.isdir(os.path.join(path_db, f))
|
176 |
+
]
|
177 |
+
return {"vectorstores": str(vectorstores)}
|
178 |
+
except Exception as e:
|
179 |
+
raise HTTPException(status_code=500, detail=str(e))
|
180 |
+
|
181 |
+
|
182 |
+
@app.get("/vectorstore/exists", tags=["Exists VectorStore"])
|
183 |
+
async def exists_vectorstore(name: str):
|
184 |
+
try:
|
185 |
+
vectorstores = [
|
186 |
+
f for f in os.listdir(path_db) if os.path.isdir(os.path.join(path_db, f))
|
187 |
+
]
|
188 |
+
for vectorstore in vectorstores:
|
189 |
+
if name in vectorstore:
|
190 |
+
return {"exists": True}
|
191 |
+
return {"exists": False}
|
192 |
+
except Exception as e:
|
193 |
+
raise HTTPException(status_code=500, detail=str(e))
|
194 |
+
|
195 |
+
|
196 |
|
197 |
if __name__ == "__main__":
|
198 |
import os
|