From fad2c60605b67a44dc6d242cd99f6f79f1bd4b13 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 10 Feb 2025 14:47:37 +0800 Subject: refactor: improve run-agent/run-agent scripts (#160) --- scripts/run-agent.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'scripts/run-agent.js') diff --git a/scripts/run-agent.js b/scripts/run-agent.js index 6a14990..48096c7 100755 --- a/scripts/run-agent.js +++ b/scripts/run-agent.js @@ -106,15 +106,10 @@ async function loadEnv(filePath) { } async function run(agentName, agentPath, agentFunc, agentData) { - let mod; if (os.platform() === "win32") { agentPath = `file://${agentPath}`; } - try { - mod = await import(agentPath); - } catch { - throw new Error(`Unable to load agent tools at '${agentPath}'`); - } + const mod = await import(agentPath); if (!mod || !mod[agentFunc]) { throw new Error(`Not module function '${agentFunc}' at '${agentPath}'`); } -- cgit v1.2.3