Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ app = FastAPI()
|
|
7 |
|
8 |
async def generate_ai_response(prompt: str):
|
9 |
# Configuration for unofficial GitHub AI endpoint
|
|
|
10 |
token = os.getenv("GITHUB_TOKEN")
|
11 |
if not token:
|
12 |
raise HTTPException(status_code=500, detail="GitHub token not configured")
|
@@ -41,10 +42,7 @@ async def generate_response(prompt: str):
|
|
41 |
if not prompt:
|
42 |
raise HTTPException(status_code=400, detail="Prompt cannot be empty")
|
43 |
|
44 |
-
return
|
45 |
-
generate_ai_response(prompt),
|
46 |
-
media_type="text/event-stream"
|
47 |
-
)
|
48 |
|
49 |
def get_app():
|
50 |
return app
|
|
|
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")
|
|
|
42 |
if not prompt:
|
43 |
raise HTTPException(status_code=400, detail="Prompt cannot be empty")
|
44 |
|
45 |
+
return token
|
|
|
|
|
|
|
46 |
|
47 |
def get_app():
|
48 |
return app
|