mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 07:16:04 +00:00
feat: 持久化和 web 接口基础架构
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import traceback
|
||||
import asyncio
|
||||
|
||||
from . import app
|
||||
from ..audit import identifier
|
||||
@@ -19,13 +20,15 @@ stage_order = [
|
||||
]
|
||||
|
||||
|
||||
async def make_app() -> app.Application:
|
||||
async def make_app(loop: asyncio.AbstractEventLoop) -> app.Application:
|
||||
|
||||
# 生成标识符
|
||||
identifier.init()
|
||||
|
||||
ap = app.Application()
|
||||
|
||||
ap.event_loop = loop
|
||||
|
||||
# 执行启动阶段
|
||||
for stage_name in stage_order:
|
||||
stage_cls = stage.preregistered_stages[stage_name]
|
||||
@@ -38,9 +41,9 @@ async def make_app() -> app.Application:
|
||||
return ap
|
||||
|
||||
|
||||
async def main():
|
||||
async def main(loop: asyncio.AbstractEventLoop):
|
||||
try:
|
||||
app_inst = await make_app()
|
||||
app_inst = await make_app(loop)
|
||||
await app_inst.run()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user