Skip to content

Commit

Permalink
Merge pull request #26 from JoinTheAlliance/moon/ignore-messages
Browse files Browse the repository at this point in the history
Replace content of ignored messages with *Ignore* in prompt
  • Loading branch information
lalalune authored Feb 21, 2024
2 parents a469f65 + 2821f4c commit dc96e06
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
**/coverage/*
**/dist/*
**/types/*
**/scripts/concatenated-output.ts
**/scripts/concatenated-output.ts
rollup.config.js
jest.config.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bgent",
"version": "0.0.13",
"version": "0.0.14",
"private": false,
"description": "bgent. because agent was taken.",
"type": "module",
Expand Down
8 changes: 7 additions & 1 deletion src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ export const formatMessages = ({
.reverse()
.filter((message: Memory) => message.user_id)
.map((message: Memory) => {
let messageContent =
(message.content as Content).content || (message.content as string);
const messageAction = (message.content as Content).action;
const sender = actors.find(
(actor: Actor) => actor.id === message.user_id,
)!;
return `${sender.name}: ${(message.content as Content).content || (message.content as string)} ${(message.content as Content).action && (message.content as Content).action !== "null" ? `(${(message.content as Content).action})` : ""}`;
if (messageAction === "IGNORE") {
messageContent = "*Ignored*";
}
return `${sender.name}: ${messageContent} ${messageAction && messageAction !== "null" ? `(${messageAction})` : ""}`;
})
.join("\n");
return messageStrings;
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"include": [
"src",
"__tests__",
"jest.config.js",
"rollup.config.js",
],
"exclude": [
"node_modules",
"dist"
"dist",
"jest.config.js",
"rollup.config.js",
]
}

0 comments on commit dc96e06

Please sign in to comment.