Merge pull request #2211 from arsaboo/header

chore: add HTTP-Referer and X-Title headers for Open WebUI
This commit is contained in:
Timothy Jaeryang Baek 2024-05-13 10:58:48 -10:00 committed by GitHub
commit fabcbc300f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,7 +116,9 @@ async def speech(request: Request, user=Depends(get_verified_user)):
headers = {} headers = {}
headers["Authorization"] = f"Bearer {app.state.OPENAI_API_KEYS[idx]}" headers["Authorization"] = f"Bearer {app.state.OPENAI_API_KEYS[idx]}"
headers["Content-Type"] = "application/json" headers["Content-Type"] = "application/json"
if "openrouter.ai" in app.state.OPENAI_API_BASE_URLS[idx]:
headers['HTTP-Referer'] = "https://openwebui.com/"
headers['X-Title'] = "Open WebUI"
r = None r = None
try: try:
r = requests.post( r = requests.post(