Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
monilpat authored Dec 19, 2024
2 parents 1aee80d + 34a04ba commit cb0fad1
Show file tree
Hide file tree
Showing 183 changed files with 24,409 additions and 18,790 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
103 changes: 56 additions & 47 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,62 @@ on:

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

# This step makes the Docker image public, so users can pull it without authentication.
- name: Make Docker image public
run: |
curl \
-X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \
-d '{"visibility":"public"}'
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= xxx@gmail.com # 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
Loading

0 comments on commit cb0fad1

Please sign in to comment.