forked from open-webui/open-webui
refac
This commit is contained in:
parent
fb0c2d2a8e
commit
ad3d69be30
1 changed files with 1 additions and 5 deletions
|
@ -72,7 +72,6 @@ def store_data_in_vector_db(data, collection_name) -> bool:
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(e.__class__.__name__)
|
|
||||||
if e.__class__.__name__ == "UniqueConstraintError":
|
if e.__class__.__name__ == "UniqueConstraintError":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -113,10 +112,7 @@ def store_web(form_data: StoreWebForm):
|
||||||
@app.post("/doc")
|
@app.post("/doc")
|
||||||
def store_doc(collection_name: str = Form(...), file: UploadFile = File(...)):
|
def store_doc(collection_name: str = Form(...), file: UploadFile = File(...)):
|
||||||
# "https://www.gutenberg.org/files/1727/1727-h/1727-h.htm"
|
# "https://www.gutenberg.org/files/1727/1727-h/1727-h.htm"
|
||||||
|
file.filename = f"{collection_name}-{file.filename}"
|
||||||
file.filename = f"{uuid.uuid4()}-{file.filename}"
|
|
||||||
print(dir(file))
|
|
||||||
print(file.content_type)
|
|
||||||
|
|
||||||
if file.content_type not in ["application/pdf", "text/plain"]:
|
if file.content_type not in ["application/pdf", "text/plain"]:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|
Loading…
Reference in a new issue