Spaces:
Running
Running
Commit
Β·
1472da5
1
Parent(s):
8da73c0
updated api paths
Browse files- backend/api.py +8 -8
backend/api.py
CHANGED
@@ -83,7 +83,7 @@ def oauth_start():
|
|
83 |
# You can store `state` server-side if you validate it later
|
84 |
return RedirectResponse(url=auth_url)
|
85 |
|
86 |
-
@api.get("/
|
87 |
def oauth_callback(request: Request):
|
88 |
# Exchange code for tokens
|
89 |
full_url = str(request.url) # includes ?code=...
|
@@ -94,15 +94,15 @@ def oauth_callback(request: Request):
|
|
94 |
TOKEN_FILE.write_text(creds.to_json())
|
95 |
return PlainTextResponse("Google Calendar connected. You can close this tab.")
|
96 |
|
97 |
-
@api.get("/
|
98 |
def health():
|
99 |
return {"ok": True, "ts": datetime.now(timezone.utc).isoformat()}
|
100 |
|
101 |
-
@api.get("/
|
102 |
def list_routes():
|
103 |
return {"routes": sorted([getattr(r, "path", str(r)) for r in api.router.routes])}
|
104 |
|
105 |
-
@api.get("/
|
106 |
def debug_env():
|
107 |
return {
|
108 |
"public_base_url": os.getenv("PUBLIC_BASE_URL"),
|
@@ -114,7 +114,7 @@ def debug_env():
|
|
114 |
|
115 |
# --- GET route for EventSource (matches the React UI I gave you) ---
|
116 |
# GET
|
117 |
-
@api.get("/
|
118 |
async def chat_get(
|
119 |
request: Request,
|
120 |
message: str = Query(...),
|
@@ -143,7 +143,7 @@ async def chat_get(
|
|
143 |
return EventSourceResponse(stream())
|
144 |
|
145 |
# POST
|
146 |
-
@api.post("
|
147 |
async def chat_post(request: Request):
|
148 |
body = await request.json()
|
149 |
message = body.get("message", "")
|
@@ -168,7 +168,7 @@ UI_DIST = REPO_ROOT / "ui" / "dist"
|
|
168 |
|
169 |
RESUME_PATH = REPO_ROOT / "backend" / "assets" / "KrishnaVamsiDhulipalla.pdf"
|
170 |
|
171 |
-
@api.get("/
|
172 |
def resume_download():
|
173 |
log.info(f"π resume download hit; exists={RESUME_PATH.is_file()} path={RESUME_PATH}")
|
174 |
if not RESUME_PATH.is_file():
|
@@ -179,7 +179,7 @@ def resume_download():
|
|
179 |
filename="Krishna_Vamsi_Dhulipalla_Resume.pdf",
|
180 |
)
|
181 |
|
182 |
-
@api.get("/
|
183 |
def google_health():
|
184 |
try:
|
185 |
svc = get_gcal_service()
|
|
|
83 |
# You can store `state` server-side if you validate it later
|
84 |
return RedirectResponse(url=auth_url)
|
85 |
|
86 |
+
@api.get("/oauth/google/callback")
|
87 |
def oauth_callback(request: Request):
|
88 |
# Exchange code for tokens
|
89 |
full_url = str(request.url) # includes ?code=...
|
|
|
94 |
TOKEN_FILE.write_text(creds.to_json())
|
95 |
return PlainTextResponse("Google Calendar connected. You can close this tab.")
|
96 |
|
97 |
+
@api.get("/health")
|
98 |
def health():
|
99 |
return {"ok": True, "ts": datetime.now(timezone.utc).isoformat()}
|
100 |
|
101 |
+
@api.get("/debug/routes")
|
102 |
def list_routes():
|
103 |
return {"routes": sorted([getattr(r, "path", str(r)) for r in api.router.routes])}
|
104 |
|
105 |
+
@api.get("/debug/env")
|
106 |
def debug_env():
|
107 |
return {
|
108 |
"public_base_url": os.getenv("PUBLIC_BASE_URL"),
|
|
|
114 |
|
115 |
# --- GET route for EventSource (matches the React UI I gave you) ---
|
116 |
# GET
|
117 |
+
@api.get("/chat")
|
118 |
async def chat_get(
|
119 |
request: Request,
|
120 |
message: str = Query(...),
|
|
|
143 |
return EventSourceResponse(stream())
|
144 |
|
145 |
# POST
|
146 |
+
@api.post("/chat")
|
147 |
async def chat_post(request: Request):
|
148 |
body = await request.json()
|
149 |
message = body.get("message", "")
|
|
|
168 |
|
169 |
RESUME_PATH = REPO_ROOT / "backend" / "assets" / "KrishnaVamsiDhulipalla.pdf"
|
170 |
|
171 |
+
@api.get("/resume/download")
|
172 |
def resume_download():
|
173 |
log.info(f"π resume download hit; exists={RESUME_PATH.is_file()} path={RESUME_PATH}")
|
174 |
if not RESUME_PATH.is_file():
|
|
|
179 |
filename="Krishna_Vamsi_Dhulipalla_Resume.pdf",
|
180 |
)
|
181 |
|
182 |
+
@api.get("/health/google")
|
183 |
def google_health():
|
184 |
try:
|
185 |
svc = get_gcal_service()
|