mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-05 18:20:35 -08:00
Update backend.py
This commit is contained in:
parent
242c8281fd
commit
f17056ff71
1 changed files with 9 additions and 1 deletions
|
|
@ -9,6 +9,12 @@ try:
|
|||
has_requirements = True
|
||||
except:
|
||||
has_requirements = False
|
||||
try:
|
||||
from g4f.tools.web_search import
|
||||
search
|
||||
has_search = True
|
||||
except:
|
||||
has_search = False
|
||||
try:
|
||||
from ddgs.exceptions import DDGSException
|
||||
except ImportError:
|
||||
|
|
@ -39,7 +45,9 @@ class TestBackendApi(unittest.TestCase):
|
|||
self.assertTrue(len(response) > 0)
|
||||
|
||||
def test_search(self):
|
||||
from g4f.gui.server.internet import search
|
||||
if not has_search:
|
||||
self.skipTest("import error")
|
||||
return
|
||||
try:
|
||||
result = asyncio.run(search("Hello"))
|
||||
except DDGSException as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue