mirror of
https://github.com/zhayujie/bot-on-anything.git
synced 2026-01-19 09:41:07 +08:00
兼容字符串格式的type
This commit is contained in:
9
app.py
9
app.py
@@ -6,6 +6,7 @@ from common import log
|
||||
import os
|
||||
from multiprocessing import Pool
|
||||
|
||||
|
||||
def startProcess(channel_type):
|
||||
# load config
|
||||
config.load_config()
|
||||
@@ -14,9 +15,11 @@ def startProcess(channel_type):
|
||||
# startup channel
|
||||
channel.startup()
|
||||
|
||||
|
||||
def wrapper(channel_type):
|
||||
startProcess(channel_type)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
# load config
|
||||
@@ -29,10 +32,12 @@ if __name__ == '__main__':
|
||||
|
||||
model_type = config.conf().get("model").get("type")
|
||||
channel_type = config.conf().get("channel").get("type")
|
||||
if isinstance(channel_type, list) == False: # 兼容字符串格式的type
|
||||
channel_type = [channel_type]
|
||||
|
||||
# 使用主进程启动终端通道
|
||||
if "terminal" in channel_type:
|
||||
index=channel_type.index("terminal")
|
||||
index = channel_type.index("terminal")
|
||||
terminal = channel_type.pop(index)
|
||||
else:
|
||||
terminal = None
|
||||
@@ -50,4 +55,4 @@ if __name__ == '__main__':
|
||||
pool.join()
|
||||
except Exception as e:
|
||||
log.error("App startup failed!")
|
||||
log.exception(e)
|
||||
log.exception(e)
|
||||
|
||||
Reference in New Issue
Block a user