Skip to content

Commit b5dc632

Browse files
authored
Merge branch 'develop' into fix-ts
2 parents efac71d + f3538d0 commit b5dc632

File tree

9 files changed

+2892
-18148
lines changed

9 files changed

+2892
-18148
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ tsup.config.bundled_*.mjs
5252

5353
coverage
5454
.eslintcache
55+
56+
agent/content

agent/src/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -400,17 +400,20 @@ export async function initializeClients(
400400
elizaLogger.log("client keys", Object.keys(clients));
401401

402402
// TODO: Add Slack client to the list
403+
// Initialize clients as an object
404+
405+
403406
if (clientTypes.includes("slack")) {
404407
const slackClient = await SlackClientInterface.start(runtime);
405-
if (slackClient) clients.push(slackClient);
408+
if (slackClient) clients.slack = slackClient; // Use object property instead of push
406409
}
407410

408411
if (character.plugins?.length > 0) {
409412
for (const plugin of character.plugins) {
410-
// if plugin has clients, add those..
411413
if (plugin.clients) {
412414
for (const client of plugin.clients) {
413-
clients.push(await client.start(runtime));
415+
const startedClient = await client.start(runtime);
416+
clients[client.name] = startedClient; // Assuming client has a name property
414417
}
415418
}
416419
}

characters/trump.character.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trump",
3-
"clients": [],
3+
"clients": ["slack"],
44
"modelProvider": "openai",
55
"settings": {
66
"secrets": {},

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
},
5353
"dependencies": {
5454
"@0glabs/0g-ts-sdk": "0.2.1",
55+
"@ai16z/adapter-postgres": "0.1.6-alpha.4",
5556
"@coinbase/coinbase-sdk": "0.10.0",
5657
"@deepgram/sdk": "^3.9.0",
5758
"@vitest/eslint-plugin": "1.0.1",

packages/client-discord/src/actions/chat_with_attachments.ts

+31-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
ModelClass,
1313
State,
1414
} from "@ai16z/eliza";
15+
import * as fs from 'fs';
16+
1517
export const summarizationTemplate = `# Summarized so far (we are adding to this)
1618
{{currentSummary}}
1719
@@ -225,16 +227,35 @@ ${currentSummary.trim()}
225227
`;
226228
await callback(callbackData);
227229
} else if (currentSummary.trim()) {
228-
const summaryFilename = `content/summary_${Date.now()}`;
229-
await runtime.cacheManager.set(summaryFilename, currentSummary);
230-
// save the summary to a file
231-
await callback(
232-
{
233-
...callbackData,
234-
text: `I've attached the summary of the requested attachments as a text file.`,
235-
},
236-
[summaryFilename]
237-
);
230+
const summaryFilename = `content/summary_${Date.now()}.md`;
231+
232+
try {
233+
// Debug: Log before file operations
234+
console.log("Creating summary file:", {
235+
filename: summaryFilename,
236+
summaryLength: currentSummary.length
237+
});
238+
239+
// Write file directly first
240+
await fs.promises.writeFile(summaryFilename, currentSummary, 'utf8');
241+
console.log("File written successfully");
242+
243+
// Then cache it
244+
await runtime.cacheManager.set(summaryFilename, currentSummary);
245+
console.log("Cache set operation completed");
246+
247+
await callback(
248+
{
249+
...callbackData,
250+
text: `I've attached the summary of the requested attachments as a text file.`,
251+
},
252+
[summaryFilename]
253+
);
254+
console.log("Callback completed with summary file");
255+
} catch (error) {
256+
console.error("Error in file/cache process:", error);
257+
throw error;
258+
}
238259
} else {
239260
console.warn(
240261
"Empty response from chat with attachments action, skipping"

packages/client-slack/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ settings:
7878
7. On the "Basic Information" page, scroll down to "App Credentials"
7979
8. Copy all the credentials - you'll need them in Step 3
8080
81+
### Step 2.5: Verify Event Subscription
82+
Before proceeding to install the app, make sure to verify the event subscription:
83+
84+
1. In your Slack App settings, go to "Event Subscriptions."
85+
2. Enter the request URL (your ngrok HTTPS URL followed by /slack/events).
86+
3. Slack will send a verification request to this URL.
87+
4. Ensure your server is running and configured to respond to the url_verification event by echoing back the challenge token provided in the request.
88+
5. Once verified, you will see a confirmation in your Slack app settings.
89+
8190
### Step 3: Configure Environment Variables
8291
1. Create or edit `.env` file in your project root:
8392
```bash

packages/client-slack/src/environment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ export async function validateSlackConfig(runtime: IAgentRuntime): Promise<Slack
4141
}
4242
throw error;
4343
}
44-
}
44+
}

packages/client-twitter/src/post.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ export class TwitterPostClient {
175175
generateNewTweetLoop();
176176

177177
// Add check for ENABLE_ACTION_PROCESSING before starting the loop
178-
const enableActionProcessing = parseBooleanFromText(
179-
this.runtime.getSetting("ENABLE_ACTION_PROCESSING") ?? "true"
180-
);
178+
const enableActionProcessing = this.runtime.getSetting("ENABLE_ACTION_PROCESSING") ?? false;
181179

182180
if (enableActionProcessing) {
183181
processActionsLoop().catch((error) => {

0 commit comments

Comments
 (0)