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:
赵杰 Jie Zhao (雄狮汽车科技)
2025-10-27 10:33:34 +08:00
parent 18d59b71cb
commit a4261ef06f
104 changed files with 14678 additions and 1675 deletions

View File

@@ -288,9 +288,6 @@ class QueryOptimizer:
category_counts = Counter([wo.category for wo in workorders])
priority_counts = Counter([wo.priority for wo in workorders])
# 调试信息
logger.info(f"工单状态统计: {dict(status_counts)}")
logger.info(f"工单总数: {total}")
# 处理状态映射(支持中英文状态)
status_mapping = {
@@ -317,8 +314,6 @@ class QueryOptimizer:
if not mapped:
logger.warning(f"未映射的状态: '{status}' (数量: {count})")
# 调试信息
logger.info(f"映射后的状态统计: {mapped_counts}")
resolved_count = mapped_counts['resolved']
@@ -394,9 +389,6 @@ class QueryOptimizer:
if len(self.query_stats[query_name]) > 100:
self.query_stats[query_name] = self.query_stats[query_name][-100:]
# 记录慢查询
if query_time > self.slow_query_threshold:
logger.warning(f"慢查询检测: {query_name} 耗时 {query_time:.2f}s")
def get_query_performance_report(self) -> Dict[str, Any]:
"""获取查询性能报告"""
@@ -438,7 +430,6 @@ class QueryOptimizer:
logger.warning(f"创建索引失败: {e}")
session.commit()
logger.info("数据库索引优化完成")
return True
except Exception as e: