forked from open-webui/open-webui
		
	refac
This commit is contained in:
		
							parent
							
								
									1b040143eb
								
							
						
					
					
						commit
						519e27978f
					
				
					 1 changed files with 0 additions and 13 deletions
				
			
		|  | @ -81,9 +81,6 @@ async def speech(request: Request, user=Depends(get_current_user)): | ||||||
| 
 | 
 | ||||||
|     body = await request.body() |     body = await request.body() | ||||||
| 
 | 
 | ||||||
|     print(body) |  | ||||||
|     print(type(body)) |  | ||||||
| 
 |  | ||||||
|     name = hashlib.sha256(body).hexdigest() |     name = hashlib.sha256(body).hexdigest() | ||||||
| 
 | 
 | ||||||
|     SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/") |     SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/") | ||||||
|  | @ -91,8 +88,6 @@ async def speech(request: Request, user=Depends(get_current_user)): | ||||||
|     file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3") |     file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3") | ||||||
|     file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json") |     file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json") | ||||||
| 
 | 
 | ||||||
|     print(file_path) |  | ||||||
| 
 |  | ||||||
|     # Check if the file already exists in the cache |     # Check if the file already exists in the cache | ||||||
|     if file_path.is_file(): |     if file_path.is_file(): | ||||||
|         return FileResponse(file_path) |         return FileResponse(file_path) | ||||||
|  | @ -110,8 +105,6 @@ async def speech(request: Request, user=Depends(get_current_user)): | ||||||
|             stream=True, |             stream=True, | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|         print(r) |  | ||||||
| 
 |  | ||||||
|         r.raise_for_status() |         r.raise_for_status() | ||||||
| 
 | 
 | ||||||
|         # Save the streaming content to a file |         # Save the streaming content to a file | ||||||
|  | @ -125,12 +118,6 @@ async def speech(request: Request, user=Depends(get_current_user)): | ||||||
|         # Return the saved file |         # Return the saved file | ||||||
|         return FileResponse(file_path) |         return FileResponse(file_path) | ||||||
| 
 | 
 | ||||||
|         # return StreamingResponse( |  | ||||||
|         #     r.iter_content(chunk_size=8192), |  | ||||||
|         #     status_code=r.status_code, |  | ||||||
|         #     headers=dict(r.headers), |  | ||||||
|         # ) |  | ||||||
| 
 |  | ||||||
|     except Exception as e: |     except Exception as e: | ||||||
|         print(e) |         print(e) | ||||||
|         error_detail = "Ollama WebUI: Server Connection Error" |         error_detail = "Ollama WebUI: Server Connection Error" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek