mirror of
				https://github.com/open-webui/open-webui
				synced 2025-06-26 18:26:48 +00:00 
			
		
		
		
	feat: pipeline integration
This commit is contained in:
		
							parent
							
								
									798e6e4128
								
							
						
					
					
						commit
						af022947be
					
				@ -306,6 +306,7 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
 | 
			
		||||
@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE"])
 | 
			
		||||
async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
 | 
			
		||||
    idx = 0
 | 
			
		||||
    pipeline = False
 | 
			
		||||
 | 
			
		||||
    body = await request.body()
 | 
			
		||||
    # TODO: Remove below after gpt-4-vision fix from Open AI
 | 
			
		||||
@ -314,7 +315,15 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
 | 
			
		||||
        body = body.decode("utf-8")
 | 
			
		||||
        body = json.loads(body)
 | 
			
		||||
 | 
			
		||||
        idx = app.state.MODELS[body.get("model")]["urlIdx"]
 | 
			
		||||
        model = app.state.MODELS[body.get("model")]
 | 
			
		||||
 | 
			
		||||
        idx = model["urlIdx"]
 | 
			
		||||
 | 
			
		||||
        if "pipeline" in model:
 | 
			
		||||
            pipeline = model.get("pipeline")
 | 
			
		||||
 | 
			
		||||
        if pipeline:
 | 
			
		||||
            body["user"] = {"name": user.name, "id": user.id}
 | 
			
		||||
 | 
			
		||||
        # Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000
 | 
			
		||||
        # This is a workaround until OpenAI fixes the issue with this model
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user