first commit
This commit is contained in:
82
start_dashboard.py
Normal file
82
start_dashboard.py
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
启动TSP智能助手综合管理平台
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
# 添加项目根目录到Python路径
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
def setup_logging():
|
||||
"""设置日志"""
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler('logs/dashboard.log'),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
|
||||
def main():
|
||||
"""主函数"""
|
||||
print("=" * 60)
|
||||
print("TSP智能助手 - 综合管理平台")
|
||||
print("=" * 60)
|
||||
print(f"启动时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print()
|
||||
|
||||
# 设置日志
|
||||
setup_logging()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
# 检查必要目录
|
||||
os.makedirs('logs', exist_ok=True)
|
||||
os.makedirs('data', exist_ok=True)
|
||||
|
||||
logger.info("正在启动TSP智能助手综合管理平台...")
|
||||
|
||||
# 导入并启动Flask应用
|
||||
from src.web.app import app
|
||||
|
||||
print("系统功能:")
|
||||
print(" ✓ 智能对话系统")
|
||||
print(" ✓ Agent管理")
|
||||
print(" ✓ 预警管理")
|
||||
print(" ✓ 知识库管理")
|
||||
print(" ✓ 工单管理")
|
||||
print(" ✓ 数据分析")
|
||||
print(" ✓ 系统设置")
|
||||
print()
|
||||
print("访问地址:")
|
||||
print(" 主页: http://localhost:5000")
|
||||
print(" 预警管理: http://localhost:5000/alerts")
|
||||
print(" 实时对话: http://localhost:5000/chat")
|
||||
print()
|
||||
print("按 Ctrl+C 停止服务")
|
||||
print("=" * 60)
|
||||
|
||||
# 启动Flask应用
|
||||
app.run(
|
||||
debug=False,
|
||||
host='0.0.0.0',
|
||||
port=5000,
|
||||
threaded=True
|
||||
)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n正在停止服务...")
|
||||
logger.info("用户手动停止服务")
|
||||
except Exception as e:
|
||||
print(f"启动失败: {e}")
|
||||
logger.error(f"启动失败: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user