mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
Merge Pull Request #686 into master
This commit is contained in:
13
app.py
13
app.py
@@ -4,13 +4,22 @@ import os
|
||||
from config import conf, load_config
|
||||
from channel import channel_factory
|
||||
from common.log import logger
|
||||
|
||||
from plugins import *
|
||||
import signal
|
||||
import sys
|
||||
|
||||
def sigterm_handler(_signo, _stack_frame):
|
||||
conf().save_user_datas()
|
||||
sys.exit(0)
|
||||
|
||||
def run():
|
||||
try:
|
||||
# load config
|
||||
load_config()
|
||||
# ctrl + c
|
||||
signal.signal(signal.SIGINT, sigterm_handler)
|
||||
# kill signal
|
||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||
|
||||
# create channel
|
||||
channel_name=conf().get('channel_type', 'wx')
|
||||
@@ -19,7 +28,7 @@ def run():
|
||||
# os.environ['WECHATY_PUPPET_SERVICE_ENDPOINT'] = '127.0.0.1:9001'
|
||||
|
||||
channel = channel_factory.create_channel(channel_name)
|
||||
if channel_name in ['wx','wxy']:
|
||||
if channel_name in ['wx','wxy','wechatmp']:
|
||||
PluginManager().load_plugins()
|
||||
|
||||
# startup channel
|
||||
|
||||
Reference in New Issue
Block a user