forked from zhayujie/bot-on-anything
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
30 lines (23 loc) · 802 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# encoding:utf-8
import config
from channel import channel_factory
from common import log
import os
if __name__ == '__main__':
try:
# load config
config.load_config()
proxy = config.conf().get("model").get("openai").get("proxy")
if proxy:
os.environ['http_proxy'] = proxy
os.environ['https_proxy'] = proxy
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()
except Exception as e:
log.error("App startup failed!")
log.exception(e)