mirror of
				https://github.com/Yidadaa/ChatGPT-Next-Web.git
				synced 2025-11-04 08:26:12 +08:00 
			
		
		
		
	Update proxy.ts
Update proxy.ts
This commit is contained in:
		@@ -34,7 +34,14 @@ export async function handle(
 | 
				
			|||||||
    }),
 | 
					    }),
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
  // if dalle3 use openai api key
 | 
					  // if dalle3 use openai api key
 | 
				
			||||||
  if (req.headers.get("x-base-url")?.includes("openai")) {
 | 
					    const baseUrl = req.headers.get("x-base-url");
 | 
				
			||||||
 | 
					    if (baseUrl?.includes("api.openai.com")) {
 | 
				
			||||||
 | 
					      if (!serverConfig.apiKey) {
 | 
				
			||||||
 | 
					        return NextResponse.json(
 | 
				
			||||||
 | 
					          { error: "OpenAI API key not configured" },
 | 
				
			||||||
 | 
					          { status: 500 },
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      headers.set("Authorization", `Bearer ${serverConfig.apiKey}`);
 | 
					      headers.set("Authorization", `Bearer ${serverConfig.apiKey}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user