Agent管理页面手动触发预检时,先删缓存再预检
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user