XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix ddgs search

120eef46
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +4 -3
Modified g4f/tools/web_search.py +4 -3
@@ -10,7 +10,8 @@ import asyncio
10 10
11 11 # Optional dependencies using the new 'ddgs' package name
12 12 try:
13 from ddgs import DDGS, DDGSError
13 from ddgs import DDGS
14 from ddgs.exceptions import DDGSException
14 15 from bs4 import BeautifulSoup
15 16 has_requirements = True
16 17 except ImportError:
@@ -312,8 +313,8 @@ def get_search_message(prompt: str, raise_search_exceptions: bool = False, **kwa
312 313 result, _ = asyncio.run(do_search(prompt, **kwargs))
313 314 return result
314 315 # Use the new DDGSError exception
315 except (DDGSError, MissingRequirementsError) as e:
316 except (DDGSException, MissingRequirementsError) as e:
316 317 if raise_search_exceptions:
317 318 raise e
318 debug.error(f"Couldn't do web search: {e.__class__.__name__}: {e}")
319 debug.error(f"Couldn't do web search:", e)
319 320 return prompt