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

@@ -59,21 +59,36 @@ class TSPAgentAssistantCore(TSPAssistant):
if llm_config:
self.llm_manager = LLMManager(llm_config)
else:
# 使用默认配置 - 千问模型
# 从统一配置管理器获取LLM配置
try:
from config.llm_config import DEFAULT_CONFIG
self.llm_manager = LLMManager(DEFAULT_CONFIG)
except ImportError:
# 如果配置文件不存在,使用内置配置
default_config = LLMConfig(
provider="openai",
api_key="sk-your-qwen-api-key-here",
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
model="qwen-turbo",
temperature=0.7,
max_tokens=2000
from src.config.unified_config import get_config
unified_llm = get_config().llm
# 将统一配置的LLMConfig转换为agent需要的LLMConfig
agent_llm_config = LLMConfig(
provider=unified_llm.provider,
api_key=unified_llm.api_key,
base_url=unified_llm.base_url,
model=unified_llm.model,
temperature=unified_llm.temperature,
max_tokens=unified_llm.max_tokens
)
self.llm_manager = LLMManager(default_config)
self.llm_manager = LLMManager(agent_llm_config)
except Exception as e:
logger.warning(f"无法从统一配置加载LLM配置使用config/llm_config.py: {e}")
try:
from config.llm_config import DEFAULT_CONFIG
self.llm_manager = LLMManager(DEFAULT_CONFIG)
except ImportError:
# 最后的fallback
default_config = LLMConfig(
provider="qwen",
api_key="",
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
model="qwen-turbo",
temperature=0.7,
max_tokens=2000
)
self.llm_manager = LLMManager(default_config)
def get_agent_status(self) -> Dict[str, Any]:
"""获取Agent状态"""