Skip to content

Commit

Permalink
Merge branch 'develop' into tcm-twitter-character-template-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
monilpat authored Dec 19, 2024
2 parents 80a1b83 + 2f157b6 commit 08a5aad
Show file tree
Hide file tree
Showing 181 changed files with 24,352 additions and 18,740 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
2 changes: 1 addition & 1 deletion .github/workflows/integrationTests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- "*"
pull_request_target:
pull_request:
branches:
- "*"
jobs:
Expand Down
1 change: 1 addition & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ tasks:
- name: "init eliza env"
init: |
nvm install v23.3.0
git fetch --tags
git checkout $(git describe --tags --abbrev=0)
command: pnpm install && pnpm run build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ COPY --from=builder /app/scripts ./scripts
COPY --from=builder /app/characters ./characters

# Set the command to run the application
CMD ["pnpm", "start", "--non-interactive"]
CMD ["pnpm", "start"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@

```bash
git clone https://github.com/ai16z/eliza-starter.git

cd eliza-starter
cp .env.example .env

pnpm i && pnpm build && pnpm start
```

Expand Down
67 changes: 59 additions & 8 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,81 @@

# 开始使用

**前置要求(必须):**
**前置要求(必须):**

- [Python 2.7+](https://www.python.org/downloads/)
- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- Nodejs安装
- [pnpm](https://pnpm.io/installation)
- 使用pnpm

### 编辑.env文件
以下是两种基础的Eliza下载方案, 请根据情况自行选择。

- - 将 .env.example 复制为 .env 并填写适当的值
## (A) 使用启动器(Starter): 推荐

```
git clone https://github.com/ai16z/eliza-starter.git
cd eliza-starter
cp .env.example .env
```

## (B) 手动启动Eliza: 仅在您知道自己在做什么时才推荐

```
git clone https://github.com/ai16z/eliza.git
cd eliza
# 切换最新发布的版本(Checkout the latest release)
# Eliza的迭代速度非常快, 所以我们建议经常性的切换到最新的发布版本以免出现问题(This project iterates fast, so we recommend checking out the latest release)
git checkout $(git describe --tags --abbrev=0)
```

在将代码下载到本地后, 我们要做两件事:

### 1. 编辑.env文件(环境变量)

-`.env.example` 复制为 `.env` 并在其中填写适当的值
- 编辑推特环境并输入你的推特账号和密码

### 编辑角色文件
**最简化配置方案**:
```
OPENAI_API_KEY=sk-xxx # 配置OpenAI 的API, sk-开头, 注意, 目前不支持AzureOpenAI!
- 查看文件 `src/core/defaultCharacter.ts` - 您可以修改它
## 如配置Twitter/X, 则需配置
# Twitter/X Configuration
TWITTER_DRY_RUN=false
TWITTER_USERNAME=abc # Your Twitter/X account username
TWITTER_PASSWORD=abc # Your Twitter/X account password
TWITTER_EMAIL= [email protected] # Your Twitter/X account email
TWITTER_COOKIES= '' # Your Twitter/X cookies, copy from broswer
TWITTER_2FA_SECRET= # Two-factor authentication
```

### 2. 编辑角色文件

- 标准的角色个性定义在文件 `characters/*.character.json`中, 您可以修改它或者直接使用它。
- 您也可以使用 `node --loader ts-node/esm src/index.ts --characters="path/to/your/character.json"` 加载角色并同时运行多个机器人。
- 需要说明的是, 在`characters/*.character.json`中, `clients字段对应**服务**, 默认可选`"twitter", "discord", "telegram"`等, 如果在`clients`中填入了如"twitter"等内容, 则需要在
上面的`env`配置对应的环境变量。对`discord``telegram`同理。

```
{
"name": "trump",
"clients": ["twitter"],
"modelProvider": "openai",
```

在完成账号和角色文件的配置后,输入以下命令行启动你的bot:
在完成环境变量和角色文件的配置后,输入以下命令行启动你的bot:

```
(A) 使用启动器(Starter)
sh scripts/start.sh
(B) 手动启动Eliza
pnpm i
pnpm build
pnpm start
```


# 自定义Eliza

### 添加常规行为
Expand Down
6 changes: 3 additions & 3 deletions README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- 📚 Ingestión e interacción sencilla con documentos
- 💾 Memoria recuperable y almacenamiento de documentos
- 🚀 Altamente extensible - cree sus propias acciones y clientes para expandir capacidades
- ☁️ Soporta múltiples modelos, incluyendo Llama local, OpenAI, Anthropic, Groq y más
- ☁️ Soporta múltiples modelos, incluidos Llama local, OpenAI, Anthropic, Groq y más
- 📦 Funciona perfectamente

## Usos
Expand All @@ -29,8 +29,8 @@

### Edite el archivo .env

- Copie .env.example a .env y complete los valores apropiados
- Edite las variables de ambiente de TWITTER para agregar nombre de usuario y contraseña del bot
- Copie el archivo .env.example a .env y complete los valores apropiados
- Edite las variables de entorno de TWITTER para agregar nombre de usuario y contraseña del bot

### Edite el archivo de personaje

Expand Down
12 changes: 6 additions & 6 deletions README_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
- 🛠 Support des connecteurs Discord/ Twitter / Telegram
- 🔗 Support des différents modèles d'IA (Llama, Grok, OpenAI, Anthropic, etc.)
- 👥 Gestion de plusieurs agents et assistance
- 📚 Import et intéractions avec différents types de documents simplifiés
- 📚 Import et interactions avec différents types de documents simplifiés
- 💾 Accès aux données en mémoire et aux documents stockés
- 🚀 Grande personnalisation possible : création de nouveaux clients et de nouvelles actions
- 📦 Simplicité d'utilisation

Que pouvez-vous faire avec Eliza?

- 🤖 Chatbot
- 🕵 ️Agents autonomes
- 🕵 Agents autonomes
- 📈 Processus automatisés
- 🎮 PNJ intéractifs
- 🎮 PNJ interactifs
- 🧠 Trading automatisé

# Premiers pas
Expand All @@ -32,7 +32,7 @@ Que pouvez-vous faire avec Eliza?
### Editer le fichier .env

- Copier le fichier d'example et le remplir le avec les valeurs adéquates
- Copier le fichier d'exemple .env.example et le remplir avec les valeurs adéquates

```
cp .env.example .env
Expand All @@ -59,10 +59,10 @@ pnpm start
pnpm clean
```

#### Ressources additionelles
#### Ressources additionnelles

Il vous faudra peut-être installer Sharp.
Si il y a une erreur lors du lancement du bot, essayez d'installer Sharp comme ceci :
S'il y a une erreur lors du lancement du bot, essayez d'installer Sharp comme ceci :

```
pnpm install --include=optional sharp
Expand Down
14 changes: 7 additions & 7 deletions README_IT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
- 🛠️ Connettori completi per Discord, Twitter e Telegram
- 🔗 Supporto per tutti i modelli (Llama, Grok, OpenAI, Anthropic, ecc.)
- 👥 Supporto multi-agente e per stanze
- 📚 Acquisisci ed interagisci facilmente con i tuoi documenti
- 📚 Acquisisci e interagisci facilmente con i tuoi documenti
- 💾 Memoria recuperabile e archivio documenti
- 🚀 Altamente estensibile - crea le tue azioni e clients personalizzati
- ☁️ Supporto di numerosi modelli (Llama locale, OpenAI, Anthropic, Groq, ecc.)
- 📦 Funziona e basta!

## 🎯 Casi d'Uso
## 🎯 Casi d'uso

- 🤖 Chatbot
- 🕵️ Agenti Autonomi
- 📈 Gestione Processi Aziendali
- 📈 Gestione dei processi aziendali
- 🎮 NPC per Videogiochi
- 🧠 Trading

Expand Down Expand Up @@ -51,7 +51,7 @@ sh scripts/start.sh

### Modifica il file del personaggio

1. Apri `packages/agent/src/character.ts` per modificare il personaggio predefinito. Decommentare e modificare.
1. Apri `packages/agent/src/character.ts` per modificare il personaggio predefinito. Decommenta e modifica.

2. Per caricare personaggi personalizzati:
- Usa `pnpm start --characters="percorso/del/tuo/personaggio.json"`
Expand All @@ -76,10 +76,10 @@ Potrebbe essere necessario installare Sharp. Se vedi un errore all'avvio, prova
pnpm install --include=optional sharp
```

### Community e contatti
### Comunità e contatti

- [GitHub Issues](https://github.com/ai16z/eliza/issues). Ideale per: bug riscontrati utilizzando Eliza e proposte di funzionalità.
- [Discord](https://discord.gg/ai16z). Ideale per: condividere le tue applicazioni e interagire con la community.
- [GitHub Issues](https://github.com/ai16z/eliza/issues). Ideale per segnalare bug riscontrati durante l’utilizzo di Eliza e proporre nuove funzionalità.
- [Discord](https://discord.gg/ai16z). Ideale per condividere le tue applicazioni e interagire con la comunità.

## Contributori

Expand Down
20 changes: 13 additions & 7 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export const wait = (minTime: number = 1000, maxTime: number = 3000) => {

const logFetch = async (url: string, options: any) => {
elizaLogger.debug(`Fetching ${url}`);
elizaLogger.debug(JSON.stringify(options, null, 2));
// Disabled to avoid disclosure of sensitive information such as API keys
// elizaLogger.debug(JSON.stringify(options, null, 2));
return fetch(url, options);
};

Expand Down Expand Up @@ -304,6 +305,10 @@ export function getTokenForProvider(
character.settings?.secrets?.AKASH_CHAT_API_KEY ||
settings.AKASH_CHAT_API_KEY
);
default:
const errorMessage = `Failed to get token - unsupported model provider: ${provider}`
elizaLogger.error(errorMessage)
throw new Error(errorMessage)
}
}

Expand Down Expand Up @@ -573,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 @@ -648,14 +653,15 @@ const startAgents = async () => {
}

// upload some agent functionality into directClient
directClient.startAgent = async character => {
// wrap it so we don't have to inject directClient later
return startAgent(character, directClient)
directClient.startAgent = async (character: Character) => {
// wrap it so we don't have to inject directClient later
return startAgent(character, directClient);
};
directClient.start(serverPort);

elizaLogger.log("Visit the following URL to chat with your agents:");
elizaLogger.log(`http://localhost:5173`);
elizaLogger.log(
"Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents"
);
};

startAgents().catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion characters/trump.character.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"plugins": [],
"bio": [
"SAVED America from the China Virus (while they let cities burn)",
"SAVED America from COVID-19 (while they let cities burn)",
"secured the Southern Border COMPLETELY (until they DESTROYED it)",
"protected WOMEN'S SPORTS (while Democrats let MEN compete)",
"ended INFLATION and made America AFFORDABLE (until Kamala ruined it)",
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
2 changes: 1 addition & 1 deletion docs/api/classes/AgentRuntime.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / AgentRuntime
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / AgentRuntime

# Class: AgentRuntime

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/CacheManager.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / CacheManager
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / CacheManager

# Class: CacheManager\<CacheAdapter\>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/DatabaseAdapter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / DatabaseAdapter
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / DatabaseAdapter

# Class: `abstract` DatabaseAdapter\<DB\>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/DbCacheAdapter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / DbCacheAdapter
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / DbCacheAdapter

# Class: DbCacheAdapter

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/FsCacheAdapter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / FsCacheAdapter
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / FsCacheAdapter

# Class: FsCacheAdapter

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/MemoryCacheAdapter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / MemoryCacheAdapter
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / MemoryCacheAdapter

# Class: MemoryCacheAdapter

Expand Down
2 changes: 1 addition & 1 deletion docs/api/classes/MemoryManager.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / MemoryManager
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / MemoryManager

# Class: MemoryManager

Expand Down
10 changes: 5 additions & 5 deletions docs/api/classes/Service.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[@ai16z/eliza v0.1.5-alpha.5](../index.md) / Service
[@ai16z/eliza v0.1.6-alpha.4](../index.md) / Service

# Class: `abstract` Service

Expand Down Expand Up @@ -38,7 +38,7 @@

#### Defined in

[packages/core/src/types.ts:998](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L998)
[packages/core/src/types.ts:1005](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1005)

***

Expand All @@ -54,7 +54,7 @@

#### Defined in

[packages/core/src/types.ts:1009](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1009)
[packages/core/src/types.ts:1016](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1016)

## Methods

Expand All @@ -72,7 +72,7 @@

#### Defined in

[packages/core/src/types.ts:1002](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1002)
[packages/core/src/types.ts:1009](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1009)

***

Expand All @@ -92,4 +92,4 @@ Add abstract initialize method that must be implemented by derived classes

#### Defined in

[packages/core/src/types.ts:1014](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1014)
[packages/core/src/types.ts:1021](https://github.com/ai16z/eliza/blob/main/packages/core/src/types.ts#L1021)
Loading

0 comments on commit 08a5aad

Please sign in to comment.