feat: optimize AI suggestion and workorder sync - support same-day multiple update numbering - insert new suggestions at top maintaining reverse chronological order - reference process history when generating suggestions - simplify prompts to avoid forcing log analysis - fix Chinese comment encoding issues
This commit is contained in:
Binary file not shown.
BIN
src/web/__pycache__/error_handlers.cpython-311.pyc
Normal file
BIN
src/web/__pycache__/error_handlers.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/__pycache__/service_manager.cpython-311.pyc
Normal file
BIN
src/web/__pycache__/service_manager.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/web/blueprints/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/alerts.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/alerts.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/conversations.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/conversations.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/core.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/core.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/feishu_sync.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/feishu_sync.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/knowledge.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/knowledge.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/monitoring.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/monitoring.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/system.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/system.cpython-311.pyc
Normal file
Binary file not shown.
BIN
src/web/blueprints/__pycache__/workorders.cpython-311.pyc
Normal file
BIN
src/web/blueprints/__pycache__/workorders.cpython-311.pyc
Normal file
Binary file not shown.
@@ -14,9 +14,10 @@ from src.web.error_handlers import handle_api_errors, create_error_response, cre
|
||||
knowledge_bp = Blueprint('knowledge', __name__, url_prefix='/api/knowledge')
|
||||
|
||||
def get_agent_assistant():
|
||||
"""获取Agent助手实例(懒加载)"""
|
||||
"""获取Agent助手实例()"""
|
||||
global _agent_assistant
|
||||
if '_agent_assistant' not in globals():
|
||||
from src.agent_assistant import TSPAgentAssistant
|
||||
_agent_assistant = TSPAgentAssistant()
|
||||
return _agent_assistant
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
服务管理器
|
||||
统一管理各种服务的懒加载实例
|
||||
"""
|
||||
|
||||
from typing import Optional, Dict, Any
|
||||
@@ -11,17 +10,14 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ServiceManager:
|
||||
"""服务管理器 - 统一管理各种服务的懒加载实例"""
|
||||
|
||||
def __init__(self):
|
||||
self._services: Dict[str, Any] = {}
|
||||
|
||||
def get_service(self, service_name: str, factory_func):
|
||||
"""获取服务实例(懒加载)"""
|
||||
"""获取服务实例"""
|
||||
if service_name not in self._services:
|
||||
try:
|
||||
self._services[service_name] = factory_func()
|
||||
logger.info(f"服务 {service_name} 已初始化")
|
||||
except Exception as e:
|
||||
logger.error(f"初始化服务 {service_name} 失败: {e}")
|
||||
raise
|
||||
@@ -59,12 +55,11 @@ class ServiceManager:
|
||||
"""清除指定服务实例"""
|
||||
if service_name in self._services:
|
||||
del self._services[service_name]
|
||||
logger.info(f"服务 {service_name} 已清除")
|
||||
|
||||
def clear_all_services(self):
|
||||
"""清除所有服务实例"""
|
||||
self._services.clear()
|
||||
logger.info("所有服务实例已清除")
|
||||
|
||||
|
||||
|
||||
# 全局服务管理器实例
|
||||
|
||||
@@ -259,10 +259,10 @@ class WebSocketServer:
|
||||
):
|
||||
await asyncio.Future() # 保持服务器运行
|
||||
|
||||
def _process_request(self, path, request_headers):
|
||||
def _process_request(self, path, request):
|
||||
"""处理HTTP请求,支持CORS"""
|
||||
# 检查是否是WebSocket升级请求
|
||||
if request_headers.get("Upgrade", "").lower() == "websocket":
|
||||
if request.headers.get("Upgrade", "").lower() == "websocket":
|
||||
return None # 允许WebSocket连接
|
||||
|
||||
# 对于非WebSocket请求,返回简单的HTML页面
|
||||
|
||||
Reference in New Issue
Block a user