Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ from fastapi import FastAPI, WebSocket
|
|
2 |
from fastapi.responses import HTMLResponse
|
3 |
import uvicorn
|
4 |
import json
|
5 |
-
from fastapi import Request, HTTPException
|
6 |
from pydantic import BaseModel
|
7 |
from typing import List, Optional
|
8 |
import uuid
|
@@ -361,7 +361,7 @@ async def get_proxy():
|
|
361 |
@app.post("/v1/chat/completions", response_model=ChatCompletionResponse)
|
362 |
async def chat_completions(
|
363 |
request: ChatCompletionRequest,
|
364 |
-
authorization: str = Header(None) # Add Authorization header
|
365 |
):
|
366 |
# Extract and validate API key
|
367 |
if not authorization or not authorization.startswith("Bearer "):
|
|
|
2 |
from fastapi.responses import HTMLResponse
|
3 |
import uvicorn
|
4 |
import json
|
5 |
+
from fastapi import Request, HTTPException, Header, Depends
|
6 |
from pydantic import BaseModel
|
7 |
from typing import List, Optional
|
8 |
import uuid
|
|
|
361 |
@app.post("/v1/chat/completions", response_model=ChatCompletionResponse)
|
362 |
async def chat_completions(
|
363 |
request: ChatCompletionRequest,
|
364 |
+
authorization: str | None = Header(None) # Add Authorization header
|
365 |
):
|
366 |
# Extract and validate API key
|
367 |
if not authorization or not authorization.startswith("Bearer "):
|