From 6e9ade9a448a3658bb3e6cf1ea6bffdec84a4b9a Mon Sep 17 00:00:00 2001 From: Bruno Galego Date: Thu, 21 Nov 2024 13:07:03 +0000 Subject: [PATCH] fix: fix loadCharacters resolver --- agent/src/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/agent/src/index.ts b/agent/src/index.ts index f9d444f5e61..3b39e741f54 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -68,14 +68,13 @@ export function parseArguments(): { export async function loadCharacters( charactersArg: string ): Promise { - let characterPaths = charactersArg - ?.split(",") - .map((path) => path.trim()) - .map((path) => { - if (path[0] === "/") return path; // handle absolute paths - // assume relative to the project root where pnpm is ran - return `../${path}`; - }); + let characterPaths = charactersArg?.split(",").map((filePath) => { + if (path.basename(filePath) === filePath) { + filePath = "./characters/" + filePath; + } + return path.resolve(process.cwd(), filePath.trim()); + }); + const loadedCharacters = []; if (characterPaths?.length > 0) {