Enable multiple llms
This commit is contained in:
8
sia/web/util.py
Normal file
8
sia/web/util.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import asyncio
|
||||
|
||||
def wrap_async(coro_func):
|
||||
"""Wraps an async callback to be safely called from another thread."""
|
||||
loop = asyncio.get_event_loop()
|
||||
def wrapper(*args, **kwargs):
|
||||
loop.call_soon_threadsafe(lambda: asyncio.create_task(coro_func(*args, **kwargs)))
|
||||
return wrapper
|
||||
Reference in New Issue
Block a user