push gitignore
This commit is contained in:
26
app/main.py
Normal file
26
app/main.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import logging.config
|
||||
import os
|
||||
|
||||
import litserve as ls
|
||||
from app.server.ChatbotAgent.agent_server import LCAgent
|
||||
from app.server.ChatbotAgent.chatbot_server import LCChatBot
|
||||
from logging_env import LOGGER_CONFIG_DICT
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
# 判断目录是否存在
|
||||
logs = 'logs'
|
||||
if not os.path.exists(logs):
|
||||
# 不存在则创建目录(parents=True 允许创建多级目录,exist_ok=True 避免目录已存在时报错)
|
||||
os.makedirs(logs, exist_ok=True)
|
||||
logger.info(f"目录 {logs} 创建成功")
|
||||
else:
|
||||
logger.info(f"目录 {logs} 已存在")
|
||||
|
||||
logging.config.dictConfig(LOGGER_CONFIG_DICT)
|
||||
|
||||
# STEP 2: START THE SERVER
|
||||
if __name__ == "__main__":
|
||||
chat_boot_api = LCChatBot(enable_async=True, stream=True, api_path='/api/v1/chatbot')
|
||||
agent_api = LCAgent(enable_async=True, api_path='/api/v1/agent')
|
||||
server = ls.LitServer([chat_boot_api, agent_api])
|
||||
server.run(port=8001)
|
||||
Reference in New Issue
Block a user