mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
28 lines
617 B
Python
28 lines
617 B
Python
from __future__ import annotations
|
|
|
|
from . import runner
|
|
from ..core import app
|
|
|
|
from .runners import localagent
|
|
|
|
|
|
class RunnerManager:
|
|
|
|
ap: app.Application
|
|
|
|
using_runner: runner.RequestRunner
|
|
|
|
def __init__(self, ap: app.Application):
|
|
self.ap = ap
|
|
|
|
async def initialize(self):
|
|
|
|
for r in runner.preregistered_runners:
|
|
if r.name == self.ap.provider_cfg.data['runner']:
|
|
self.using_runner = r(self.ap)
|
|
await self.using_runner.initialize()
|
|
break
|
|
|
|
def get_runner(self) -> runner.RequestRunner:
|
|
return self.using_runner
|