Skip to content

Commit 1c1c4e3

Browse files
Merge branch 'ai16z:main' into resolve-conflicts
2 parents 418b613 + 666d5c1 commit 1c1c4e3

File tree

7 files changed

+34
-25
lines changed

7 files changed

+34
-25
lines changed

docs/docs/quickstart.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ Example for TWITTER_COOKIES
141141
The TWITTER_COOKIES variable should be a JSON string containing the necessary cookies. You can find these cookies in your web browser's developer tools. Here is an example format:
142142

143143
```bash
144-
TWITTER_COOKIES='[{"name":"auth_token","value":"your token","domain":".twitter.com"},
145-
{"name":"ct0","value":"your ct0","domain":".twitter.com"},
146-
{"name":"guest_id","value":"your guest_id","domain":".twitter.com"}]'
144+
TWITTER_COOKIES='[{"key":"auth_token","value":"your token","domain":".twitter.com"},
145+
{"key":"ct0","value":"your ct0","domain":".twitter.com"},
146+
{"key":"guest_id","value":"your guest_id","domain":".twitter.com"}]'
147147
```
148148

149+
Using TWITTER_COOKIES makes providing TWITTER_PASSWORD and TWITTER_EMAIL unnecessary. TWITTER_USERNAME is still required.
150+
149151
### Telegram Bot
150152

151153
1. Create a bot

packages/client-twitter/src/base.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class ClientBase extends EventEmitter {
8686
twitterClient: Scraper;
8787
runtime: IAgentRuntime;
8888
directions: string;
89-
lastCheckedTweetId: number | null = null;
89+
lastCheckedTweetId: bigint | null = null;
9090
imageDescriptionService: IImageDescriptionService;
9191
temperature: number = 0.5;
9292

@@ -588,20 +588,20 @@ export class ClientBase extends EventEmitter {
588588

589589
async loadLatestCheckedTweetId(): Promise<void> {
590590
const latestCheckedTweetId =
591-
await this.runtime.cacheManager.get<number>(
591+
await this.runtime.cacheManager.get<string>(
592592
`twitter/${this.profile.username}/latest_checked_tweet_id`
593593
);
594594

595595
if (latestCheckedTweetId) {
596-
this.lastCheckedTweetId = latestCheckedTweetId;
596+
this.lastCheckedTweetId = BigInt(latestCheckedTweetId);
597597
}
598598
}
599599

600600
async cacheLatestCheckedTweetId() {
601601
if (this.lastCheckedTweetId) {
602602
await this.runtime.cacheManager.set(
603603
`twitter/${this.profile.username}/latest_checked_tweet_id`,
604-
this.lastCheckedTweetId
604+
this.lastCheckedTweetId.toString()
605605
);
606606
}
607607
}

packages/client-twitter/src/interactions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class TwitterInteractionClient {
127127
for (const tweet of uniqueTweetCandidates) {
128128
if (
129129
!this.client.lastCheckedTweetId ||
130-
parseInt(tweet.id) > this.client.lastCheckedTweetId
130+
BigInt(tweet.id) > this.client.lastCheckedTweetId
131131
) {
132132
elizaLogger.log("New Tweet found", tweet.permanentUrl);
133133

@@ -167,7 +167,7 @@ export class TwitterInteractionClient {
167167
});
168168

169169
// Update the last checked tweet ID after processing each tweet
170-
this.client.lastCheckedTweetId = parseInt(tweet.id);
170+
this.client.lastCheckedTweetId = BigInt(tweet.id);
171171
}
172172
}
173173

packages/core/src/generation.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export async function generateText({
113113
);
114114

115115
switch (provider) {
116+
// OPENAI & LLAMACLOUD shared same structure.
116117
case ModelProviderName.OPENAI:
117118
case ModelProviderName.LLAMACLOUD: {
118119
elizaLogger.debug("Initializing OpenAI model.");
@@ -139,7 +140,7 @@ export async function generateText({
139140
case ModelProviderName.GOOGLE: {
140141
const google = createGoogleGenerativeAI();
141142

142-
const { text: anthropicResponse } = await aiGenerateText({
143+
const { text: googleResponse } = await aiGenerateText({
143144
model: google(model),
144145
prompt: context,
145146
system:
@@ -152,7 +153,8 @@ export async function generateText({
152153
presencePenalty: presence_penalty,
153154
});
154155

155-
response = anthropicResponse;
156+
response = googleResponse;
157+
elizaLogger.debug("Received response from Google model.");
156158
break;
157159
}
158160

@@ -280,7 +282,7 @@ export async function generateText({
280282
const serverUrl = models[provider].endpoint;
281283
const openai = createOpenAI({ apiKey, baseURL: serverUrl });
282284

283-
const { text: openaiResponse } = await aiGenerateText({
285+
const { text: redpillResponse } = await aiGenerateText({
284286
model: openai.languageModel(model),
285287
prompt: context,
286288
temperature: temperature,
@@ -293,8 +295,8 @@ export async function generateText({
293295
presencePenalty: presence_penalty,
294296
});
295297

296-
response = openaiResponse;
297-
elizaLogger.debug("Received response from OpenAI model.");
298+
response = redpillResponse;
299+
elizaLogger.debug("Received response from redpill model.");
298300
break;
299301
}
300302

packages/core/src/runtime.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,12 @@ export class AgentRuntime implements IAgentRuntime {
538538
return;
539539
}
540540

541-
elizaLogger.success(`Executing handler for action: ${action.name}`);
542-
await action.handler(this, message, state, {}, callback);
541+
try {
542+
elizaLogger.info(`Executing handler for action: ${action.name}`);
543+
await action.handler(this, message, state, {}, callback);
544+
} catch (error) {
545+
elizaLogger.error(error);
546+
}
543547
}
544548

545549
/**

packages/plugin-node/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"cldr-segmentation": "2.2.1",
2121
"command-exists": "1.2.9",
2222
"csv-writer": "1.6.0",
23-
"echogarden": "^2.0.5",
23+
"echogarden": "^2.0.7",
2424
"espeak-ng": "1.0.2",
2525
"ffmpeg-static": "5.2.0",
2626
"fluent-ffmpeg": "2.1.3",
@@ -80,4 +80,4 @@
8080
"onnxruntime-node": "^1.20.0",
8181
"sharp": "^0.33.5"
8282
}
83-
}
83+
}

pnpm-lock.yaml

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)