mirror of
https://github.com/xtekky/gpt4free.git
synced 2026-01-02 23:33:43 -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
|
has_requirements = True
|
||||||
except:
|
except:
|
||||||
has_requirements = False
|
has_requirements = False
|
||||||
|
try:
|
||||||
|
from g4f.tools.web_search import
|
||||||
|
search
|
||||||
|
has_search = True
|
||||||
|
except:
|
||||||
|
has_search = False
|
||||||
try:
|
try:
|
||||||
from ddgs.exceptions import DDGSException
|
from ddgs.exceptions import DDGSException
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -39,7 +45,9 @@ class TestBackendApi(unittest.TestCase):
|
||||||
self.assertTrue(len(response) > 0)
|
self.assertTrue(len(response) > 0)
|
||||||
|
|
||||||
def test_search(self):
|
def test_search(self):
|
||||||
from g4f.gui.server.internet import search
|
if not has_search:
|
||||||
|
self.skipTest("import error")
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
result = asyncio.run(search("Hello"))
|
result = asyncio.run(search("Hello"))
|
||||||
except DDGSException as e:
|
except DDGSException as e:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue