Agent管理页面手动触发预检时,先删缓存再预检

This commit is contained in:
xintaofei
2026-03-17 22:56:42 +08:00
parent ef3978a4fa
commit ff54505b6c
4 changed files with 28 additions and 11 deletions

View File

@@ -48,6 +48,10 @@ pub struct PreflightResult {
pub checks: Vec<CheckItem>,
}
pub fn clear_npm_env_cache() {
*NPM_ENV_CACHE.lock().unwrap() = None;
}
pub async fn run_preflight(agent_type: AgentType) -> PreflightResult {
let meta = registry::get_agent_meta(agent_type);
debug_assert_eq!(meta.agent_type, agent_type);

View File

@@ -992,7 +992,13 @@ fn build_runtime_env_from_setting(
}
#[tauri::command]
pub async fn acp_preflight(agent_type: AgentType) -> Result<PreflightResult, AcpError> {
pub async fn acp_preflight(
agent_type: AgentType,
force_refresh: Option<bool>,
) -> Result<PreflightResult, AcpError> {
if force_refresh.unwrap_or(false) {
preflight::clear_npm_env_cache();
}
Ok(preflight::run_preflight(agent_type).await)
}