Skip to content

Commit

Permalink
Merge pull request elizaOS#486 from bmgalego/improvements
Browse files Browse the repository at this point in the history
fix: agent loadCharacters file resolver
  • Loading branch information
bmgalego authored Nov 21, 2024
2 parents 60164cd + 02c8851 commit 13041fb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ export function parseArguments(): {
export async function loadCharacters(
charactersArg: string
): Promise<Character[]> {
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) {
Expand Down

0 comments on commit 13041fb

Please sign in to comment.