Skip to content

Commit

Permalink
WIP comments
Browse files Browse the repository at this point in the history
  • Loading branch information
monilpat committed Dec 26, 2024
1 parent 781e641 commit 3a0a6e1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
4 changes: 4 additions & 0 deletions characters/logging-addict.character.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"model": "en_US-male-medium"
}
},
// TODO: Setup character so has capacity to load files from RAG. Github issue on how to do this more safely. Be accurate and use good standards. Don't know when / how / TBD
// TODO: Separate what we want them to load as relates to 10 categories and domains reference https://docs.google.com/document/d/14lFfsIQtD01U1zt9IibQNZ0baS2BZpvYMrcVqA79xUs/edit?pli=1&tab=t.0#heading=h.69bk8194ug4
// Where we want the character to sit in file, in documents, tagging etc.
// TODO: General Engineering character
"plugins": [],
"bio": [
"Always analyzes existing logging infrastructure before making recommendations, believing in extending and improving current patterns rather than replacing them entirely.",
Expand Down
33 changes: 18 additions & 15 deletions packages/client-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class GitHubClient extends EventEmitter {
this.runtime = runtime;
this.character = runtime.character;

this.runtime.registerAction(initializeRepositoryAction);
this.runtime.registerAction(createCommitAction);
this.runtime.registerAction(createMemoriesFromFilesAction);
this.runtime.registerAction(createPullRequestAction);
this.runtime.registerAction(createIssueAction);
this.runtime.registerAction(modifyIssueAction);
this.runtime.registerAction(addCommentToIssueAction);
this.runtime.registerAction(ideationAction);
this.runtime.registerAction(addCommentToPRAction);
// this.runtime.registerAction(initializeRepositoryAction);
// this.runtime.registerAction(createCommitAction);
// this.runtime.registerAction(createMemoriesFromFilesAction);
// this.runtime.registerAction(createPullRequestAction);
// this.runtime.registerAction(createIssueAction);
// this.runtime.registerAction(modifyIssueAction);
// this.runtime.registerAction(addCommentToIssueAction);
// this.runtime.registerAction(ideationAction);
// this.runtime.registerAction(addCommentToPRAction);
elizaLogger.log("GitHubClient actions and providers registered.");

// Start the OODA loop after initialization
Expand All @@ -55,11 +55,12 @@ export class GitHubClient extends EventEmitter {
}

private startOodaLoop() {
const interval = Number(this.runtime.getSetting("GITHUB_OODA_INTERVAL_MS")) || 300000; // Default to 5 minutes
elizaLogger.log("Starting OODA loop with interval:", interval);
setInterval(() => {
this.processOodaCycle();
}, interval);
this.processOodaCycle();
// const interval = Number(this.runtime.getSetting("GITHUB_OODA_INTERVAL_MS")) || 300000; // Default to 5 minutes
// elizaLogger.log("Starting OODA loop with interval:", interval);
// setInterval(() => {
// this.processOodaCycle();
// }, interval);
}

private async processOodaCycle() {
Expand All @@ -70,7 +71,7 @@ export class GitHubClient extends EventEmitter {
elizaLogger.error("GITHUB_OWNER or GITHUB_REPO is not set, skipping OODA cycle.");
throw new Error("GITHUB_OWNER or GITHUB_REPO is not set");
}

// TODO: We generate this, we want the default one that gets generated
const roomId = getRepositoryRoomId(this.runtime);
elizaLogger.log("Repository room ID:", roomId);

Expand Down Expand Up @@ -193,6 +194,7 @@ export class GitHubClient extends EventEmitter {
// time to initialize repository and create memories
const timestamp = Date.now();
const userIdUUID = stringToUuid(`${this.runtime.agentId}-${timestamp}`);
// TODO: Are we saving all the right values in content
const originalMemory: Memory = {
id: stringToUuid(`${roomId}-${this.runtime.agentId}-${timestamp}-original`),
userId: userIdUUID,
Expand Down Expand Up @@ -246,6 +248,7 @@ export class GitHubClient extends EventEmitter {
action: createMemoriesFromFilesMemory.content.action,
userId: this.runtime.agentId,
});
// This returns nothing no issue memories or pull request memories
const issuesMemories = await saveIssuesToMemory(this.runtime, owner, repository, this.apiToken);
elizaLogger.log("Issues memories:", issuesMemories);
const pullRequestsMemories = await savePullRequestsToMemory(this.runtime, owner, repository, this.apiToken);
Expand Down
1 change: 0 additions & 1 deletion packages/client-github/src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const oodaTemplate = `
}
\`\`\`
Examples:
1. CREATE_ISSUE:
{
Expand Down
5 changes: 4 additions & 1 deletion packages/plugin-github/src/plugins/addCommentToIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "../types";
import { addCommentToIssueTemplate, generateCommentForASpecificIssueTemplate } from "../templates";
import { getIssueFromMemories, incorporateRepositoryState } from "../utils";
import fs from "fs/promises";

export const addCommentToIssueAction: Action = {
name: "ADD_COMMENT_TO_ISSUE",
Expand Down Expand Up @@ -54,7 +55,9 @@ export const addCommentToIssueAction: Action = {
state: updatedState,
template: addCommentToIssueTemplate,
});

// Test all all values from the state are being loaded into the context (files, previousIssues, previousPRs, all issues all prs )
// write the context to a file for testing
await fs.writeFile("context.txt", context);
const details = await generateObject({
runtime,
context,
Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-github/src/plugins/addCommentToPR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "../types";
import { addCommentToPRTemplate, generateCommentForASpecificPRTemplate } from "../templates";
import { getPullRequestFromMemories, incorporateRepositoryState } from "../utils";
import fs from "fs/promises";

export const addCommentToPRAction: Action = {
name: "ADD_COMMENT_TO_PR",
Expand Down Expand Up @@ -54,7 +55,8 @@ export const addCommentToPRAction: Action = {
state: updatedState,
template: addCommentToPRTemplate,
});

// write the context to a file for testing
await fs.writeFile("context.txt", context);
const details = await generateObject({
runtime,
context,
Expand Down Expand Up @@ -100,7 +102,7 @@ export const addCommentToPRAction: Action = {
state: updatedState,
template: generateCommentForASpecificPRTemplate,
});

const commentDetails = await generateObject({
runtime,
context: commentContext,
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-github/src/plugins/ideationPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ideationTemplate } from "../templates";
import { IdeationSchema, isIdeationContent } from "../types";
import { getRepositoryRoomId, incorporateRepositoryState } from "../utils";
import fs from "fs/promises";

export const ideationAction: Action = {
name: "IDEATION",
similes: ["THINK","IDEATE", "IDEAS", "IDEATION", "CO_CREATION", "BRAINSTORM", "THOUGHTS", "SUGGESTIONS", "THINKING"],
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-github/src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Provide your response in the following JSON format:
* Goals Data: {{goalsData}}
* Recent Interactions: {{recentInteractions}}
* Here is the convo so far: {{formattedConversation}}
*/
export const initializeTemplate = `
Extract the details for initializing the GitHub repository:
Expand Down

0 comments on commit 3a0a6e1

Please sign in to comment.