MCPcopy
hub / github.com/LazyAGI/LazyLLM / warp_into_web

Method warp_into_web

tests/charge_tests/test_example.py:42–64  ·  view source on GitHub ↗
(self, module, file_target=None)

Source from the content-addressed store, hash-verified

40 cleanup()
41
42 def warp_into_web(self, module, file_target=None):
43 client = None
44 for _ in range(5):
45 try:
46 port = random.randint(10000, 30000)
47 web = lazyllm.WebModule(module, port=port, files_target=file_target)
48 web._work()
49 time.sleep(2)
50 except AssertionError as e:
51 # Port is occupied
52 if 'occupied' in e:
53 continue
54 else:
55 raise e
56 try:
57 client = Client(web.url, download_files=web.cach_path)
58 break
59 except httpx.ConnectError:
60 continue
61 assert client, 'Unable to create client'
62 self.webs.append(web)
63 self.clients.append(client)
64 return web, client
65
66 def test_chat(self):
67 from examples.chatbot_online import chat

Callers 4

test_chatMethod · 0.95
test_vl_chatMethod · 0.95
test_storyMethod · 0.95
test_ragMethod · 0.95

Calls 2

_workMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected