Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: agent loadCharacters file resolver #486

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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