forked from open-webui/open-webui
		
	fixes after the refactor
Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
		
							parent
							
								
									d2c5f3d591
								
							
						
					
					
						commit
						8da06f5e74
					
				
					 3 changed files with 8 additions and 7 deletions
				
			
		|  | @ -111,12 +111,12 @@ def upload(file: UploadFile = File(...)): | ||||||
|     file_path = f"{UPLOAD_DIR}/{file.filename}" |     file_path = f"{UPLOAD_DIR}/{file.filename}" | ||||||
| 
 | 
 | ||||||
|     # Save file in chunks |     # Save file in chunks | ||||||
|     with file_path.open("wb+") as f: |     with open(file_path, "wb+") as f: | ||||||
|         for chunk in file.file: |         for chunk in file.file: | ||||||
|             f.write(chunk) |             f.write(chunk) | ||||||
| 
 | 
 | ||||||
|     def file_process_stream(): |     def file_process_stream(): | ||||||
|         total_size = os.path.getsize(str(file_path)) |         total_size = os.path.getsize(file_path) | ||||||
|         chunk_size = 1024 * 1024 |         chunk_size = 1024 * 1024 | ||||||
|         try: |         try: | ||||||
|             with open(file_path, "rb") as f: |             with open(file_path, "rb") as f: | ||||||
|  |  | ||||||
|  | @ -25,12 +25,13 @@ except ImportError: | ||||||
| # File Upload | # File Upload | ||||||
| #################################### | #################################### | ||||||
| 
 | 
 | ||||||
| DATA_DIR = Path(os.getenv("DATA_DIR", "./data")).resolve() | DATA_DIR = str(Path(os.getenv("DATA_DIR", "./data")).resolve()) | ||||||
| 
 | 
 | ||||||
| UPLOAD_DIR = f"{DATA_DIR}/uploads" | UPLOAD_DIR = f"{DATA_DIR}/uploads" | ||||||
| UPLOAD_DIR.mkdir(parents=True, exist_ok=True) |  | ||||||
| 
 | 
 | ||||||
| FRONTEND_BUILD_DIR = Path(os.getenv("FRONTEND_BUILD_DIR", "../build")) | Path(UPLOAD_DIR).mkdir(parents=True, exist_ok=True) | ||||||
|  | 
 | ||||||
|  | FRONTEND_BUILD_DIR = str(Path(os.getenv("FRONTEND_BUILD_DIR", "../build"))) | ||||||
| 
 | 
 | ||||||
| #################################### | #################################### | ||||||
| # ENV (dev,test,prod) | # ENV (dev,test,prod) | ||||||
|  | @ -88,7 +89,7 @@ if WEBUI_AUTH and WEBUI_JWT_SECRET_KEY == "": | ||||||
| CHROMA_DATA_PATH = f"{DATA_DIR}/vector_db" | CHROMA_DATA_PATH = f"{DATA_DIR}/vector_db" | ||||||
| EMBED_MODEL = "all-MiniLM-L6-v2" | EMBED_MODEL = "all-MiniLM-L6-v2" | ||||||
| CHROMA_CLIENT = chromadb.PersistentClient( | CHROMA_CLIENT = chromadb.PersistentClient( | ||||||
|     path=str(CHROMA_DATA_PATH), settings=Settings(allow_reset=True) |     path=CHROMA_DATA_PATH, settings=Settings(allow_reset=True) | ||||||
| ) | ) | ||||||
| CHUNK_SIZE = 1500 | CHUNK_SIZE = 1500 | ||||||
| CHUNK_OVERLAP = 100 | CHUNK_OVERLAP = 100 | ||||||
|  |  | ||||||
|  | @ -60,6 +60,6 @@ app.mount("/rag/api/v1", rag_app) | ||||||
| 
 | 
 | ||||||
| app.mount( | app.mount( | ||||||
|     "/", |     "/", | ||||||
|     SPAStaticFiles(directory=str(FRONTEND_BUILD_DIR), html=True), |     SPAStaticFiles(directory=FRONTEND_BUILD_DIR, html=True), | ||||||
|     name="spa-static-files", |     name="spa-static-files", | ||||||
| ) | ) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 lucasew
						lucasew