浏览代码

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

tags/0.12.1
SebastjanPrachovskij 11 个月前
父节点
当前提交
17ee731546
没有帐户链接到提交者的电子邮件

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google.py 查看文件

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

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

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google_jobs.py 查看文件

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

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

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/google_news.py 查看文件

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

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

+ 1
- 1
api/core/tools/provider/builtin/searchapi/tools/youtube_transcripts.py 查看文件

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

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

正在加载...
取消
保存