mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-22 13:42:51 +08:00
update chat engine #4335
Former-commit-id: 7857c0990b37d37e58691257eea13fe5e244aaa0
This commit is contained in:
parent
9e0ec3831f
commit
3d85217464
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
from .base_engine import BaseEngine, Response
|
||||
|
||||
|
||||
def _start_background_loop(loop: asyncio.AbstractEventLoop) -> None:
|
||||
def _start_background_loop(loop: "asyncio.AbstractEventLoop") -> None:
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_forever()
|
||||
|
||||
@ -49,7 +49,8 @@ class ChatModel:
|
||||
self._loop = asyncio.new_event_loop()
|
||||
self._thread = Thread(target=_start_background_loop, args=(self._loop,), daemon=True)
|
||||
self._thread.start()
|
||||
asyncio.run_coroutine_threadsafe(self.engine.start(), self._loop)
|
||||
task = asyncio.run_coroutine_threadsafe(self.engine.start(), self._loop)
|
||||
task.result()
|
||||
|
||||
def chat(
|
||||
self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user