Pulastya B commited on
Commit
d75ca00
·
1 Parent(s): c387723

Directly making API calls to the server -V2

Browse files
Files changed (1) hide show
  1. src/api/app.py +5 -5
src/api/app.py CHANGED
@@ -1404,21 +1404,21 @@ async def export_to_huggingface(request: HuggingFaceExportRequest):
1404
 
1405
  supabase: Client = create_client(supabase_url, supabase_key)
1406
 
1407
- # Fetch user's HuggingFace token from profiles
1408
- result = supabase.table("user_profiles").select(
1409
  "huggingface_token, huggingface_username"
1410
  ).eq("user_id", request.user_id).single().execute()
1411
 
1412
  if not result.data:
1413
- raise HTTPException(status_code=404, detail="User profile not found")
1414
 
1415
  hf_token = result.data.get("huggingface_token")
1416
  hf_username = result.data.get("huggingface_username")
1417
 
1418
- if not hf_token or not hf_username:
1419
  raise HTTPException(
1420
  status_code=400,
1421
- detail="HuggingFace not connected. Please connect in Settings."
1422
  )
1423
 
1424
  # Import HuggingFace storage service
 
1404
 
1405
  supabase: Client = create_client(supabase_url, supabase_key)
1406
 
1407
+ # Fetch user's HuggingFace token from hf_tokens table (not user_profiles)
1408
+ result = supabase.table("hf_tokens").select(
1409
  "huggingface_token, huggingface_username"
1410
  ).eq("user_id", request.user_id).single().execute()
1411
 
1412
  if not result.data:
1413
+ raise HTTPException(status_code=404, detail="HuggingFace not connected. Please connect in Settings first.")
1414
 
1415
  hf_token = result.data.get("huggingface_token")
1416
  hf_username = result.data.get("huggingface_username")
1417
 
1418
+ if not hf_token:
1419
  raise HTTPException(
1420
  status_code=400,
1421
+ detail="HuggingFace token not found. Please connect in Settings."
1422
  )
1423
 
1424
  # Import HuggingFace storage service