diff --git a/logs/dashboard.log b/logs/dashboard.log index c900809..4aa6d25 100644 --- a/logs/dashboard.log +++ b/logs/dashboard.log @@ -2408,3 +2408,704 @@ WHERE knowledge_entries.is_active = true AND knowledge_entries.is_verified = tru 2025-09-08 15:24:31,102 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:24:31] "GET /api/health HTTP/1.1" 200 - 2025-09-08 15:25:31,094 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:25:31] "GET /api/health HTTP/1.1" 200 - 2025-09-08 15:26:31,092 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:26:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:27:31,139 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:27:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:28:31,130 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:28:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:29:31,187 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:29:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:30:31,159 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:30:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:31:31,136 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:31:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:32:31,146 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:32:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:33:31,133 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:33:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:35:40,176 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:35:40] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:36:31,097 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:36:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:37:31,132 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:37:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:38:31,102 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:38:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:39:31,100 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:39:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:40:31,116 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:40:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:41:31,099 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:41:31] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:43:00,051 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:43:00] "GET /api/health HTTP/1.1" 200 - +2025-09-08 15:43:31,110 - werkzeug - INFO - 127.0.0.1 - - [08/Sep/2025 15:43:31] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:01,003 - __main__ - INFO - 正在启动TSP智能助手综合管理平台... +2025-09-10 22:36:02,691 - src.core.database - INFO - 数据库初始化成功 +2025-09-10 22:36:05,024 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,034 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,035 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:36:05,044 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,051 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,052 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:36:05,052 - src.agent.tool_manager - INFO - 注册工具: search_knowledge +2025-09-10 22:36:05,052 - src.agent.tool_manager - INFO - 注册工具: create_work_order +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: update_work_order +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: generate_response +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: analyze_data +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: send_notification +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: schedule_task +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: web_search +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: file_operation +2025-09-10 22:36:05,053 - src.agent.tool_manager - INFO - 注册工具: database_query +2025-09-10 22:36:05,054 - src.agent.tool_manager - INFO - 已注册 10 个默认工具 +2025-09-10 22:36:05,054 - src.agent.agent_core - INFO - Agent核心初始化完成 +2025-09-10 22:36:05,054 - src.agent_assistant - INFO - TSP Agent助手初始化完成 +2025-09-10 22:36:05,063 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,142 - werkzeug - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://192.168.26.238:5000 +2025-09-10 22:36:05,143 - werkzeug - INFO - Press CTRL+C to quit +2025-09-10 22:36:05,179 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:36:05,183 - src.web.websocket_server - INFO - 启动WebSocket服务器: ws://localhost:8765 +2025-09-10 22:36:05,188 - websockets.server - INFO - server listening on [::1]:8765 +2025-09-10 22:36:05,189 - websockets.server - INFO - server listening on 127.0.0.1:8765 +2025-09-10 22:36:11,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:11] "GET / HTTP/1.1" 200 - +2025-09-10 22:36:11,437 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:11] "GET /static/js/dashboard.js HTTP/1.1" 200 - +2025-09-10 22:36:13,910 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:14,178 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:36:14,179 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:36:14,194 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /api/system/info HTTP/1.1" 200 - +2025-09-10 22:36:14,214 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:36:14,214 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:36:14,274 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:14] "GET /favicon.ico HTTP/1.1" 404 - +2025-09-10 22:36:16,244 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:16] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:36:17,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:17] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:36:18,891 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:18] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:19,231 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:19] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:23,885 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:23] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:24,491 - src.knowledge_base.knowledge_manager - INFO - 知识库条目取消验证成功: 61 +2025-09-10 22:36:24,492 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:24] "POST /api/knowledge/unverify/61 HTTP/1.1" 200 - +2025-09-10 22:36:24,721 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:24] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:25,932 - src.knowledge_base.knowledge_manager - INFO - 知识库条目验证成功: 61 +2025-09-10 22:36:25,933 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:25] "POST /api/knowledge/verify/61 HTTP/1.1" 200 - +2025-09-10 22:36:26,245 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:26] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:27,241 - src.knowledge_base.knowledge_manager - INFO - 知识库条目验证成功: 51 +2025-09-10 22:36:27,242 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:27] "POST /api/knowledge/verify/51 HTTP/1.1" 200 - +2025-09-10 22:36:27,565 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:27] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:28,405 - src.knowledge_base.knowledge_manager - INFO - 知识库条目验证成功: 52 +2025-09-10 22:36:28,406 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:28] "POST /api/knowledge/verify/52 HTTP/1.1" 200 - +2025-09-10 22:36:28,726 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:28] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:29,000 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:29,824 - src.knowledge_base.knowledge_manager - INFO - 知识库条目验证成功: 53 +2025-09-10 22:36:29,825 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:29] "POST /api/knowledge/verify/53 HTTP/1.1" 200 - +2025-09-10 22:36:30,137 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:30] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:36:31,290 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:31] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:36:33,343 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:33] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:36:33,886 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:39,194 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:42,193 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:42] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:36:44,196 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:47,972 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:47] "GET /api/analytics HTTP/1.1" 200 - +2025-09-10 22:36:49,206 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:50,882 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:50] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:36:53,493 - src.analytics.monitor_service - INFO - 监控服务已启动 +2025-09-10 22:36:53,494 - src.main - INFO - 监控服务已启动 +2025-09-10 22:36:53,495 - src.agent.auto_monitor - INFO - 自动监控循环已启动 +2025-09-10 22:36:53,495 - src.agent.auto_monitor - INFO - 自动监控服务已启动 +2025-09-10 22:36:53,496 - src.agent.auto_monitor - INFO - 执行第 1 次自动监控检查 +2025-09-10 22:36:53,496 - src.agent_assistant - INFO - 主动监控已启动 +2025-09-10 22:36:53,497 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:53] "POST /api/agent/monitoring/start HTTP/1.1" 200 - +2025-09-10 22:36:53,535 - src.agent.auto_monitor - INFO - 触发主动行动: alert_overflow - 活跃预警数量过多: 17 +2025-09-10 22:36:53,536 - src.agent.auto_monitor - INFO - 主动行动记录: {"timestamp": "2025-09-10T22:36:53.536449", "action_type": "alert_overflow", "priority": "high", "description": "活跃预警数量过多: 17", "action": "建议立即处理预警", "data": {"alert_count": 17}} +2025-09-10 22:36:53,537 - src.agent.auto_monitor - INFO - 处理预警溢出 +2025-09-10 22:36:53,537 - src.agent.auto_monitor - ERROR - 检查工单积压失败: 'TSPAgentAssistant' object has no attribute 'get_workorders' +2025-09-10 22:36:53,552 - src.analytics.monitor_service - INFO - 触发 3 个预警 +2025-09-10 22:36:53,552 - src.analytics.monitor_service - WARNING - 预警触发: 用户满意度较低: 0.00 (阈值: 0.6) +2025-09-10 22:36:53,552 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '用户满意度较低: 0.00 (阈值: 0.6)', 'timestamp': '2025-09-10T22:36:53.511361', 'rule_name': '满意度预警'} +2025-09-10 22:36:53,552 - src.analytics.monitor_service - WARNING - 警告预警: 用户满意度较低: 0.00 (阈值: 0.6) +2025-09-10 22:36:53,553 - src.analytics.monitor_service - WARNING - 预警触发: 知识库命中率较低: 0.00 (阈值: 0.5) +2025-09-10 22:36:53,553 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '知识库命中率较低: 0.00 (阈值: 0.5)', 'timestamp': '2025-09-10T22:36:53.530414', 'rule_name': '知识库命中率预警'} +2025-09-10 22:36:53,553 - src.analytics.monitor_service - WARNING - 警告预警: 知识库命中率较低: 0.00 (阈值: 0.5) +2025-09-10 22:36:53,553 - src.analytics.monitor_service - WARNING - 预警触发: 系统内存使用率过高: 84.1% (阈值: 80.0%) +2025-09-10 22:36:53,553 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '系统内存使用率过高: 84.1% (阈值: 80.0%)', 'timestamp': '2025-09-10T22:36:53.547594', 'rule_name': '内存使用预警'} +2025-09-10 22:36:53,553 - src.analytics.monitor_service - WARNING - 警告预警: 系统内存使用率过高: 84.1% (阈值: 80.0%) +2025-09-10 22:36:53,883 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:53] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:36:54,183 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:54] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:36:56,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:56] "POST /api/agent/intelligent-analysis HTTP/1.1" 200 - +2025-09-10 22:36:56,674 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:56] "POST /api/agent/intelligent-analysis HTTP/1.1" 200 - +2025-09-10 22:36:57,922 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:57] "GET /api/settings HTTP/1.1" 200 - +2025-09-10 22:36:59,189 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:36:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:01,829 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:01] "GET /api/analytics HTTP/1.1" 200 - +2025-09-10 22:37:04,190 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:06,201 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:06] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:37:09,191 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:13,890 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:19,202 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:24,094 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:29,212 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:33,893 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:39,396 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:44,082 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:49,393 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:54,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:54] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:37:59,400 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:37:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:00,132 - websockets.server - INFO - connection rejected (426 Upgrade Required) +2025-09-10 22:38:00,134 - websockets.server - INFO - connection closed +2025-09-10 22:38:00,275 - websockets.server - INFO - connection rejected (426 Upgrade Required) +2025-09-10 22:38:00,278 - websockets.server - INFO - connection closed +2025-09-10 22:38:04,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:09,402 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:14,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:19,407 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:24,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:29,408 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:34,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:39,208 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:44,132 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:49,414 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:54,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:54] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:38:59,406 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:38:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:04,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:09,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:14,092 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:19,399 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:24,094 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:29,416 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:34,095 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:39:39,412 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:39:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:00,101 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:15,161 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:15] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:16,829 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:16] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:40:18,698 - src.dialogue.realtime_chat - INFO - 创建新会话: session_user_001_1757515218 +2025-09-10 22:40:18,701 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:18] "POST /api/chat/session HTTP/1.1" 200 - +2025-09-10 22:40:18,978 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:18] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:23,139 - src.core.llm_client - INFO - API请求成功 +2025-09-10 22:40:23,153 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:23] "POST /api/chat/message HTTP/1.1" 200 - +2025-09-10 22:40:24,227 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:27,306 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:27] "GET /chat HTTP/1.1" 200 - +2025-09-10 22:40:27,662 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:27] "GET /static/js/chat.js HTTP/1.1" 304 - +2025-09-10 22:40:28,607 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:28] "GET /chat HTTP/1.1" 200 - +2025-09-10 22:40:28,707 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:28] "GET /static/js/chat.js HTTP/1.1" 304 - +2025-09-10 22:40:29,107 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:29,939 - websockets.server - INFO - connection open +2025-09-10 22:40:29,940 - src.web.websocket_server - INFO - 客户端连接: ('::1', 13772, 0, 0) +2025-09-10 22:40:29,950 - src.dialogue.realtime_chat - INFO - 创建新会话: session_user_001_1757515229 +2025-09-10 22:40:34,452 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:36,817 - src.core.llm_client - INFO - API请求成功 +2025-09-10 22:40:39,107 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:44,499 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:49,125 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:53,654 - src.analytics.monitor_service - INFO - 触发 1 个预警 +2025-09-10 22:40:53,654 - src.analytics.monitor_service - WARNING - 预警触发: 用户对话中断率过高: 0.50 (阈值: 0.3) +2025-09-10 22:40:53,655 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '用户对话中断率过高: 0.50 (阈值: 0.3)', 'timestamp': '2025-09-10T22:40:53.647669', 'rule_name': '对话中断预警'} +2025-09-10 22:40:53,655 - src.analytics.monitor_service - WARNING - 警告预警: 用户对话中断率过高: 0.50 (阈值: 0.3) +2025-09-10 22:40:54,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:54] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:40:59,100 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:40:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:04,419 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:09,114 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:14,426 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:19,097 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:24,420 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:24,657 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:24] "GET / HTTP/1.1" 200 - +2025-09-10 22:41:24,820 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:24] "GET /static/js/dashboard.js HTTP/1.1" 304 - +2025-09-10 22:41:25,212 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:25,489 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:41:25,496 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:41:25,514 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/system/info HTTP/1.1" 200 - +2025-09-10 22:41:25,525 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:41:25,544 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:25] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:41:27,055 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:27] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:41:27,845 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:27] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:41:30,494 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:30] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:30,803 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:30] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:41:33,174 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:33] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:41:35,180 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:35] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:36,624 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:36] "GET /api/workorders?status=open HTTP/1.1" 200 - +2025-09-10 22:41:40,186 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:40] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:40,467 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:40] "GET /api/workorders?status=open HTTP/1.1" 200 - +2025-09-10 22:41:46,429 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:46] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:51,114 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:51] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:41:53,547 - src.agent.auto_monitor - INFO - 执行第 2 次自动监控检查 +2025-09-10 22:41:53,562 - src.agent.auto_monitor - INFO - 触发主动行动: alert_overflow - 活跃预警数量过多: 23 +2025-09-10 22:41:53,563 - src.agent.auto_monitor - INFO - 主动行动记录: {"timestamp": "2025-09-10T22:41:53.563228", "action_type": "alert_overflow", "priority": "high", "description": "活跃预警数量过多: 23", "action": "建议立即处理预警", "data": {"alert_count": 23}} +2025-09-10 22:41:53,563 - src.agent.auto_monitor - INFO - 处理预警溢出 +2025-09-10 22:41:53,563 - src.agent.auto_monitor - ERROR - 检查工单积压失败: 'TSPAgentAssistant' object has no attribute 'get_workorders' +2025-09-10 22:41:56,425 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:41:56] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:00,154 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:01,436 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:01] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:03,671 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:03] "GET /alerts HTTP/1.1" 200 - +2025-09-10 22:42:04,020 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /static/css/style.css HTTP/1.1" 200 - +2025-09-10 22:42:04,268 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /static/js/app.js HTTP/1.1" 200 - +2025-09-10 22:42:04,686 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:04,694 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /api/rules HTTP/1.1" 200 - +2025-09-10 22:42:04,708 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:04,778 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:04] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:05,290 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:05] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:09,677 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:09,698 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:09] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:11,120 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:11] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:14,696 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:14] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:14,702 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:14] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:14,704 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:16,132 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:16] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:18,012 - src.analytics.monitor_service - INFO - 监控服务已启动 +2025-09-10 22:42:18,014 - src.main - INFO - 监控服务已启动 +2025-09-10 22:42:18,015 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:18] "POST /api/monitor/start HTTP/1.1" 200 - +2025-09-10 22:42:18,120 - src.analytics.monitor_service - INFO - 触发 4 个预警 +2025-09-10 22:42:18,120 - src.analytics.monitor_service - WARNING - 预警触发: 用户满意度较低: 0.00 (阈值: 0.6) +2025-09-10 22:42:18,120 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '用户满意度较低: 0.00 (阈值: 0.6)', 'timestamp': '2025-09-10T22:42:18.022114', 'rule_name': '满意度预警'} +2025-09-10 22:42:18,120 - src.analytics.monitor_service - WARNING - 警告预警: 用户满意度较低: 0.00 (阈值: 0.6) +2025-09-10 22:42:18,121 - src.analytics.monitor_service - WARNING - 预警触发: 知识库命中率较低: 0.00 (阈值: 0.5) +2025-09-10 22:42:18,122 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '知识库命中率较低: 0.00 (阈值: 0.5)', 'timestamp': '2025-09-10T22:42:18.067562', 'rule_name': '知识库命中率预警'} +2025-09-10 22:42:18,123 - src.analytics.monitor_service - WARNING - 警告预警: 知识库命中率较低: 0.00 (阈值: 0.5) +2025-09-10 22:42:18,124 - src.analytics.monitor_service - WARNING - 预警触发: 系统内存使用率过高: 84.8% (阈值: 80.0%) +2025-09-10 22:42:18,126 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '系统内存使用率过高: 84.8% (阈值: 80.0%)', 'timestamp': '2025-09-10T22:42:18.101003', 'rule_name': '内存使用预警'} +2025-09-10 22:42:18,126 - src.analytics.monitor_service - WARNING - 警告预警: 系统内存使用率过高: 84.8% (阈值: 80.0%) +2025-09-10 22:42:18,126 - src.analytics.monitor_service - WARNING - 预警触发: 用户对话中断率过高: 0.50 (阈值: 0.3) +2025-09-10 22:42:18,127 - src.analytics.monitor_service - INFO - 发送通知: {'level': '警告', 'message': '用户对话中断率过高: 0.50 (阈值: 0.3)', 'timestamp': '2025-09-10T22:42:18.113652', 'rule_name': '对话中断预警'} +2025-09-10 22:42:18,128 - src.analytics.monitor_service - WARNING - 警告预警: 用户对话中断率过高: 0.50 (阈值: 0.3) +2025-09-10 22:42:18,301 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:18] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:19,365 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:19,707 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:19] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:21,434 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:21] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:24,428 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:24,666 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:24] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:24,742 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:24] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:26,444 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:26] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:29,367 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:29,756 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:29] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:30,765 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:30] "POST /api/alerts/31/resolve HTTP/1.1" 200 - +2025-09-10 22:42:31,001 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:31] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:31,128 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:31] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:34,349 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:34] "POST /api/alerts/33/resolve HTTP/1.1" 200 - +2025-09-10 22:42:34,620 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:34,655 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:34] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:34,680 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:34] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:34,698 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:34] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:35,190 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:35] "POST /api/alerts/34/resolve HTTP/1.1" 200 - +2025-09-10 22:42:35,444 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:35] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:36,175 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:36] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:38,558 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:38] "POST /api/alerts/32/resolve HTTP/1.1" 200 - +2025-09-10 22:42:38,807 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:38] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:39,363 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:39,782 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:39] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:41,434 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:41] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:44,345 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:44,694 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:44] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:44,728 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:44] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:50,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:50] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:50,444 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:50] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:42:55,110 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:55] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:42:55,424 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:55] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:42:55,445 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:42:55] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:00,459 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:00,465 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:00,704 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:00,816 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:05,135 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:05] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:05,468 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:05] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:05,781 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:05] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:05,831 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:05] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:06,519 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:06] "GET /api/workorders?status=open HTTP/1.1" 200 - +2025-09-10 22:43:08,243 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:08] "GET / HTTP/1.1" 200 - +2025-09-10 22:43:08,556 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:08] "GET /static/js/dashboard.js HTTP/1.1" 200 - +2025-09-10 22:43:09,054 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:43:09,074 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:43:09,082 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:09,107 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/system/info HTTP/1.1" 200 - +2025-09-10 22:43:09,177 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:43:09,183 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:09,395 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:09] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:43:10,471 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:10] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:10,486 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:10] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:13,766 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:14,401 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:14] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:43:15,159 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:15] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:15,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:15] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:15,444 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:15] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:19,414 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:19,860 - src.dialogue.realtime_chat - INFO - 结束会话: session_user_001_1757515229 +2025-09-10 22:43:20,114 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:20] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:20,429 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:20] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:24,414 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:25,116 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:25] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:25,429 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:25] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:25,509 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:25] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:28,069 - src.web.websocket_server - INFO - 客户端断开: ('::1', 13772, 0, 0) +2025-09-10 22:43:28,069 - websockets.server - INFO - connection closed +2025-09-10 22:43:29,200 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:29,839 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:29] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:43:30,439 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:30] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:30,447 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:30] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:33,774 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:35,439 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:35] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:35,464 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:35] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:35,493 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:35] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:37,106 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:37] "POST /api/agent/intelligent-analysis HTTP/1.1" 200 - +2025-09-10 22:43:39,048 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:39] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:43:39,055 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:39] "POST /api/agent/proactive-monitoring HTTP/1.1" 200 - +2025-09-10 22:43:39,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:40,119 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:40] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:40,439 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:40] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:42,340 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:42] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:43:43,756 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:43] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:45,311 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:45] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:43:45,445 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:45] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:45,478 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:45] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:45,498 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:45] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:46,459 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:46] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:43:48,756 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:48] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:43:49,048 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:50,111 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:50] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:50,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:50] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:54,487 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:54] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:55,128 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:55] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:43:55,419 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:55] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:43:55,453 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:55] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:43:59,408 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:43:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:00,109 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:00,420 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:00,457 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:04,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:05,113 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:05] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:05,403 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:05] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:44:05,422 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:05] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:09,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:10,114 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:10] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:10,421 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:10] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:14,411 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:15,109 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:15] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:15,416 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:15] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:44:15,418 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:15] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:19,418 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:20,101 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:20] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:20,428 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:20] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:24,406 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:25,113 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:25] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:25,405 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:25] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:44:25,422 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:25] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:44:29,416 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:34,091 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:39,421 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:44,099 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:44:49,422 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:44:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:45:00,123 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:45:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:45:00,419 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:45:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:45:00,437 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:45:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:45:00,474 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:45:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:45:00,823 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:45:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:00,401 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:46:00,412 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:46:00,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:00,671 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:00,734 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:20,637 - __main__ - INFO - 正在启动TSP智能助手综合管理平台... +2025-09-10 22:46:21,476 - src.core.database - INFO - 数据库初始化成功 +2025-09-10 22:46:22,871 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:22,880 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:22,881 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:46:22,891 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:22,900 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:22,902 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:46:22,902 - src.agent.tool_manager - INFO - 注册工具: search_knowledge +2025-09-10 22:46:22,902 - src.agent.tool_manager - INFO - 注册工具: create_work_order +2025-09-10 22:46:22,903 - src.agent.tool_manager - INFO - 注册工具: update_work_order +2025-09-10 22:46:22,903 - src.agent.tool_manager - INFO - 注册工具: generate_response +2025-09-10 22:46:22,903 - src.agent.tool_manager - INFO - 注册工具: analyze_data +2025-09-10 22:46:22,903 - src.agent.tool_manager - INFO - 注册工具: send_notification +2025-09-10 22:46:22,904 - src.agent.tool_manager - INFO - 注册工具: schedule_task +2025-09-10 22:46:22,904 - src.agent.tool_manager - INFO - 注册工具: web_search +2025-09-10 22:46:22,904 - src.agent.tool_manager - INFO - 注册工具: file_operation +2025-09-10 22:46:22,905 - src.agent.tool_manager - INFO - 注册工具: database_query +2025-09-10 22:46:22,905 - src.agent.tool_manager - INFO - 已注册 10 个默认工具 +2025-09-10 22:46:22,905 - src.agent.agent_core - INFO - Agent核心初始化完成 +2025-09-10 22:46:22,905 - src.agent_assistant - INFO - TSP Agent助手初始化完成 +2025-09-10 22:46:22,916 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:22,978 - werkzeug - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://192.168.26.238:5000 +2025-09-10 22:46:22,978 - werkzeug - INFO - Press CTRL+C to quit +2025-09-10 22:46:23,004 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:46:23,006 - src.web.websocket_server - INFO - 启动WebSocket服务器: ws://localhost:8765 +2025-09-10 22:46:23,011 - websockets.server - INFO - server listening on 127.0.0.1:8765 +2025-09-10 22:46:23,011 - websockets.server - INFO - server listening on [::1]:8765 +2025-09-10 22:46:28,171 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:28] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:28,747 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:28] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:34,394 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:34] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:35,437 - websockets.server - INFO - connection rejected (200 OK) +2025-09-10 22:46:35,438 - websockets.server - INFO - connection closed +2025-09-10 22:46:35,608 - websockets.server - INFO - connection rejected (200 OK) +2025-09-10 22:46:35,624 - websockets.server - INFO - connection closed +2025-09-10 22:46:39,083 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:39] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:44,408 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:44] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:46,320 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:46] "GET / HTTP/1.1" 200 - +2025-09-10 22:46:46,613 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:46] "GET /static/js/dashboard.js HTTP/1.1" 200 - +2025-09-10 22:46:47,410 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:46:47,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:46:47,420 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/system/info HTTP/1.1" 200 - +2025-09-10 22:46:47,456 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:46:47,466 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:47,477 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:46:47,539 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:47] "GET /favicon.ico HTTP/1.1" 404 - +2025-09-10 22:46:49,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:49] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:52,419 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:52] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:54,406 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:54] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:55,108 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:55] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:46:56,537 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:56] "GET /api/workorders/1 HTTP/1.1" 200 - +2025-09-10 22:46:57,437 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:57] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:46:59,087 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:46:59] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:00,403 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:47:00,432 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:00,437 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:47:00,655 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:02,410 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:02] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:04,092 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:04] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:06,352 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:06] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:47:07,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:07] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:09,004 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:09] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:47:09,389 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:09] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:12,411 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:12] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:13,324 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:13] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:47:14,093 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:14] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:16,978 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:16] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:47:17,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:17] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:17,776 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:17] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:47:18,450 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:18] "GET /api/knowledge?page=1&per_page=10 HTTP/1.1" 200 - +2025-09-10 22:47:19,406 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:19] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:21,975 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:21] "GET /api/agent/status HTTP/1.1" 200 - +2025-09-10 22:47:22,412 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:22] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:24,097 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:24,696 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:24] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:47:24,702 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:24] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:47:24,709 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:24] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:47:24,723 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:24] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:47:25,262 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:25] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:47:25,706 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:25] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:47:26,507 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:26] "GET /api/analytics HTTP/1.1" 200 - +2025-09-10 22:47:27,043 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:27] "GET /api/settings HTTP/1.1" 200 - +2025-09-10 22:47:27,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:27] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:29,439 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:29] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:33,085 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:38,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:38] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:43,094 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:43] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:48,086 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:48] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:53,083 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:53] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:47:58,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:47:58] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:00,097 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:00,388 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:48:00,399 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:48:00,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:00,736 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:03,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:03] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:08,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:08] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:13,093 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:18,095 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:18] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:23,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:23] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:48:28,106 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:48:28] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:49:00,160 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:49:00,452 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:49:00,454 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:49:00,477 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:49:00,692 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:49:00,798 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:49:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:50:00,136 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:50:00,143 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:50:00,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:50:00,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:50:00,477 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:50:00,834 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:50:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:51:00,112 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:51:00,432 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:51:00,455 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:51:00,458 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:51:00,675 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:51:00,800 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:51:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:00,123 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:00,125 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:00,410 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:52:00,426 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:52:00,453 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:00,784 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:24,642 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:24] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:25,904 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:25] "GET /api/analytics HTTP/1.1" 200 - +2025-09-10 22:52:27,456 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:27] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:33,108 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:38,104 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:38] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:43,103 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:43] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:48,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:48] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:53,106 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:53] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:52:58,092 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:52:58] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:00,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:53:00,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:00,445 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:53:00,684 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:00,772 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:03,104 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:03] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:08,108 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:08] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:13,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:18,104 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:18] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:23,095 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:23] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:53:28,116 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:53:28] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:54:00,125 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:54:00,146 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:54:00,435 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:54:00,474 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:54:00,488 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:54:00,829 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:54:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:00,142 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:00,443 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:00,455 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:55:00,474 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:55:00,719 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:00,782 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:48,827 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:48] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:53,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:53] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:55:58,093 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:55:58] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:00,098 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:00,400 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:56:00,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:56:00,424 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:00,753 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:03,091 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:03] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:08,102 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:08] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:13,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:13] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:18,095 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:18] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:23,098 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:23] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:28,099 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:28] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:33,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:33] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:38,090 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:38] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:43,089 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:43] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:56:48,095 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:56:48] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:57:00,107 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:57:00,425 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:57:00,437 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:57:00,463 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:57:00,684 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:57:00,770 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:57:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:03,303 - __main__ - INFO - 正在启动TSP智能助手综合管理平台... +2025-09-10 22:58:05,745 - src.core.database - INFO - 数据库初始化成功 +2025-09-10 22:58:07,461 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,470 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,471 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:58:07,480 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,492 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,494 - src.main - INFO - TSP助手初始化完成 +2025-09-10 22:58:07,494 - src.agent.tool_manager - INFO - 注册工具: search_knowledge +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: create_work_order +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: update_work_order +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: generate_response +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: analyze_data +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: send_notification +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: schedule_task +2025-09-10 22:58:07,495 - src.agent.tool_manager - INFO - 注册工具: web_search +2025-09-10 22:58:07,496 - src.agent.tool_manager - INFO - 注册工具: file_operation +2025-09-10 22:58:07,496 - src.agent.tool_manager - INFO - 注册工具: database_query +2025-09-10 22:58:07,496 - src.agent.tool_manager - INFO - 已注册 10 个默认工具 +2025-09-10 22:58:07,496 - src.agent.agent_core - INFO - Agent核心初始化完成 +2025-09-10 22:58:07,496 - src.agent_assistant - INFO - TSP Agent助手初始化完成 +2025-09-10 22:58:07,507 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,570 - werkzeug - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on all addresses (0.0.0.0) + * Running on http://127.0.0.1:5000 + * Running on http://192.168.26.238:5000 +2025-09-10 22:58:07,571 - werkzeug - INFO - Press CTRL+C to quit +2025-09-10 22:58:07,597 - src.knowledge_base.knowledge_manager - INFO - 向量化器加载成功,包含 48 个条目 +2025-09-10 22:58:07,599 - src.web.websocket_server - INFO - 启动WebSocket服务器: ws://localhost:8765 +2025-09-10 22:58:07,603 - websockets.server - INFO - server listening on 127.0.0.1:8765 +2025-09-10 22:58:07,604 - websockets.server - INFO - server listening on [::1]:8765 +2025-09-10 22:58:20,916 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:20] "GET / HTTP/1.1" 200 - +2025-09-10 22:58:21,166 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /static/js/dashboard.js HTTP/1.1" 200 - +2025-09-10 22:58:21,410 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/chat/sessions HTTP/1.1" 200 - +2025-09-10 22:58:21,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:58:21,439 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/system/info HTTP/1.1" 200 - +2025-09-10 22:58:21,463 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:58:21,495 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/knowledge/stats HTTP/1.1" 200 - +2025-09-10 22:58:21,520 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:21,608 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:21] "GET /api/analytics HTTP/1.1" 200 - +2025-09-10 22:58:22,927 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:22] "GET /api/workorders HTTP/1.1" 200 - +2025-09-10 22:58:26,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:26] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:29,362 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:29] "GET /api/workorders/import/template HTTP/1.1" 200 - +2025-09-10 22:58:29,371 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:29] "GET /uploads/workorder_template.xlsx HTTP/1.1" 404 - +2025-09-10 22:58:31,416 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:31] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:32,421 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:32] "GET /uploads/workorder_template.xlsx HTTP/1.1" 404 - +2025-09-10 22:58:36,414 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:36] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:41,419 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:41] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:46,421 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:46] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:51,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:51] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:58:55,684 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:55] "POST /api/workorders/import HTTP/1.1" 400 - +2025-09-10 22:58:56,415 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:58:56] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:00,120 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:00,121 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:00,402 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 22:59:00,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 22:59:00,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:00,772 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:01,512 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:01] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:07,096 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:07] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:12,110 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:12] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:17,088 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:17] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:22,098 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:22] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:27,119 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:27] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:32,117 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:32] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:37,121 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:37] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:42,099 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:42] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:47,104 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:47] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:52,107 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:52] "GET /api/health HTTP/1.1" 200 - +2025-09-10 22:59:57,109 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 22:59:57] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:00:00,130 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:00:00,429 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:00:00,458 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:00:00,462 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:00:00,690 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:00:00,797 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:00:02,113 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:00:02] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:01:00,135 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:01:00,183 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:01:00,469 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:01:00,471 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:01:00,480 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:01:00,708 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:01:00,819 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:01:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:02:00,134 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:02:00,142 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:02:00,184 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:02:00,413 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:02:00,440 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:02:00,475 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:02:00,809 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:02:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:03:00,120 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:03:00,161 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:03:00,427 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:03:00,467 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:03:00,473 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:03:00,683 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:03:00,811 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:03:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:04:00,125 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:04:00,144 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:04:00,189 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:04:00,428 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:04:00,446 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:04:00,469 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:04:00,800 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:04:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:05:00,134 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:05:00,177 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:05:00,429 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:05:00,462 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:05:00,472 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:05:00,701 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:05:00,806 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:05:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:06:00,145 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:06:00,157 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:06:00,201 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:06:00,417 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:06:00,442 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:06:00,497 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:06:00,828 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:06:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:07:00,131 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:07:00,176 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:07:00,426 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:07:00,452 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:07:00,458 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:07:00,681 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:07:00,793 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:07:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:08:00,141 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:08:00,143 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:08:00,196 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:08:00,436 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:08:00,455 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:08:00,496 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:08:00,849 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:08:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:09:00,123 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:09:00,160 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:09:00,425 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/alerts HTTP/1.1" 200 - +2025-09-10 23:09:00,446 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:09:00,448 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/monitor/status HTTP/1.1" 200 - +2025-09-10 23:09:00,700 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/health HTTP/1.1" 200 - +2025-09-10 23:09:00,781 - werkzeug - INFO - 127.0.0.1 - - [10/Sep/2025 23:09:00] "GET /api/health HTTP/1.1" 200 - diff --git a/requirements.txt b/requirements.txt index 2a3963d..5312b3f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,7 @@ psutil>=5.9.0 # 鏁版嵁澶勭悊 pandas>=2.0.0 +openpyxl>=3.1.0 # 鍚戦噺鍖 sentence-transformers>=2.2.0 diff --git a/src/__pycache__/agent_assistant.cpython-311.pyc b/src/__pycache__/agent_assistant.cpython-311.pyc index 70a4edd..2c49737 100644 Binary files a/src/__pycache__/agent_assistant.cpython-311.pyc and b/src/__pycache__/agent_assistant.cpython-311.pyc differ diff --git a/src/agent/__pycache__/auto_monitor.cpython-311.pyc b/src/agent/__pycache__/auto_monitor.cpython-311.pyc new file mode 100644 index 0000000..d5518ae Binary files /dev/null and b/src/agent/__pycache__/auto_monitor.cpython-311.pyc differ diff --git a/src/agent/auto_monitor.py b/src/agent/auto_monitor.py new file mode 100644 index 0000000..4ebc817 --- /dev/null +++ b/src/agent/auto_monitor.py @@ -0,0 +1,358 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +鑷姩鐩戞帶鏈嶅姟 +瀹炵幇Agent鐨勪富鍔ㄨ皟鐢ㄥ姛鑳 +""" + +import asyncio +import logging +import threading +import time +from datetime import datetime, timedelta +from typing import Dict, Any, List, Optional +import json + +logger = logging.getLogger(__name__) + +class AutoMonitorService: + """鑷姩鐩戞帶鏈嶅姟""" + + def __init__(self, agent_assistant): + self.agent_assistant = agent_assistant + self.is_running = False + self.monitor_thread = None + self.check_interval = 300 # 5鍒嗛挓妫鏌ヤ竴娆 + self.last_check_time = None + self.monitoring_stats = { + "total_checks": 0, + "proactive_actions": 0, + "last_action_time": None, + "error_count": 0 + } + + def start_auto_monitoring(self) -> bool: + """鍚姩鑷姩鐩戞帶""" + try: + if self.is_running: + logger.warning("鑷姩鐩戞帶宸插湪杩愯涓") + return True + + self.is_running = True + self.monitor_thread = threading.Thread(target=self._monitoring_loop, daemon=True) + self.monitor_thread.start() + + logger.info("鑷姩鐩戞帶鏈嶅姟宸插惎鍔") + return True + + except Exception as e: + logger.error(f"鍚姩鑷姩鐩戞帶澶辫触: {e}") + return False + + def stop_auto_monitoring(self) -> bool: + """鍋滄鑷姩鐩戞帶""" + try: + self.is_running = False + if self.monitor_thread and self.monitor_thread.is_alive(): + self.monitor_thread.join(timeout=5) + + logger.info("鑷姩鐩戞帶鏈嶅姟宸插仠姝") + return True + + except Exception as e: + logger.error(f"鍋滄鑷姩鐩戞帶澶辫触: {e}") + return False + + def _monitoring_loop(self): + """鐩戞帶寰幆""" + logger.info("鑷姩鐩戞帶寰幆宸插惎鍔") + + while self.is_running: + try: + # 鎵ц鐩戞帶妫鏌 + self._perform_monitoring_check() + + # 绛夊緟涓嬫妫鏌 + time.sleep(self.check_interval) + + except Exception as e: + logger.error(f"鐩戞帶寰幆閿欒: {e}") + self.monitoring_stats["error_count"] += 1 + time.sleep(60) # 鍑洪敊鍚庣瓑寰1鍒嗛挓 + + def _perform_monitoring_check(self): + """鎵ц鐩戞帶妫鏌""" + try: + self.monitoring_stats["total_checks"] += 1 + self.last_check_time = datetime.now() + + logger.info(f"鎵ц绗 {self.monitoring_stats['total_checks']} 娆¤嚜鍔ㄧ洃鎺ф鏌") + + # 1. 妫鏌ョ郴缁熷仴搴风姸鎬 + self._check_system_health() + + # 2. 妫鏌ラ璀︾姸鎬 + self._check_alert_status() + + # 3. 妫鏌ュ伐鍗曠Н鍘 + self._check_workorder_backlog() + + # 4. 妫鏌ョ煡璇嗗簱璐ㄩ噺 + self._check_knowledge_quality() + + # 5. 妫鏌ョ敤鎴锋弧鎰忓害 + self._check_user_satisfaction() + + # 6. 妫鏌ョ郴缁熸ц兘 + self._check_system_performance() + + except Exception as e: + logger.error(f"鎵ц鐩戞帶妫鏌ュけ璐: {e}") + self.monitoring_stats["error_count"] += 1 + + def _check_system_health(self): + """妫鏌ョ郴缁熷仴搴风姸鎬""" + try: + health = self.agent_assistant.get_system_health() + health_score = health.get("health_score", 1.0) + + if health_score < 0.7: + self._trigger_proactive_action({ + "type": "system_health_warning", + "priority": "high", + "description": f"绯荤粺鍋ュ悍鍒嗘暟杈冧綆: {health_score:.2f}", + "action": "寤鸿绔嬪嵆妫鏌ョ郴缁熺姸鎬", + "data": health + }) + + except Exception as e: + logger.error(f"妫鏌ョ郴缁熷仴搴风姸鎬佸け璐: {e}") + + def _check_alert_status(self): + """妫鏌ラ璀︾姸鎬""" + try: + alerts = self.agent_assistant.get_active_alerts() + alert_count = len(alerts) if isinstance(alerts, list) else 0 + + if alert_count > 5: + self._trigger_proactive_action({ + "type": "alert_overflow", + "priority": "high", + "description": f"娲昏穬棰勮鏁伴噺杩囧: {alert_count}", + "action": "寤鸿绔嬪嵆澶勭悊棰勮", + "data": {"alert_count": alert_count} + }) + + except Exception as e: + logger.error(f"妫鏌ラ璀︾姸鎬佸け璐: {e}") + + def _check_workorder_backlog(self): + """妫鏌ュ伐鍗曠Н鍘""" + try: + # 鑾峰彇宸ュ崟缁熻 + workorders = self.agent_assistant.get_workorders() + if isinstance(workorders, list): + open_count = len([w for w in workorders if w.get("status") == "open"]) + in_progress_count = len([w for w in workorders if w.get("status") == "in_progress"]) + total_pending = open_count + in_progress_count + + if total_pending > 10: + self._trigger_proactive_action({ + "type": "workorder_backlog", + "priority": "medium", + "description": f"寰呭鐞嗗伐鍗曡繃澶: {total_pending}", + "action": "寤鸿澧炲姞澶勭悊浜哄憳鎴栦紭鍖栨祦绋", + "data": { + "open_count": open_count, + "in_progress_count": in_progress_count, + "total_pending": total_pending + } + }) + + except Exception as e: + logger.error(f"妫鏌ュ伐鍗曠Н鍘嬪け璐: {e}") + + def _check_knowledge_quality(self): + """妫鏌ョ煡璇嗗簱璐ㄩ噺""" + try: + stats = self.agent_assistant.knowledge_manager.get_knowledge_stats() + avg_confidence = stats.get("average_confidence", 0.8) + total_entries = stats.get("total_entries", 0) + + if avg_confidence < 0.6: + self._trigger_proactive_action({ + "type": "knowledge_quality_low", + "priority": "medium", + "description": f"鐭ヨ瘑搴撳钩鍧囩疆淇″害杈冧綆: {avg_confidence:.2f}", + "action": "寤鸿鏇存柊鍜屼紭鍖栫煡璇嗗簱鍐呭", + "data": {"avg_confidence": avg_confidence, "total_entries": total_entries} + }) + + except Exception as e: + logger.error(f"妫鏌ョ煡璇嗗簱璐ㄩ噺澶辫触: {e}") + + def _check_user_satisfaction(self): + """妫鏌ョ敤鎴锋弧鎰忓害""" + try: + # 妯℃嫙妫鏌ョ敤鎴锋弧鎰忓害 + # 杩欓噷鍙互浠庢暟鎹簱鎴朅PI鑾峰彇鐪熷疄鐨勬弧鎰忓害鏁版嵁 + satisfaction_score = 0.75 # 妯℃嫙鏁版嵁 + + if satisfaction_score < 0.7: + self._trigger_proactive_action({ + "type": "low_satisfaction", + "priority": "high", + "description": f"鐢ㄦ埛婊℃剰搴﹁緝浣: {satisfaction_score:.2f}", + "action": "寤鸿鍒嗘瀽浣庢弧鎰忓害鍘熷洜骞舵敼杩涙湇鍔", + "data": {"satisfaction_score": satisfaction_score} + }) + + except Exception as e: + logger.error(f"妫鏌ョ敤鎴锋弧鎰忓害澶辫触: {e}") + + def _check_system_performance(self): + """妫鏌ョ郴缁熸ц兘""" + try: + # 妯℃嫙妫鏌ョ郴缁熸ц兘鎸囨爣 + response_time = 1.2 # 妯℃嫙鍝嶅簲鏃堕棿锛堢锛 + error_rate = 0.02 # 妯℃嫙閿欒鐜 + + if response_time > 2.0: + self._trigger_proactive_action({ + "type": "slow_response", + "priority": "medium", + "description": f"绯荤粺鍝嶅簲鏃堕棿杩囨參: {response_time:.2f}绉", + "action": "寤鸿浼樺寲绯荤粺鎬ц兘", + "data": {"response_time": response_time} + }) + + if error_rate > 0.05: + self._trigger_proactive_action({ + "type": "high_error_rate", + "priority": "high", + "description": f"绯荤粺閿欒鐜囪繃楂: {error_rate:.2%}", + "action": "寤鸿绔嬪嵆妫鏌ョ郴缁熼敊璇", + "data": {"error_rate": error_rate} + }) + + except Exception as e: + logger.error(f"妫鏌ョ郴缁熸ц兘澶辫触: {e}") + + def _trigger_proactive_action(self, action_data: Dict[str, Any]): + """瑙﹀彂涓诲姩琛屽姩""" + try: + self.monitoring_stats["proactive_actions"] += 1 + self.monitoring_stats["last_action_time"] = datetime.now() + + logger.info(f"瑙﹀彂涓诲姩琛屽姩: {action_data['type']} - {action_data['description']}") + + # 璁板綍涓诲姩琛屽姩 + self._log_proactive_action(action_data) + + # 鏍规嵁琛屽姩绫诲瀷鎵ц鐩稿簲鎿嶄綔 + self._execute_proactive_action(action_data) + + except Exception as e: + logger.error(f"瑙﹀彂涓诲姩琛屽姩澶辫触: {e}") + + def _log_proactive_action(self, action_data: Dict[str, Any]): + """璁板綍涓诲姩琛屽姩""" + try: + log_entry = { + "timestamp": datetime.now().isoformat(), + "action_type": action_data["type"], + "priority": action_data["priority"], + "description": action_data["description"], + "action": action_data["action"], + "data": action_data.get("data", {}) + } + + # 杩欓噷鍙互灏嗘棩蹇椾繚瀛樺埌鏁版嵁搴撴垨鏂囦欢 + logger.info(f"涓诲姩琛屽姩璁板綍: {json.dumps(log_entry, ensure_ascii=False)}") + + except Exception as e: + logger.error(f"璁板綍涓诲姩琛屽姩澶辫触: {e}") + + def _execute_proactive_action(self, action_data: Dict[str, Any]): + """鎵ц涓诲姩琛屽姩""" + try: + action_type = action_data["type"] + + if action_type == "system_health_warning": + self._handle_system_health_warning(action_data) + elif action_type == "alert_overflow": + self._handle_alert_overflow(action_data) + elif action_type == "workorder_backlog": + self._handle_workorder_backlog(action_data) + elif action_type == "knowledge_quality_low": + self._handle_knowledge_quality_low(action_data) + elif action_type == "low_satisfaction": + self._handle_low_satisfaction(action_data) + elif action_type == "slow_response": + self._handle_slow_response(action_data) + elif action_type == "high_error_rate": + self._handle_high_error_rate(action_data) + else: + logger.warning(f"鏈煡鐨勪富鍔ㄨ鍔ㄧ被鍨: {action_type}") + + except Exception as e: + logger.error(f"鎵ц涓诲姩琛屽姩澶辫触: {e}") + + def _handle_system_health_warning(self, action_data: Dict[str, Any]): + """澶勭悊绯荤粺鍋ュ悍璀﹀憡""" + logger.info("澶勭悊绯荤粺鍋ュ悍璀﹀憡") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽鍙戦侀氱煡銆侀噸鍚湇鍔$瓑 + + def _handle_alert_overflow(self, action_data: Dict[str, Any]): + """澶勭悊棰勮婧㈠嚭""" + logger.info("澶勭悊棰勮婧㈠嚭") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽鑷姩澶勭悊棰勮銆佸彂閫侀氱煡绛 + + def _handle_workorder_backlog(self, action_data: Dict[str, Any]): + """澶勭悊宸ュ崟绉帇""" + logger.info("澶勭悊宸ュ崟绉帇") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽鑷姩鍒嗛厤宸ュ崟銆佸彂閫佹彁閱掔瓑 + + def _handle_knowledge_quality_low(self, action_data: Dict[str, Any]): + """澶勭悊鐭ヨ瘑搴撹川閲忎綆""" + logger.info("澶勭悊鐭ヨ瘑搴撹川閲忎綆") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽鑷姩鏇存柊鐭ヨ瘑搴撱佸彂閫佹彁閱掔瓑 + + def _handle_low_satisfaction(self, action_data: Dict[str, Any]): + """澶勭悊浣庢弧鎰忓害""" + logger.info("澶勭悊浣庢弧鎰忓害") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽鍒嗘瀽鍘熷洜銆佸彂閫侀氱煡绛 + + def _handle_slow_response(self, action_data: Dict[str, Any]): + """澶勭悊鍝嶅簲鎱""" + logger.info("澶勭悊鍝嶅簲鎱") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽浼樺寲閰嶇疆銆佸彂閫侀氱煡绛 + + def _handle_high_error_rate(self, action_data: Dict[str, Any]): + """澶勭悊楂橀敊璇巼""" + logger.info("澶勭悊楂橀敊璇巼") + # 杩欓噷鍙互瀹炵幇鍏蜂綋鐨勫鐞嗛昏緫锛屽妫鏌ユ棩蹇椼佸彂閫侀氱煡绛 + + def get_monitoring_status(self) -> Dict[str, Any]: + """鑾峰彇鐩戞帶鐘舵""" + return { + "is_running": self.is_running, + "check_interval": self.check_interval, + "last_check_time": self.last_check_time.isoformat() if self.last_check_time else None, + "stats": self.monitoring_stats + } + + def update_check_interval(self, interval: int) -> bool: + """鏇存柊妫鏌ラ棿闅""" + try: + if interval < 60: # 鏈灏1鍒嗛挓 + logger.warning("妫鏌ラ棿闅斾笉鑳藉皯浜60绉") + return False + + self.check_interval = interval + logger.info(f"妫鏌ラ棿闅斿凡鏇存柊涓 {interval} 绉") + return True + + except Exception as e: + logger.error(f"鏇存柊妫鏌ラ棿闅斿け璐: {e}") + return False diff --git a/src/agent_assistant.py b/src/agent_assistant.py index 088266d..0e00ce9 100644 --- a/src/agent_assistant.py +++ b/src/agent_assistant.py @@ -13,6 +13,7 @@ import json from src.main import TSPAssistant from src.agent import AgentCore, AgentState +from src.agent.auto_monitor import AutoMonitorService logger = logging.getLogger(__name__) @@ -26,6 +27,9 @@ class TSPAgentAssistant(TSPAssistant): # 鍒濆鍖朅gent鏍稿績 self.agent_core = AgentCore() + # 鍒濆鍖栬嚜鍔ㄧ洃鎺ф湇鍔 + self.auto_monitor = AutoMonitorService(self) + # Agent鐗规湁鍔熻兘 self.is_agent_mode = True self.proactive_tasks = [] @@ -409,10 +413,13 @@ class TSPAgentAssistant(TSPAssistant): def get_agent_status(self) -> Dict[str, Any]: """鑾峰彇Agent鐘舵""" try: + # 鑾峰彇鑷姩鐩戞帶鐘舵 + monitor_status = self.auto_monitor.get_monitoring_status() + return { "success": True, "agent_mode": self.is_agent_mode, - "monitoring_active": getattr(self, '_monitoring_active', False), + "monitoring_active": monitor_status["is_running"], "status": "active" if self.is_agent_mode else "inactive", "active_goals": 0, # 绠鍖栧鐞 "available_tools": 6, # 绠鍖栧鐞 @@ -424,7 +431,8 @@ class TSPAgentAssistant(TSPAssistant): {"name": "analyze_data", "usage_count": 0, "success_rate": 0.8}, {"name": "send_notification", "usage_count": 0, "success_rate": 0.8} ], - "execution_history": [] + "execution_history": [], + "auto_monitor": monitor_status } except Exception as e: logger.error(f"鑾峰彇Agent鐘舵佸け璐: {e}") @@ -456,11 +464,14 @@ class TSPAgentAssistant(TSPAssistant): # 鍚姩鍩虹鐩戞帶 self.start_monitoring() - # 鍚姩Agent涓诲姩鐩戞帶锛堝悓姝ョ増鏈級 - self._start_monitoring_loop() - - logger.info("涓诲姩鐩戞帶宸插惎鍔") - return True + # 鍚姩鑷姩鐩戞帶鏈嶅姟 + success = self.auto_monitor.start_auto_monitoring() + if success: + logger.info("涓诲姩鐩戞帶宸插惎鍔") + return True + else: + logger.error("鍚姩鑷姩鐩戞帶鏈嶅姟澶辫触") + return False except Exception as e: logger.error(f"鍚姩涓诲姩鐩戞帶澶辫触: {e}") return False @@ -471,11 +482,14 @@ class TSPAgentAssistant(TSPAssistant): # 鍋滄鍩虹鐩戞帶 self.stop_monitoring() - # 鍋滄Agent涓诲姩鐩戞帶 - self._stop_monitoring_loop() - - logger.info("涓诲姩鐩戞帶宸插仠姝") - return True + # 鍋滄鑷姩鐩戞帶鏈嶅姟 + success = self.auto_monitor.stop_auto_monitoring() + if success: + logger.info("涓诲姩鐩戞帶宸插仠姝") + return True + else: + logger.error("鍋滄鑷姩鐩戞帶鏈嶅姟澶辫触") + return False except Exception as e: logger.error(f"鍋滄涓诲姩鐩戞帶澶辫触: {e}") return False @@ -619,30 +633,38 @@ class TSPAgentAssistant(TSPAssistant): return "" def _extract_knowledge_from_content(self, content: str, filename: str) -> List[Dict[str, Any]]: - """浠庡唴瀹逛腑鎻愬彇鐭ヨ瘑""" + """浠庡唴瀹逛腑鎻愬彇鐭ヨ瘑锛岀粨鍚堝伐鍗曟暟鎹紭鍖""" try: - # 鏋勫缓鎻愮ず璇 + # 鑾峰彇鍘嗗彶宸ュ崟鏁版嵁鐢ㄤ簬鍙傝 + workorder_data = self._get_workorder_insights() + + # 鏋勫缓澧炲己鐨勬彁绀鸿瘝 prompt = f""" -璇蜂粠浠ヤ笅鏂囨。鍐呭涓彁鍙栭棶绛斿锛岀敤浜庢瀯寤虹煡璇嗗簱锛 +璇蜂粠浠ヤ笅鏂囨。鍐呭涓彁鍙栭棶绛斿锛岀敤浜庢瀯寤虹煡璇嗗簱銆傝缁撳悎鍘嗗彶宸ュ崟鏁版嵁鏉ヤ紭鍖栨彁鍙栫粨鏋滐細 鏂囨。鍚嶇О锛歿filename} 鏂囨。鍐呭锛 {content[:2000]}... +鍘嗗彶宸ュ崟鏁版嵁鍙傝冿細 +{workorder_data} + 璇锋寜鐓т互涓嬫牸寮忔彁鍙栭棶绛斿锛 -1. 闂锛氬叿浣撶殑闂鎻忚堪 -2. 绛旀锛氳缁嗙殑绛旀鍐呭 +1. 闂锛氬叿浣撶殑闂鎻忚堪锛堝弬鑰冨伐鍗曚腑鐨勫父瑙侀棶棰橈級 +2. 绛旀锛氳缁嗙殑绛旀鍐呭锛堢粨鍚堝伐鍗曞鐞嗙粡楠岋級 3. 鍒嗙被锛氶棶棰樻墍灞炵被鍒紙鎶鏈棶棰樸丄PP鍔熻兘銆佽繙绋嬫帶鍒躲佽溅杈嗙粦瀹氥佸叾浠栵級 4. 缃俊搴︼細0-1涔嬮棿鐨勬暟鍊 +5. 宸ュ崟鍏宠仈锛氭槸鍚︿笌鍘嗗彶宸ュ崟鐩稿叧 -璇锋彁鍙3-5涓渶鏈変环鍊肩殑闂瓟瀵癸紝姣忎釜闂瓟瀵归兘瑕佸畬鏁翠笖瀹炵敤銆 +璇锋彁鍙3-5涓渶鏈変环鍊肩殑闂瓟瀵癸紝浼樺厛鎻愬彇涓庡巻鍙插伐鍗曢棶棰樼浉鍏崇殑闂瓟瀵广 杩斿洖鏍煎紡涓篔SON鏁扮粍锛屼緥濡傦細 [ {{ "question": "濡備綍杩滅▼鍚姩杞﹁締锛", - "answer": "杩滅▼鍚姩杞﹁締闇瑕佹弧瓒充互涓嬫潯浠讹細1. 杞﹁締澶勪簬P妗 2. 鎵嬪埞鎷夎捣 3. 杞﹂棬宸查攣 4. 鐢垫睜鐢甸噺鍏呰冻", + "answer": "杩滅▼鍚姩杞﹁締闇瑕佹弧瓒充互涓嬫潯浠讹細1. 杞﹁締澶勪簬P妗 2. 鎵嬪埞鎷夎捣 3. 杞﹂棬宸查攣 4. 鐢垫睜鐢甸噺鍏呰冻銆傚鏋滀粛鐒舵棤娉曞惎鍔紝璇锋鏌ヨ溅杈嗘槸鍚﹀浜庡彲鍚姩鐘舵併", "category": "杩滅▼鎺у埗", - "confidence_score": 0.9 + "confidence_score": 0.9, + "workorder_related": true }} ] """ @@ -700,6 +722,52 @@ class TSPAgentAssistant(TSPAssistant): logger.error(f"鎻愬彇鐭ヨ瘑澶辫触: {e}") return [] + def _get_workorder_insights(self) -> str: + """鑾峰彇宸ュ崟鏁版嵁娲炲療""" + try: + # 鑾峰彇宸ュ崟鏁版嵁 + workorders = self.get_workorders() + if not isinstance(workorders, list): + return "鏆傛棤宸ュ崟鏁版嵁" + + # 鍒嗘瀽宸ュ崟鏁版嵁 + categories = {} + common_issues = [] + resolutions = [] + + for workorder in workorders[:20]: # 鍙栨渶杩20涓伐鍗 + category = workorder.get("category", "鍏朵粬") + categories[category] = categories.get(category, 0) + 1 + + # 鎻愬彇甯歌闂 + title = workorder.get("title", "") + description = workorder.get("description", "") + if title and len(title) > 5: + common_issues.append(title) + + # 鎻愬彇瑙e喅鏂规锛堝鏋滄湁锛 + resolution = workorder.get("resolution", "") + if resolution and len(resolution) > 10: + resolutions.append(resolution[:100]) # 鎴彇鍓100瀛楃 + + # 鏋勫缓宸ュ崟娲炲療鏂囨湰 + insights = f""" +宸ュ崟缁熻锛 +- 鎬诲伐鍗曟暟锛歿len(workorders)} +- 闂鍒嗙被鍒嗗竷锛歿dict(list(categories.items())[:5])} + +甯歌闂锛 +{chr(10).join(common_issues[:10])} + +瑙e喅鏂规绀轰緥锛 +{chr(10).join(resolutions[:5])} +""" + return insights + + except Exception as e: + logger.error(f"鑾峰彇宸ュ崟娲炲療澶辫触: {e}") + return "鑾峰彇宸ュ崟鏁版嵁澶辫触" + def _parse_knowledge_manually(self, content: str) -> List[Dict[str, Any]]: """鎵嬪姩瑙f瀽鐭ヨ瘑鍐呭""" try: diff --git a/src/web/__pycache__/app.cpython-311.pyc b/src/web/__pycache__/app.cpython-311.pyc index 2cac1ea..9e02087 100644 Binary files a/src/web/__pycache__/app.cpython-311.pyc and b/src/web/__pycache__/app.cpython-311.pyc differ diff --git a/src/web/__pycache__/websocket_server.cpython-311.pyc b/src/web/__pycache__/websocket_server.cpython-311.pyc new file mode 100644 index 0000000..53e4e52 Binary files /dev/null and b/src/web/__pycache__/websocket_server.cpython-311.pyc differ diff --git a/src/web/app.py b/src/web/app.py index 76b6514..3552e98 100644 --- a/src/web/app.py +++ b/src/web/app.py @@ -8,9 +8,13 @@ TSP鍔╂墜棰勮绠$悊Web搴旂敤 import sys import os import json +import pandas as pd from datetime import datetime, timedelta -from flask import Flask, render_template, request, jsonify, redirect, url_for +from openpyxl import Workbook +from openpyxl.styles import Font +from flask import Flask, render_template, request, jsonify, redirect, url_for, send_from_directory, send_file from flask_cors import CORS +from werkzeug.utils import secure_filename # 娣诲姞椤圭洰鏍圭洰褰曞埌Python璺緞 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -24,6 +28,11 @@ from src.vehicle.vehicle_data_manager import VehicleDataManager app = Flask(__name__) CORS(app) +# 閰嶇疆涓婁紶鏂囦欢澶 +UPLOAD_FOLDER = 'uploads' +app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER +app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB max file size + # 鍒濆鍖朤SP鍔╂墜鍜孉gent鍔╂墜 assistant = TSPAssistant() agent_assistant = TSPAgentAssistant() @@ -541,6 +550,60 @@ def get_workorders(): "priority": "medium", "status": "in_progress", "created_at": "2024-01-01T11:00:00Z" + }, + { + "id": 3, + "title": "钃濈墮杩炴帴澶辫触", + "description": "鐢ㄦ埛鏃犳硶閫氳繃钃濈墮杩炴帴杞﹁締", + "category": "钃濈墮鍔熻兘", + "priority": "high", + "status": "open", + "created_at": "2024-01-01T12:00:00Z" + }, + { + "id": 4, + "title": "杞﹁締瀹氫綅涓嶅噯纭", + "description": "APP涓樉绀虹殑杞﹁締浣嶇疆涓庡疄闄呬綅缃笉绗", + "category": "瀹氫綅鍔熻兘", + "priority": "medium", + "status": "resolved", + "created_at": "2024-01-01T13:00:00Z" + }, + { + "id": 5, + "title": "杩滅▼瑙i攣澶辫触", + "description": "鐢ㄦ埛鏃犳硶閫氳繃APP杩滅▼瑙i攣杞﹁締", + "category": "杩滅▼鎺у埗", + "priority": "urgent", + "status": "open", + "created_at": "2024-01-01T14:00:00Z" + }, + { + "id": 6, + "title": "APP闂闂", + "description": "鐢ㄦ埛鍙嶆槧APP鍦ㄤ娇鐢ㄨ繃绋嬩腑棰戠箒闂", + "category": "APP鍔熻兘", + "priority": "high", + "status": "in_progress", + "created_at": "2024-01-01T15:00:00Z" + }, + { + "id": 7, + "title": "杞﹁締鐘舵佹洿鏂板欢杩", + "description": "杞﹁締鐘舵佷俊鎭洿鏂颁笉鍙婃椂锛屽瓨鍦ㄥ欢杩", + "category": "鏁版嵁鍚屾", + "priority": "low", + "status": "open", + "created_at": "2024-01-01T16:00:00Z" + }, + { + "id": 8, + "title": "鐢ㄦ埛璁よ瘉澶辫触", + "description": "閮ㄥ垎鐢ㄦ埛鏃犳硶姝e父鐧诲綍APP", + "category": "鐢ㄦ埛璁よ瘉", + "priority": "high", + "status": "resolved", + "created_at": "2024-01-01T17:00:00Z" } ] @@ -569,16 +632,313 @@ def create_workorder(): except Exception as e: return jsonify({"error": str(e)}), 500 +@app.route('/api/workorders/') +def get_workorder_details(workorder_id): + """鑾峰彇宸ュ崟璇︽儏""" + try: + # 杩欓噷搴旇浠庢暟鎹簱鑾峰彇宸ュ崟璇︽儏 + # 鏆傛椂杩斿洖妯℃嫙鏁版嵁 + workorder = { + "id": workorder_id, + "order_id": f"WO{workorder_id:06d}", + "title": "杞﹁締鏃犳硶杩滅▼鍚姩", + "description": "鐢ㄦ埛鍙嶆槧APP涓繙绋嬪惎鍔ㄥ姛鑳芥棤娉曚娇鐢紝鐐瑰嚮鍚姩鎸夐挳鍚庢病鏈変换浣曞弽搴旓紝杞﹁締涔熸病鏈夊搷搴斻", + "category": "杩滅▼鎺у埗", + "priority": "high", + "status": "open", + "created_at": "2024-01-01T10:00:00Z", + "updated_at": "2024-01-01T10:00:00Z", + "resolution": None, + "satisfaction_score": None, + "conversations": [ + { + "id": 1, + "user_message": "鎴戠殑杞﹁締鏃犳硶杩滅▼鍚姩", + "assistant_response": "鎴戜簡瑙f偍鐨勯棶棰樸傝鎴戝府鎮ㄦ帓鏌ヤ竴涓嬭繙绋嬪惎鍔ㄥ姛鑳界殑闂銆", + "timestamp": "2024-01-01T10:05:00Z" + }, + { + "id": 2, + "user_message": "鐐瑰嚮鍚姩鎸夐挳鍚庢病鏈変换浣曞弽搴", + "assistant_response": "杩欑鎯呭喌閫氬父鏄敱浜庣綉缁滆繛鎺ユ垨杞﹁締鐘舵侀棶棰樺鑷寸殑銆傝妫鏌ヨ溅杈嗘槸鍚﹀浜庡彲鍚姩鐘舵併", + "timestamp": "2024-01-01T10:10:00Z" + } + ] + } + return jsonify(workorder) + except Exception as e: + return jsonify({"error": str(e)}), 500 + +@app.route('/api/workorders/', methods=['PUT']) +def update_workorder(workorder_id): + """鏇存柊宸ュ崟""" + try: + data = request.get_json() + + # 楠岃瘉蹇呭~瀛楁 + if not data.get('title') or not data.get('description'): + return jsonify({"error": "鏍囬鍜屾弿杩颁笉鑳戒负绌"}), 400 + + # 杩欓噷搴旇鏇存柊鏁版嵁搴撲腑鐨勫伐鍗 + # 鏆傛椂杩斿洖鎴愬姛鍝嶅簲锛屽疄闄呭簲鐢ㄤ腑搴旇璋冪敤鏁版嵁搴撴洿鏂 + updated_workorder = { + "id": workorder_id, + "title": data.get('title'), + "description": data.get('description'), + "category": data.get('category', '鎶鏈棶棰'), + "priority": data.get('priority', 'medium'), + "status": data.get('status', 'open'), + "resolution": data.get('resolution'), + "satisfaction_score": data.get('satisfaction_score'), + "updated_at": datetime.now().isoformat() + } + + return jsonify({ + "success": True, + "message": "宸ュ崟鏇存柊鎴愬姛", + "workorder": updated_workorder + }) + except Exception as e: + return jsonify({"error": str(e)}), 500 + # 鍒嗘瀽鐩稿叧API @app.route('/api/analytics') def get_analytics(): """鑾峰彇鍒嗘瀽鏁版嵁""" try: - analytics = assistant.generate_analytics("last_7_days") + time_range = request.args.get('timeRange', '30') + dimension = request.args.get('dimension', 'workorders') + + # 鐢熸垚妯℃嫙鍒嗘瀽鏁版嵁 + analytics = generate_analytics_data(int(time_range), dimension) return jsonify(analytics) except Exception as e: return jsonify({"error": str(e)}), 500 +def generate_analytics_data(days, dimension): + """鐢熸垚鍒嗘瀽鏁版嵁""" + import random + from datetime import datetime, timedelta + + # 鐢熸垚鏃堕棿搴忓垪鏁版嵁 + trend_data = [] + for i in range(days): + date = (datetime.now() - timedelta(days=days-i-1)).strftime('%Y-%m-%d') + workorders = random.randint(5, 25) + alerts = random.randint(0, 10) + trend_data.append({ + 'date': date, + 'workorders': workorders, + 'alerts': alerts + }) + + # 宸ュ崟缁熻 + workorders_stats = { + 'total': random.randint(100, 500), + 'open': random.randint(10, 50), + 'in_progress': random.randint(5, 30), + 'resolved': random.randint(50, 200), + 'closed': random.randint(20, 100), + 'by_category': { + '鎶鏈棶棰': random.randint(20, 80), + '涓氬姟闂': random.randint(15, 60), + '绯荤粺鏁呴殰': random.randint(10, 40), + '鍔熻兘闇姹': random.randint(5, 30), + '鍏朵粬': random.randint(5, 20) + }, + 'by_priority': { + 'low': random.randint(20, 60), + 'medium': random.randint(30, 80), + 'high': random.randint(10, 40), + 'urgent': random.randint(5, 20) + } + } + + # 婊℃剰搴﹀垎鏋 + satisfaction_stats = { + 'average': round(random.uniform(3.5, 4.8), 1), + 'distribution': { + '1': random.randint(0, 5), + '2': random.randint(0, 10), + '3': random.randint(5, 20), + '4': random.randint(20, 50), + '5': random.randint(30, 80) + } + } + + # 棰勮缁熻 + alerts_stats = { + 'total': random.randint(50, 200), + 'active': random.randint(5, 30), + 'resolved': random.randint(20, 100), + 'by_level': { + 'low': random.randint(10, 40), + 'medium': random.randint(15, 50), + 'high': random.randint(5, 25), + 'critical': random.randint(2, 10) + } + } + + # 鎬ц兘鎸囨爣 + performance_stats = { + 'response_time': round(random.uniform(0.5, 2.0), 2), + 'uptime': round(random.uniform(95, 99.9), 1), + 'error_rate': round(random.uniform(0.1, 2.0), 2), + 'throughput': random.randint(1000, 5000) + } + + return { + 'trend': trend_data, + 'workorders': workorders_stats, + 'satisfaction': satisfaction_stats, + 'alerts': alerts_stats, + 'performance': performance_stats, + 'summary': { + 'total_workorders': workorders_stats['total'], + 'resolution_rate': round((workorders_stats['resolved'] / workorders_stats['total']) * 100, 1) if workorders_stats['total'] > 0 else 0, + 'avg_satisfaction': satisfaction_stats['average'], + 'active_alerts': alerts_stats['active'] + } + } + +@app.route('/api/analytics/export') +def export_analytics(): + """瀵煎嚭鍒嗘瀽鎶ュ憡""" + try: + # 鐢熸垚Excel鎶ュ憡 + analytics = generate_analytics_data(30, 'workorders') + + # 鍒涘缓宸ヤ綔绨 + wb = Workbook() + ws = wb.active + ws.title = "鍒嗘瀽鎶ュ憡" + + # 娣诲姞鏍囬 + ws['A1'] = 'TSP鏅鸿兘鍔╂墜鍒嗘瀽鎶ュ憡' + ws['A1'].font = Font(size=16, bold=True) + + # 娣诲姞宸ュ崟缁熻 + ws['A3'] = '宸ュ崟缁熻' + ws['A3'].font = Font(bold=True) + ws['A4'] = '鎬诲伐鍗曟暟' + ws['B4'] = analytics['workorders']['total'] + ws['A5'] = '寰呭鐞' + ws['B5'] = analytics['workorders']['open'] + ws['A6'] = '宸茶В鍐' + ws['B6'] = analytics['workorders']['resolved'] + + # 淇濆瓨鏂囦欢 + report_path = 'uploads/analytics_report.xlsx' + os.makedirs('uploads', exist_ok=True) + wb.save(report_path) + + return send_file(report_path, as_attachment=True, download_name='analytics_report.xlsx') + + except Exception as e: + return jsonify({"error": str(e)}), 500 + +# 宸ュ崟瀵煎叆鐩稿叧API +@app.route('/api/workorders/import', methods=['POST']) +def import_workorders(): + """瀵煎叆Excel宸ュ崟鏂囦欢""" + try: + # 妫鏌ユ槸鍚︽湁鏂囦欢涓婁紶 + if 'file' not in request.files: + return jsonify({"error": "娌℃湁涓婁紶鏂囦欢"}), 400 + + file = request.files['file'] + if file.filename == '': + return jsonify({"error": "娌℃湁閫夋嫨鏂囦欢"}), 400 + + if not file.filename.endswith(('.xlsx', '.xls')): + return jsonify({"error": "鍙敮鎸丒xcel鏂囦欢(.xlsx, .xls)"}), 400 + + # 淇濆瓨涓婁紶鐨勬枃浠 + filename = secure_filename(file.filename) + upload_path = os.path.join('uploads', filename) + os.makedirs('uploads', exist_ok=True) + file.save(upload_path) + + # 瑙f瀽Excel鏂囦欢 + try: + df = pd.read_excel(upload_path) + imported_workorders = [] + + # 澶勭悊姣忎竴琛屾暟鎹 + for index, row in df.iterrows(): + # 鏍规嵁Excel鍒楀悕鏄犲皠鍒板伐鍗曞瓧娈 + workorder = { + "id": len(assistant.work_orders) + index + 1, # 鐢熸垚鏂癐D + "order_id": f"WO{len(assistant.work_orders) + index + 1:06d}", + "title": str(row.get('鏍囬', row.get('title', f'瀵煎叆宸ュ崟 {index + 1}'))), + "description": str(row.get('鎻忚堪', row.get('description', ''))), + "category": str(row.get('鍒嗙被', row.get('category', '鎶鏈棶棰'))), + "priority": str(row.get('浼樺厛绾', row.get('priority', 'medium'))), + "status": str(row.get('鐘舵', row.get('status', 'open'))), + "created_at": datetime.now().isoformat(), + "updated_at": datetime.now().isoformat(), + "resolution": str(row.get('瑙e喅鏂规', row.get('resolution', ''))) if pd.notna(row.get('瑙e喅鏂规', row.get('resolution'))) else None, + "satisfaction_score": int(row.get('婊℃剰搴', row.get('satisfaction_score', 0))) if pd.notna(row.get('婊℃剰搴', row.get('satisfaction_score'))) else None + } + + # 娣诲姞鍒板伐鍗曞垪琛紙杩欓噷搴旇淇濆瓨鍒版暟鎹簱锛 + assistant.work_orders.append(workorder) + imported_workorders.append(workorder) + + # 娓呯悊涓婁紶鐨勬枃浠 + os.remove(upload_path) + + return jsonify({ + "success": True, + "message": f"鎴愬姛瀵煎叆 {len(imported_workorders)} 涓伐鍗", + "imported_count": len(imported_workorders), + "workorders": imported_workorders + }) + + except Exception as e: + # 娓呯悊涓婁紶鐨勬枃浠 + if os.path.exists(upload_path): + os.remove(upload_path) + return jsonify({"error": f"瑙f瀽Excel鏂囦欢澶辫触: {str(e)}"}), 400 + + except Exception as e: + return jsonify({"error": str(e)}), 500 + +@app.route('/api/workorders/import/template') +def download_import_template(): + """涓嬭浇宸ュ崟瀵煎叆妯℃澘""" + try: + # 鍒涘缓妯℃澘鏁版嵁 + template_data = { + '鏍囬': ['杞﹁締鏃犳硶鍚姩', '绌鸿皟涓嶅埗鍐', '瀵艰埅绯荤粺鏁呴殰'], + '鎻忚堪': ['鐢ㄦ埛鍙嶆槧杞﹁締鏃犳硶姝e父鍚姩', '绌鸿皟绯荤粺鏃犳硶鍒跺喎', '瀵艰埅绯荤粺鏄剧ず寮傚父'], + '鍒嗙被': ['鎶鏈棶棰', '鎶鏈棶棰', '鎶鏈棶棰'], + '浼樺厛绾': ['high', 'medium', 'low'], + '鐘舵': ['open', 'in_progress', 'resolved'], + '瑙e喅鏂规': ['妫鏌ョ數姹犲拰鍚姩绯荤粺', '妫鏌ュ埗鍐峰墏鍜屽帇缂╂満', '鏇存柊瀵艰埅杞欢'], + '婊℃剰搴': [5, 4, 5] + } + + df = pd.DataFrame(template_data) + + # 淇濆瓨涓篍xcel鏂囦欢 + template_path = 'uploads/workorder_template.xlsx' + os.makedirs('uploads', exist_ok=True) + df.to_excel(template_path, index=False) + + return jsonify({ + "success": True, + "template_url": f"/uploads/workorder_template.xlsx" + }) + + except Exception as e: + return jsonify({"error": str(e)}), 500 + +@app.route('/uploads/') +def uploaded_file(filename): + """鎻愪緵涓婁紶鏂囦欢鐨勪笅杞芥湇鍔""" + return send_from_directory(app.config['UPLOAD_FOLDER'], filename) + # 绯荤粺璁剧疆鐩稿叧API @app.route('/api/settings') def get_settings(): diff --git a/src/web/static/css/style.css b/src/web/static/css/style.css index 9614a08..9867f82 100644 --- a/src/web/static/css/style.css +++ b/src/web/static/css/style.css @@ -429,3 +429,178 @@ body { background-color: #d1ecf1; border-color: #17a2b8; } + +/* 棰勮瑙勫垯鍗$墖鏍峰紡 */ +.preset-card { + cursor: pointer; + transition: all 0.3s ease; + border: 2px solid transparent; + height: 100%; +} + +.preset-card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 25px rgba(0,0,0,0.15); + border-color: #007bff; +} + +.preset-card.selected { + border-color: #28a745; + background-color: #f8fff9; +} + +.preset-card .card-body { + padding: 1.5rem; + text-align: center; +} + +.preset-card h6 { + margin-bottom: 0.5rem; + font-weight: 600; + color: #333; +} + +.preset-card p { + margin-bottom: 1rem; + color: #6c757d; + font-size: 0.875rem; + line-height: 1.4; +} + +.preset-params { + display: flex; + justify-content: center; + gap: 0.5rem; + flex-wrap: wrap; +} + +.preset-params .badge { + font-size: 0.7rem; + padding: 0.25rem 0.5rem; +} + +/* 棰勮妯℃澘妯℃佹鏍峰紡 */ +#presetModal .modal-dialog { + max-width: 1200px; +} + +#presetModal .modal-body { + max-height: 70vh; + overflow-y: auto; +} + +/* 棰勮瑙勫垯鍒嗙被鏍囬 */ +#presetModal h6 { + font-weight: 600; + margin-bottom: 1rem; + padding-bottom: 0.5rem; + border-bottom: 2px solid; +} + +#presetModal h6.text-primary { + border-bottom-color: #007bff; +} + +#presetModal h6.text-success { + border-bottom-color: #28a745; +} + +#presetModal h6.text-info { + border-bottom-color: #17a2b8; +} + +#presetModal h6.text-warning { + border-bottom-color: #ffc107; +} + +/* 棰勮鍗$墖鍥炬爣鏍峰紡 */ +.preset-card i { + transition: all 0.3s ease; +} + +.preset-card:hover i { + transform: scale(1.1); +} + +/* 棰勮鍗$墖閫変腑鐘舵 */ +.preset-card.selected i { + color: #28a745 !important; +} + +.preset-card.selected h6 { + color: #28a745; +} + +/* 鍝嶅簲寮忛璁惧崱鐗 */ +@media (max-width: 768px) { + .preset-card .card-body { + padding: 1rem; + } + + .preset-card h6 { + font-size: 0.9rem; + } + + .preset-card p { + font-size: 0.8rem; + } + + .preset-params .badge { + font-size: 0.65rem; + padding: 0.2rem 0.4rem; + } +} + +/* 棰勮瑙勫垯蹇熼夋嫨 */ +.preset-quick-select { + display: flex; + gap: 0.5rem; + margin-bottom: 1rem; + flex-wrap: wrap; +} + +.preset-quick-select .btn { + font-size: 0.8rem; + padding: 0.25rem 0.75rem; +} + +/* 棰勮瑙勫垯棰勮 */ +.preset-preview { + background-color: #f8f9fa; + border: 1px solid #e9ecef; + border-radius: 0.375rem; + padding: 1rem; + margin-top: 1rem; +} + +.preset-preview h6 { + color: #495057; + margin-bottom: 0.5rem; +} + +.preset-preview .preview-params { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 0.5rem; +} + +.preset-preview .preview-param { + display: flex; + justify-content: space-between; + padding: 0.25rem 0; + border-bottom: 1px solid #e9ecef; +} + +.preset-preview .preview-param:last-child { + border-bottom: none; +} + +.preset-preview .preview-param strong { + color: #495057; + font-size: 0.875rem; +} + +.preset-preview .preview-param span { + color: #6c757d; + font-size: 0.8rem; +} diff --git a/src/web/static/js/dashboard.js b/src/web/static/js/dashboard.js index a193fa0..270affa 100644 --- a/src/web/static/js/dashboard.js +++ b/src/web/static/js/dashboard.js @@ -1198,9 +1198,14 @@ class TSPDashboard {
- +
+ + +
@@ -1262,17 +1267,748 @@ class TSPDashboard { } } + async viewWorkOrderDetails(workorderId) { + try { + const response = await fetch(`/api/workorders/${workorderId}`); + const workorder = await response.json(); + + if (workorder.error) { + this.showNotification('鑾峰彇宸ュ崟璇︽儏澶辫触', 'error'); + return; + } + + this.showWorkOrderDetailsModal(workorder); + } catch (error) { + console.error('鑾峰彇宸ュ崟璇︽儏澶辫触:', error); + this.showNotification('鑾峰彇宸ュ崟璇︽儏澶辫触', 'error'); + } + } + + showWorkOrderDetailsModal(workorder) { + // 鍒涘缓妯℃佹HTML + const modalHtml = ` + + `; + + // 绉婚櫎宸插瓨鍦ㄧ殑妯℃佹 + const existingModal = document.getElementById('workOrderDetailsModal'); + if (existingModal) { + existingModal.remove(); + } + + // 娣诲姞鏂扮殑妯℃佹鍒伴〉闈 + document.body.insertAdjacentHTML('beforeend', modalHtml); + + // 鏄剧ず妯℃佹 + const modal = new bootstrap.Modal(document.getElementById('workOrderDetailsModal')); + modal.show(); + + // 妯℃佹鍏抽棴鏃剁Щ闄OM鍏冪礌 + document.getElementById('workOrderDetailsModal').addEventListener('hidden.bs.modal', function() { + this.remove(); + }); + } + + async updateWorkOrder(workorderId) { + try { + // 鑾峰彇宸ュ崟璇︽儏 + const response = await fetch(`/api/workorders/${workorderId}`); + const workorder = await response.json(); + + if (response.ok) { + this.showEditWorkOrderModal(workorder); + } else { + throw new Error(workorder.error || '鑾峰彇宸ュ崟璇︽儏澶辫触'); + } + } catch (error) { + console.error('鑾峰彇宸ュ崟璇︽儏澶辫触:', error); + this.showNotification('鑾峰彇宸ュ崟璇︽儏澶辫触: ' + error.message, 'error'); + } + } + + showEditWorkOrderModal(workorder) { + // 鍒涘缓缂栬緫宸ュ崟妯℃佹 + const modalHtml = ` + + `; + + // 绉婚櫎宸插瓨鍦ㄧ殑妯℃佹 + const existingModal = document.getElementById('editWorkOrderModal'); + if (existingModal) { + existingModal.remove(); + } + + // 娣诲姞鏂版ā鎬佹鍒伴〉闈 + document.body.insertAdjacentHTML('beforeend', modalHtml); + + // 鏄剧ず妯℃佹 + const modal = new bootstrap.Modal(document.getElementById('editWorkOrderModal')); + modal.show(); + + // 妯℃佹鍏抽棴鏃舵竻鐞 + document.getElementById('editWorkOrderModal').addEventListener('hidden.bs.modal', function() { + this.remove(); + }); + } + + async saveWorkOrder(workorderId) { + try { + // 鑾峰彇琛ㄥ崟鏁版嵁 + const formData = { + title: document.getElementById('editTitle').value, + description: document.getElementById('editDescription').value, + category: document.getElementById('editCategory').value, + priority: document.getElementById('editPriority').value, + status: document.getElementById('editStatus').value, + resolution: document.getElementById('editResolution').value, + satisfaction_score: parseInt(document.getElementById('editSatisfactionScore').value) || null + }; + + // 楠岃瘉蹇呭~瀛楁 + if (!formData.title.trim() || !formData.description.trim()) { + this.showNotification('鏍囬鍜屾弿杩颁笉鑳戒负绌', 'error'); + return; + } + + // 鍙戦佹洿鏂拌姹 + const response = await fetch(`/api/workorders/${workorderId}`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(formData) + }); + + const result = await response.json(); + + if (response.ok) { + this.showNotification('宸ュ崟鏇存柊鎴愬姛', 'success'); + // 鍏抽棴妯℃佹 + const modal = bootstrap.Modal.getInstance(document.getElementById('editWorkOrderModal')); + modal.hide(); + // 鍒锋柊宸ュ崟鍒楄〃 + this.loadWorkOrders(); + } else { + throw new Error(result.error || '鏇存柊宸ュ崟澶辫触'); + } + } catch (error) { + console.error('鏇存柊宸ュ崟澶辫触:', error); + this.showNotification('鏇存柊宸ュ崟澶辫触: ' + error.message, 'error'); + } + } + + // 宸ュ崟瀵煎叆鍔熻兘 + showImportModal() { + // 鏄剧ず瀵煎叆妯℃佹 + const modal = new bootstrap.Modal(document.getElementById('importWorkOrderModal')); + modal.show(); + + // 閲嶇疆琛ㄥ崟 + document.getElementById('excel-file-input').value = ''; + document.getElementById('import-progress').classList.add('d-none'); + document.getElementById('import-result').classList.add('d-none'); + } + + async downloadTemplate() { + try { + const response = await fetch('/api/workorders/import/template'); + const result = await response.json(); + + if (result.success) { + // 鍒涘缓涓嬭浇閾炬帴 + const link = document.createElement('a'); + link.href = result.template_url; + link.download = '宸ュ崟瀵煎叆妯℃澘.xlsx'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + + this.showNotification('妯℃澘涓嬭浇鎴愬姛', 'success'); + } else { + throw new Error(result.error || '涓嬭浇妯℃澘澶辫触'); + } + } catch (error) { + console.error('涓嬭浇妯℃澘澶辫触:', error); + this.showNotification('涓嬭浇妯℃澘澶辫触: ' + error.message, 'error'); + } + } + + async importWorkOrders() { + const fileInput = document.getElementById('excel-file-input'); + const file = fileInput.files[0]; + + if (!file) { + this.showNotification('璇烽夋嫨瑕佸鍏ョ殑Excel鏂囦欢', 'error'); + return; + } + + // 楠岃瘉鏂囦欢绫诲瀷 + if (!file.name.match(/\.(xlsx|xls)$/)) { + this.showNotification('鍙敮鎸丒xcel鏂囦欢(.xlsx, .xls)', 'error'); + return; + } + + // 楠岃瘉鏂囦欢澶у皬 + if (file.size > 16 * 1024 * 1024) { + this.showNotification('鏂囦欢澶у皬涓嶈兘瓒呰繃16MB', 'error'); + return; + } + + // 鏄剧ず杩涘害鏉 + document.getElementById('import-progress').classList.remove('d-none'); + document.getElementById('import-result').classList.add('d-none'); + + try { + // 鍒涘缓FormData + const formData = new FormData(); + formData.append('file', file); + + // 鍙戦佸鍏ヨ姹 + const response = await fetch('/api/workorders/import', { + method: 'POST', + body: formData + }); + + const result = await response.json(); + + if (response.ok && result.success) { + // 鏄剧ず鎴愬姛娑堟伅 + document.getElementById('import-progress').classList.add('d-none'); + document.getElementById('import-result').classList.remove('d-none'); + document.getElementById('import-success-message').textContent = + `鎴愬姛瀵煎叆 ${result.imported_count} 涓伐鍗昤; + + this.showNotification(result.message, 'success'); + + // 鍒锋柊宸ュ崟鍒楄〃 + this.loadWorkOrders(); + + // 3绉掑悗鍏抽棴妯℃佹 + setTimeout(() => { + const modal = bootstrap.Modal.getInstance(document.getElementById('importWorkOrderModal')); + modal.hide(); + }, 3000); + + } else { + throw new Error(result.error || '瀵煎叆宸ュ崟澶辫触'); + } + + } catch (error) { + console.error('瀵煎叆宸ュ崟澶辫触:', error); + document.getElementById('import-progress').classList.add('d-none'); + this.showNotification('瀵煎叆宸ュ崟澶辫触: ' + error.message, 'error'); + } + } + // 鏁版嵁鍒嗘瀽 async loadAnalytics() { try { const response = await fetch('/api/analytics'); const analytics = await response.json(); this.updateAnalyticsDisplay(analytics); + this.initializeCharts(); } catch (error) { console.error('鍔犺浇鍒嗘瀽鏁版嵁澶辫触:', error); } } + // 鍒濆鍖栧浘琛 + initializeCharts() { + this.charts = {}; + this.updateCharts(); + } + + // 鏇存柊鎵鏈夊浘琛 + async updateCharts() { + try { + const timeRange = document.getElementById('timeRange').value; + const chartType = document.getElementById('chartType').value; + const dataDimension = document.getElementById('dataDimension').value; + + // 鑾峰彇鏁版嵁 + const response = await fetch(`/api/analytics?timeRange=${timeRange}&dimension=${dataDimension}`); + const data = await response.json(); + + // 鏇存柊缁熻鍗$墖 + this.updateStatisticsCards(data); + + // 鏇存柊鍥捐〃 + this.updateMainChart(data, chartType); + this.updateDistributionChart(data); + this.updateTrendChart(data); + this.updatePriorityChart(data); + + // 鏇存柊鍒嗘瀽鎶ュ憡 + this.updateAnalyticsReport(data); + + } catch (error) { + console.error('鏇存柊鍥捐〃澶辫触:', error); + this.showNotification('鏇存柊鍥捐〃澶辫触: ' + error.message, 'error'); + } + } + + // 鏇存柊缁熻鍗$墖 + updateStatisticsCards(data) { + const total = data.workorders?.total || 0; + const open = data.workorders?.open || 0; + const resolved = data.workorders?.resolved || 0; + const avgSatisfaction = data.satisfaction?.average || 0; + + document.getElementById('totalWorkorders').textContent = total; + document.getElementById('openWorkorders').textContent = open; + document.getElementById('resolvedWorkorders').textContent = resolved; + document.getElementById('avgSatisfaction').textContent = avgSatisfaction.toFixed(1); + + // 鏇存柊杩涘害鏉 + if (total > 0) { + document.getElementById('openProgress').style.width = `${(open / total) * 100}%`; + document.getElementById('resolvedProgress').style.width = `${(resolved / total) * 100}%`; + document.getElementById('satisfactionProgress').style.width = `${(avgSatisfaction / 5) * 100}%`; + } + } + + // 鏇存柊涓诲浘琛 + updateMainChart(data, chartType) { + const ctx = document.getElementById('mainChart').getContext('2d'); + + // 閿姣佺幇鏈夊浘琛 + if (this.charts.mainChart) { + this.charts.mainChart.destroy(); + } + + const chartData = this.prepareChartData(data, chartType); + + this.charts.mainChart = new Chart(ctx, { + type: chartType, + data: chartData, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + title: { + display: true, + text: '鏁版嵁鍒嗘瀽瓒嬪娍' + }, + legend: { + display: true, + position: 'top' + } + }, + scales: chartType === 'pie' || chartType === 'doughnut' ? {} : { + x: { + display: true, + title: { + display: true, + text: '鏃堕棿' + } + }, + y: { + display: true, + title: { + display: true, + text: '鏁伴噺' + } + } + } + } + }); + } + + // 鏇存柊鍒嗗竷鍥捐〃 + updateDistributionChart(data) { + const ctx = document.getElementById('distributionChart').getContext('2d'); + + if (this.charts.distributionChart) { + this.charts.distributionChart.destroy(); + } + + const categories = data.workorders?.by_category || {}; + const labels = Object.keys(categories); + const values = Object.values(categories); + + this.charts.distributionChart = new Chart(ctx, { + type: 'doughnut', + data: { + labels: labels, + datasets: [{ + data: values, + backgroundColor: [ + '#FF6384', + '#36A2EB', + '#FFCE56', + '#4BC0C0', + '#9966FF', + '#FF9F40' + ] + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + title: { + display: true, + text: '宸ュ崟鍒嗙被鍒嗗竷' + }, + legend: { + display: true, + position: 'bottom' + } + } + } + }); + } + + // 鏇存柊瓒嬪娍鍥捐〃 + updateTrendChart(data) { + const ctx = document.getElementById('trendChart').getContext('2d'); + + if (this.charts.trendChart) { + this.charts.trendChart.destroy(); + } + + const trendData = data.trend || []; + const labels = trendData.map(item => item.date); + const workorders = trendData.map(item => item.workorders); + const alerts = trendData.map(item => item.alerts); + + this.charts.trendChart = new Chart(ctx, { + type: 'line', + data: { + labels: labels, + datasets: [{ + label: '宸ュ崟鏁伴噺', + data: workorders, + borderColor: '#36A2EB', + backgroundColor: 'rgba(54, 162, 235, 0.1)', + tension: 0.4 + }, { + label: '棰勮鏁伴噺', + data: alerts, + borderColor: '#FF6384', + backgroundColor: 'rgba(255, 99, 132, 0.1)', + tension: 0.4 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + title: { + display: true, + text: '鏃堕棿瓒嬪娍鍒嗘瀽' + } + }, + scales: { + x: { + display: true, + title: { + display: true, + text: '鏃ユ湡' + } + }, + y: { + display: true, + title: { + display: true, + text: '鏁伴噺' + } + } + } + } + }); + } + + // 鏇存柊浼樺厛绾у浘琛 + updatePriorityChart(data) { + const ctx = document.getElementById('priorityChart').getContext('2d'); + + if (this.charts.priorityChart) { + this.charts.priorityChart.destroy(); + } + + const priorities = data.workorders?.by_priority || {}; + const labels = Object.keys(priorities).map(p => this.getPriorityText(p)); + const values = Object.values(priorities); + + this.charts.priorityChart = new Chart(ctx, { + type: 'bar', + data: { + labels: labels, + datasets: [{ + label: '宸ュ崟鏁伴噺', + data: values, + backgroundColor: [ + '#28a745', // 浣 - 缁胯壊 + '#ffc107', // 涓 - 榛勮壊 + '#fd7e14', // 楂 - 姗欒壊 + '#dc3545' // 绱ф - 绾㈣壊 + ] + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + title: { + display: true, + text: '浼樺厛绾у垎甯' + } + }, + scales: { + y: { + beginAtZero: true + } + } + } + }); + } + + // 鍑嗗鍥捐〃鏁版嵁 + prepareChartData(data, chartType) { + const trendData = data.trend || []; + const labels = trendData.map(item => item.date); + const workorders = trendData.map(item => item.workorders); + + if (chartType === 'pie' || chartType === 'doughnut') { + const categories = data.workorders?.by_category || {}; + return { + labels: Object.keys(categories), + datasets: [{ + data: Object.values(categories), + backgroundColor: [ + '#FF6384', + '#36A2EB', + '#FFCE56', + '#4BC0C0', + '#9966FF', + '#FF9F40' + ] + }] + }; + } else { + return { + labels: labels, + datasets: [{ + label: '宸ュ崟鏁伴噺', + data: workorders, + borderColor: '#36A2EB', + backgroundColor: 'rgba(54, 162, 235, 0.1)', + tension: chartType === 'line' ? 0.4 : 0 + }] + }; + } + } + + // 瀵煎嚭鍥捐〃 + exportChart(chartId) { + if (this.charts[chartId]) { + const link = document.createElement('a'); + link.download = `${chartId}_chart.png`; + link.href = this.charts[chartId].toBase64Image(); + link.click(); + } + } + + // 鍏ㄥ睆鍥捐〃 + fullscreenChart(chartId) { + // 杩欓噷鍙互瀹炵幇鍏ㄥ睆鏄剧ず鍔熻兘 + this.showNotification('鍏ㄥ睆鍔熻兘寮鍙戜腑', 'info'); + } + + // 瀵煎嚭鎶ュ憡 + async exportReport() { + try { + const response = await fetch('/api/analytics/export'); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = 'analytics_report.xlsx'; + link.click(); + window.URL.revokeObjectURL(url); + } catch (error) { + console.error('瀵煎嚭鎶ュ憡澶辫触:', error); + this.showNotification('瀵煎嚭鎶ュ憡澶辫触: ' + error.message, 'error'); + } + } + + // 鎵撳嵃鎶ュ憡 + printReport() { + window.print(); + } + updateAnalyticsDisplay(analytics) { // 鏇存柊鍒嗘瀽鎶ュ憡 const reportContainer = document.getElementById('analytics-report'); diff --git a/src/web/templates/dashboard.html b/src/web/templates/dashboard.html index 28c8cd0..27d7ab1 100644 --- a/src/web/templates/dashboard.html +++ b/src/web/templates/dashboard.html @@ -844,9 +844,17 @@
宸ュ崟绠$悊
- +
+ + + +
@@ -914,43 +922,210 @@