Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,11 @@ from openai import AsyncOpenAI
|
|
5 |
|
6 |
app = FastAPI()
|
7 |
|
|
|
|
|
|
|
8 |
async def generate_ai_response(prompt: str):
|
9 |
-
# Configuration for unofficial GitHub AI endpoint
|
10 |
global token
|
11 |
-
token = os.getenv("GITHUB_TOKEN")
|
12 |
if not token:
|
13 |
raise HTTPException(status_code=500, detail="GitHub token not configured")
|
14 |
|
@@ -75,7 +76,7 @@ async def generate_response(prompt: str):
|
|
75 |
media_type="text/event-stream"
|
76 |
)
|
77 |
|
78 |
-
@app.get("/get-token")
|
79 |
async def get_token():
|
80 |
global token
|
81 |
if not token:
|
|
|
5 |
|
6 |
app = FastAPI()
|
7 |
|
8 |
+
# Initialize global token
|
9 |
+
token = os.getenv("GITHUB_TOKEN")
|
10 |
+
|
11 |
async def generate_ai_response(prompt: str):
|
|
|
12 |
global token
|
|
|
13 |
if not token:
|
14 |
raise HTTPException(status_code=500, detail="GitHub token not configured")
|
15 |
|
|
|
76 |
media_type="text/event-stream"
|
77 |
)
|
78 |
|
79 |
+
@app.get("/get-token")
|
80 |
async def get_token():
|
81 |
global token
|
82 |
if not token:
|