Skip to content

Commit

Permalink
Merge branch 'develop' into fix/typo
Browse files Browse the repository at this point in the history
  • Loading branch information
monilpat authored Dec 19, 2024
2 parents b7eca66 + 6cb9134 commit d552cf8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ TWITTER_COOKIES= # Account cookies
TWITTER_POLL_INTERVAL=120 # How often (in seconds) the bot should check for interactions
TWITTER_SEARCH_ENABLE=FALSE # Enable timeline search, WARNING this greatly increases your chance of getting banned
TWITTER_TARGET_USERS= # Comma separated list of Twitter user names to interact with
TWITTER_RETRY_LIMIT= # Maximum retry attempts for Twitter login

X_SERVER_URL=
XAI_API_KEY=
Expand Down
4 changes: 2 additions & 2 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ function initializeDbCache(character: Character, db: IDatabaseCacheAdapter) {

async function startAgent(
character: Character,
directClient
directClient: DirectClient
): Promise<AgentRuntime> {
let db: IDatabaseAdapter & IDatabaseCacheAdapter;
try {
Expand Down Expand Up @@ -653,7 +653,7 @@ const startAgents = async () => {
}

// upload some agent functionality into directClient
directClient.startAgent = async (character) => {
directClient.startAgent = async (character: Character) => {
// wrap it so we don't have to inject directClient later
return startAgent(character, directClient);
};
Expand Down
5 changes: 4 additions & 1 deletion client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { defineConfig } from "vite";
import topLevelAwait from "vite-plugin-top-level-await";
import react from "@vitejs/plugin-react";
import wasm from "vite-plugin-wasm";
import { config } from "dotenv";

config({ path: path.resolve(__dirname, "../.env") });

// https://vite.dev/config/
export default defineConfig({
Expand All @@ -26,7 +29,7 @@ export default defineConfig({
server: {
proxy: {
"/api": {
target: "http://localhost:3000",
target: `http://localhost:${process.env.SERVER_PORT || 3000}`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
Expand Down
5 changes: 4 additions & 1 deletion packages/client-twitter/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export class ClientBase extends EventEmitter {
const username = this.runtime.getSetting("TWITTER_USERNAME");
const password = this.runtime.getSetting("TWITTER_PASSWORD");
const email = this.runtime.getSetting("TWITTER_EMAIL");
let retries = parseInt(
this.runtime.getSetting("TWITTER_RETRY_LIMIT") || "5",
10
);
const twitter2faSecret =
this.runtime.getSetting("TWITTER_2FA_SECRET") || undefined;
const cookies = this.runtime.getSetting("TWITTER_COOKIES");
Expand All @@ -180,7 +184,6 @@ export class ClientBase extends EventEmitter {
}

elizaLogger.log("Waiting for Twitter login");
let retries = 5; // Optional: Set a retry limit
while (retries > 0) {
const cookies = await this.twitterClient.getCookies();
if ((await this.twitterClient.isLoggedIn()) && !!cookies) {
Expand Down

0 comments on commit d552cf8

Please sign in to comment.