Skip to content

Commit

Permalink
make character.username optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bmgalego committed Nov 21, 2024
1 parent 06cc44f commit be5e605
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ function intializeDbCache(character: Character, db: IDatabaseCacheAdapter) {
async function startAgent(character: Character, directClient: DirectClient) {
try {
character.id ??= stringToUuid(character.name);
character.username ??= character.name;

const token = getTokenForProvider(character.modelProvider, character);
const dataDir = path.join(__dirname, "../data");
Expand All @@ -286,6 +287,8 @@ async function startAgent(character: Character, directClient: DirectClient) {
const cache = intializeDbCache(character, db);
const runtime = createAgent(character, db, cache, token);

await runtime.initialize();

const clients = await initializeClients(character, runtime);

directClient.registerAgent(runtime);
Expand Down Expand Up @@ -344,6 +347,7 @@ const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});

rl.on("SIGINT", () => {
rl.close();
process.exit(0);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export enum Clients {
export type Character = {
id?: UUID; // optional UUID which can be passed down to identify the character
name: string;
username: string;
username?: string;
system?: string;
modelProvider: ModelProviderName;
modelEndpointOverride?: string;
Expand Down

0 comments on commit be5e605

Please sign in to comment.