mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-03-28 14:56:24 +01:00
Merge pull request #179 from ereid7/feat-profile-arg
feat: support --profiles arg
This commit is contained in:
commit
7abf30c353
2 changed files with 39 additions and 5 deletions
|
@ -62,6 +62,11 @@ Bot profiles are json files (such as `andy.json`) that define:
|
|||
2. Prompts used to influence the bot's behavior.
|
||||
3. Examples help the bot perform tasks.
|
||||
|
||||
### Specifying Profiles via Command Line
|
||||
|
||||
By default, the program will use the profiles specified in `settings.js`. You can specify one or more agent profiles using the `--profiles` argument:
|
||||
|
||||
`node main.js --profiles ./profiles/andy.json ./profiles/jill.json`
|
||||
|
||||
### Model Specifications
|
||||
|
||||
|
|
39
main.js
39
main.js
|
@ -1,9 +1,38 @@
|
|||
import { AgentProcess } from './src/process/agent-process.js';
|
||||
import settings from './settings.js';
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
let profiles = settings.profiles;
|
||||
let load_memory = settings.load_memory;
|
||||
let init_message = settings.init_message;
|
||||
function parseArguments() {
|
||||
return yargs(hideBin(process.argv))
|
||||
.option('profiles', {
|
||||
type: 'array',
|
||||
describe: 'List of agent profile paths',
|
||||
})
|
||||
.help()
|
||||
.alias('help', 'h')
|
||||
.parse();
|
||||
}
|
||||
|
||||
for (let profile of profiles)
|
||||
new AgentProcess().start(profile, load_memory, init_message);
|
||||
function getProfiles(args) {
|
||||
return args.profiles || settings.profiles;
|
||||
}
|
||||
|
||||
function main() {
|
||||
const args = parseArguments();
|
||||
const profiles = getProfiles(args);
|
||||
console.log(profiles);
|
||||
const { load_memory, init_message } = settings;
|
||||
|
||||
for (const profile of profiles) {
|
||||
const agent = new AgentProcess();
|
||||
agent.start(profile, load_memory, init_message);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
main();
|
||||
} catch (error) {
|
||||
console.error('An error occurred:', error);
|
||||
process.exit(1);
|
||||
}
|
Loading…
Add table
Reference in a new issue