Bläddra i källkod

SearchApi - Return error message instead of raising a ValueError (#11083)

tags/0.12.1
SebastjanPrachovskij 11 månader sedan
förälder
incheckning
17ee731546
Inget konto är kopplat till bidragsgivarens mejladress

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google.py Visa fil

def _process_response(res: dict, type: str) -> str: def _process_response(res: dict, type: str) -> str:
"""Process response from SearchAPI.""" """Process response from SearchAPI."""
if "error" in res: if "error" in res:
raise ValueError(f"Got error from SearchApi: {res['error']}")
return res["error"]


toret = "" toret = ""
if type == "text": if type == "text":

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google_jobs.py Visa fil

def _process_response(res: dict, type: str) -> str: def _process_response(res: dict, type: str) -> str:
"""Process response from SearchAPI.""" """Process response from SearchAPI."""
if "error" in res: if "error" in res:
raise ValueError(f"Got error from SearchApi: {res['error']}")
return res["error"]


toret = "" toret = ""
if type == "text": if type == "text":

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google_news.py Visa fil

def _process_response(res: dict, type: str) -> str: def _process_response(res: dict, type: str) -> str:
"""Process response from SearchAPI.""" """Process response from SearchAPI."""
if "error" in res: if "error" in res:
raise ValueError(f"Got error from SearchApi: {res['error']}")
return res["error"]


toret = "" toret = ""
if type == "text": if type == "text":

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/youtube_transcripts.py Visa fil

def _process_response(res: dict) -> str: def _process_response(res: dict) -> str:
"""Process response from SearchAPI.""" """Process response from SearchAPI."""
if "error" in res: if "error" in res:
raise ValueError(f"Got error from SearchApi: {res['error']}")
return res["error"]


toret = "" toret = ""
if "transcripts" in res and "text" in res["transcripts"][0]: if "transcripts" in res and "text" in res["transcripts"][0]:

Laddar…
Avbryt
Spara