mirror of
https://github.com/zhayujie/bot-on-anything.git
synced 2026-03-06 16:02:18 +08:00
多通道
This commit is contained in:
20
app.py
20
app.py
@@ -3,6 +3,13 @@
|
||||
import config
|
||||
from channel import channel_factory
|
||||
from common import log
|
||||
from multiprocessing import Process
|
||||
|
||||
def startProcess(channel_type):
|
||||
# create channel
|
||||
channel = channel_factory.create_channel(channel_type)
|
||||
# startup channel
|
||||
channel.startup()
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
@@ -12,13 +19,10 @@ if __name__ == '__main__':
|
||||
model_type = config.conf().get("model").get("type")
|
||||
channel_type = config.conf().get("channel").get("type")
|
||||
|
||||
log.info("[INIT] Start up: {} on {}", model_type, channel_type)
|
||||
|
||||
# create channel
|
||||
channel = channel_factory.create_channel(channel_type)
|
||||
|
||||
# startup channel
|
||||
channel.startup()
|
||||
for type in channel_type:
|
||||
log.info("[INIT] Start up: {} on {}", model_type, type)
|
||||
p = Process(target=startProcess, args=(type))
|
||||
p.start()
|
||||
except Exception as e:
|
||||
log.error("App startup failed!")
|
||||
log.exception(e)
|
||||
log.exception(e)
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
|
||||
"channel": {
|
||||
"type": "terminal",
|
||||
"type": ["http","terminal","wechat"],
|
||||
"single_chat_prefix": ["bot", "@bot"],
|
||||
"single_chat_reply_prefix": "[bot] ",
|
||||
"group_chat_prefix": ["@bot"],
|
||||
|
||||
Reference in New Issue
Block a user