Skip to content

Commit

Permalink
Merge pull request #5 from ai16z/main
Browse files Browse the repository at this point in the history
merge from main
  • Loading branch information
MarcoMandar authored Oct 28, 2024
2 parents 174d529 + bb3f397 commit 714bf6f
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ XAI_MODEL=
# For asking Claude stuff
ANTHROPIC_API_KEY=

WALLET_SECRET_KEY=2eETRBeJFNfxAmPzTxfRynebRjTYK9WBLeAE5JhfxdzAxjJG8ZCbmHX1WadTRdcEpE7HRELVp6cbCfZFY6Qw9BgR
WALLET_PUBLIC_KEY=DM1fSD9KfdJ2jaSmR9NGpPPVcDzBwsYg1STttYc5Bvay
WALLET_SECRET_KEY=EXAMPLE_WALLET_SECRET_KEY
WALLET_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY

BIRDEYE_API_KEY=

Expand Down
75 changes: 75 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Contributing to Eliza

First off, thank you for considering contributing to Eliza! It's people like you that make Eliza such a great tool. We welcome contributions from everyone, regardless of their experience level.

## Code of Conduct

By participating in this project, you are expected to uphold our Code of Conduct. Please report unacceptable behavior.

## How Can I Contribute?

### Reporting Bugs

1. Ensure the bug was not already reported by searching on GitHub under [Issues](https://github.com/ai16z/eliza/issues).
2. If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/ai16z/eliza/issues/new). Be sure to include

- a title and clear description,
- as much relevant information as possible, and
- a code sample or an executable test case demonstrating the expected behavior that is not occurring.

### Suggesting Enhancements

1. Open a new issue with a clear title and detailed description of the suggested enhancement.
2. Include any relevant examples or mock-ups if applicable.

### Pull Requests

1. Fork the repo and create your branch from `main`.
1. The name of the branch should start with the issue number and be descriptive of the changes you are making.
1. eg. 40--add-test-for-bug-123
2. If you've added code that should be tested, add tests.
3. Ensure the test suite passes.
4. Make sure your code lints.
5. Issue that pull request!

## Styleguides

### Git Commit Messages

- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line

### JavaScript Styleguide

- All JavaScript must adhere to [JavaScript Standard Style](https://standardjs.com/).

### TypeScript Styleguide

- All TypeScript must adhere to [TypeScript Standard Style](https://github.com/standard/ts-standard).

### Documentation Styleguide

- Use [Markdown](https://daringfireball.net/projects/markdown/) for documentation.

## Additional Notes

### Issue and Pull Request Labels

This section lists the labels we use to help us track and manage issues and pull requests.

- `bug` - Issues that are bugs.
- `enhancement` - Issues that are feature requests.
- `documentation` - Issues or pull requests related to documentation.
- `good first issue` - Good for newcomers.

## Recognition

We value every contribution. Contributors will be recognized in our README.md file. Significant contributions may be acknowledged with special roles or responsibilities within the project.

## Questions?

If you have any questions, please feel free to contact the project maintainers with an issue or in discord.

Thank you for your interest in contributing to Eliza!
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TWITTER_COOKIES= # Account cookies
If you have an NVIDIA GPU, you can install CUDA to speed up local inference dramatically.
```
npm install
npx --no node-llama-cpp download --gpu cuda
npx --no node-llama-cpp source download --gpu cuda
```

Make sure that you've installed the CUDA Toolkit, including cuDNN and cuBLAS.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"start:service:degen": "pm2 start npm --name=\"degen\" --restart-delay=3000 --max-restarts=10 -- run start:degen",
"stop:service:degen": "pm2 stop degen",
"start:degen": "node --loader ts-node/esm src/index.ts --characters=\"characters/degenspartan.json\"",
"start:service:all": "pm2 start npm --name=\"degen\" --restart-delay=3000 --max-restarts=10 -- run start:degen",
"start:service:all": "pm2 start npm --name=\"all\" --restart-delay=3000 --max-restarts=10 -- run start:degen",
"stop:service:all": "pm2 stop all",
"start:all": "node --loader ts-node/esm src/index.ts --characters=\"characters/degenspartan.json\",\"characters/ruby.character.json\"",
"start:trump": "node --loader ts-node/esm src/index.ts --characters=\"characters/trump.character.json\"",
Expand Down
4 changes: 2 additions & 2 deletions src/clients/twitter/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export class TwitterGenerationClient extends ClientBase {
(Math.floor(Math.random() * (45 - 15 + 1)) + 15) * 60 * 1000,
); // Random interval between 4-8 hours
};
setTimeout(() => {
// setTimeout(() => {
generateNewTweetLoop();
}, 5 * 60 * 1000); // Wait 5 minutes before starting the loop
// }, 5 * 60 * 1000); // Wait 5 minutes before starting the loop
}

constructor(runtime: IAgentRuntime) {
Expand Down
9 changes: 0 additions & 9 deletions src/core/defaultCharacter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ const defaultCharacter: Character = {
model: "gpt-4o-mini",
embeddingModel: "text-embedding-3-small",
secrets: {
DISCORD_APPLICATION_ID: null,
DISCORD_API_TOKEN: null,
TWITTER_USERNAME: "eliza__v1",
TWITTER_PASSWORD: null,
TWITTER_EMAIL: null,
PROXY_URL: null,
OPENAI_API_KEY: null,
ELEVENLABS_XI_API_KEY: null,
ANTHROPIC_API_KEY: null,
ELEVENLABS_VOICE_ID: null,
ELEVENLABS_VOICE_STABILITY: "0.5",
ELEVENLABS_VOICE_SIMILARITY_BOOST: "0.9",
ELEVENLABS_VOICE_STYLE: "0.66",
Expand Down
2 changes: 1 addition & 1 deletion src/core/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ Text: ${attachment.text}
const shuffledLore = [...this.character.lore].sort(
() => Math.random() - 0.5,
);
const selectedLore = shuffledLore.slice(0, 3);
const selectedLore = shuffledLore.slice(0, 10);
lore = selectedLore.join("\n");
}

Expand Down
68 changes: 35 additions & 33 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import unfollow_room from "./actions/unfollow_room.ts";
import unmute_room from "./actions/unmute_room.ts";
import { SqliteDatabaseAdapter } from "./adapters/sqlite.ts";
import { DiscordClient } from "./clients/discord/index.ts";
//import { TwitterSearchClient } from "./clients/twitter/search.ts";
import DirectClient from "./clients/direct/index.ts";
import { TelegramClient } from "./clients/telegram/src/index.ts"; // Added Telegram import
import { defaultActions } from "./core/actions.ts";
Expand All @@ -18,10 +17,10 @@ import settings from "./core/settings.ts";
import { Character, IAgentRuntime } from "./core/types.ts"; // Added IAgentRuntime
import boredomProvider from "./providers/boredom.ts";
import timeProvider from "./providers/time.ts";
// import walletProvider from "./providers/wallet.ts";
//import { TwitterInteractionClient } from "./clients/twitter/interactions.ts";
//import { TwitterGenerationClient } from "./clients/twitter/generate.ts";
//import { wait } from "./clients/twitter/utils.ts";
import { wait } from "./clients/twitter/utils.ts";
import { TwitterSearchClient } from "./clients/twitter/search.ts";
import { TwitterInteractionClient } from "./clients/twitter/interactions.ts";
import { TwitterGenerationClient } from "./clients/twitter/generate.ts";

interface Arguments {
character?: string;
Expand Down Expand Up @@ -86,12 +85,15 @@ if (characterPaths?.length > 0) {

async function startAgent(character: Character) {
console.log("Starting agent for character " + character.name);
const token = character.settings?.secrets?.OPENAI_API_KEY ||
(settings.OPENAI_API_KEY as string)

console.log("token", token);
const db = new SqliteDatabaseAdapter(new Database("./db.sqlite"))
const runtime = new AgentRuntime({
databaseAdapter: db,
token:
character.settings?.secrets?.OPENAI_API_KEY ??
(settings.OPENAI_API_KEY as string),
token,
serverUrl: "https://api.openai.com/v1",
model: "gpt-4o",
evaluators: [],
Expand Down Expand Up @@ -158,22 +160,22 @@ async function startAgent(character: Character) {
}
}

//async function startTwitter(runtime) {
// console.log("Starting search client");
// const twitterSearchClient = new TwitterSearchClient(runtime);
// await wait();
// console.log("Starting interaction client");
// const twitterInteractionClient = new TwitterInteractionClient(runtime);
// await wait();
// console.log("Starting generation client");
// const twitterGenerationClient = new TwitterGenerationClient(runtime);
//
// return {
// twitterInteractionClient,
// twitterSearchClient,
// twitterGenerationClient,
// };
//}
async function startTwitter(runtime) {
console.log("Starting search client");
const twitterSearchClient = new TwitterSearchClient(runtime);
await wait();
console.log("Starting interaction client");
const twitterInteractionClient = new TwitterInteractionClient(runtime);
await wait();
console.log("Starting generation client");
const twitterGenerationClient = new TwitterGenerationClient(runtime);

return {
twitterInteractionClient,
twitterSearchClient,
twitterGenerationClient,
};
}

if (!character.clients) {
return console.error("No clients found for character " + character.name);
Expand All @@ -200,16 +202,16 @@ async function startAgent(character: Character) {
}
}

//if (character.clients.map((str) => str.toLowerCase()).includes("twitter")) {
// const {
// twitterInteractionClient,
// twitterSearchClient,
// twitterGenerationClient,
// } = await startTwitter(runtime);
// clients.push(
// twitterInteractionClient, twitterSearchClient, twitterGenerationClient,
// );
//}
if (character.clients.map((str) => str.toLowerCase()).includes("twitter")) {
const {
twitterInteractionClient,
twitterSearchClient,
twitterGenerationClient,
} = await startTwitter(runtime);
clients.push(
twitterInteractionClient, twitterSearchClient, twitterGenerationClient,
);
}

directClient.registerAgent(directRuntime);

Expand Down

0 comments on commit 714bf6f

Please sign in to comment.