pvanand commited on
Commit
74c8cee
·
verified ·
1 Parent(s): 70650cf

Update routers/scraping_router.py

Browse files
Files changed (1) hide show
  1. routers/scraping_router.py +2 -2
routers/scraping_router.py CHANGED
@@ -32,7 +32,7 @@ async def generate_cheerio_script(
32
  try:
33
  system_prompt = f"""return cheerio script to extract {request.user_input} from the following html,
34
  enclose the cheerio script in <cheerio_script> .. </cheerio_script> format, {request.html}"""
35
-
36
  response = ai_client.chat(
37
  prompt=request.user_input,
38
  system_message=system_prompt,
@@ -50,7 +50,7 @@ async def generate_cheerio_script(
50
  else:
51
  raise HTTPException(
52
  status_code=422,
53
- detail=f"No valid Cheerio script found in the response: {response}" if response
54
  )
55
 
56
  except Exception as e:
 
32
  try:
33
  system_prompt = f"""return cheerio script to extract {request.user_input} from the following html,
34
  enclose the cheerio script in <cheerio_script> .. </cheerio_script> format, {request.html}"""
35
+ response = ""
36
  response = ai_client.chat(
37
  prompt=request.user_input,
38
  system_message=system_prompt,
 
50
  else:
51
  raise HTTPException(
52
  status_code=422,
53
+ detail=f"No valid Cheerio script found in the response: {response}"
54
  )
55
 
56
  except Exception as e: