Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
odilitime authored Dec 20, 2024
2 parents f8a1a90 + e201228 commit 0fc2f8f
Show file tree
Hide file tree
Showing 28 changed files with 3,256 additions and 18,495 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ LARGE_HYPERBOLIC_MODEL= # Default: meta-llama/Meta-Llama-3.1-405-Instruc
# Speech Synthesis
ELEVENLABS_XI_API_KEY= # API key from elevenlabs

# Direct Client Setting
EXPRESS_MAX_PAYLOAD= # Default: 100kb

# ElevenLabs Settings
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
Expand All @@ -55,6 +58,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 Expand Up @@ -257,6 +261,9 @@ LARGE_AKASH_CHAT_API_MODEL= # Default: Meta-Llama-3-1-405B-Instruct-FP8
FAL_API_KEY=
FAL_AI_LORA_PATH=

# Web search API Configuration
TAVILY_API_KEY=

# WhatsApp Cloud API Configuration
WHATSAPP_ACCESS_TOKEN= # Permanent access token from Facebook Developer Console
WHATSAPP_PHONE_NUMBER_ID= # Phone number ID from WhatsApp Business API
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ tsup.config.bundled_*.mjs

coverage
.eslintcache

agent/content
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
23 changes: 17 additions & 6 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,11 @@ export async function loadCharacters(
export function getTokenForProvider(
provider: ModelProviderName,
character: Character
) {
):string {
switch (provider) {
// no key needed for llama_local
case ModelProviderName.LLAMALOCAL:
return ''
case ModelProviderName.OPENAI:
return (
character.settings?.secrets?.OPENAI_API_KEY ||
Expand All @@ -234,6 +237,7 @@ export function getTokenForProvider(
character.settings?.secrets?.OPENAI_API_KEY ||
settings.OPENAI_API_KEY
);
case ModelProviderName.CLAUDE_VERTEX:
case ModelProviderName.ANTHROPIC:
return (
character.settings?.secrets?.ANTHROPIC_API_KEY ||
Expand Down Expand Up @@ -305,6 +309,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 @@ -392,17 +400,20 @@ export async function initializeClients(
elizaLogger.log("client keys", Object.keys(clients));

// TODO: Add Slack client to the list
// Initialize clients as an object


if (clientTypes.includes("slack")) {
const slackClient = await SlackClientInterface.start(runtime);
if (slackClient) clients.push(slackClient);
if (slackClient) clients.slack = slackClient; // Use object property instead of push
}

if (character.plugins?.length > 0) {
for (const plugin of character.plugins) {
// if plugin has clients, add those..
if (plugin.clients) {
for (const client of plugin.clients) {
clients.push(await client.start(runtime));
const startedClient = await client.start(runtime);
clients[client.name] = startedClient; // Assuming client has a name property
}
}
}
Expand Down Expand Up @@ -574,7 +585,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 @@ -649,7 +660,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
3 changes: 1 addition & 2 deletions characters/trump.character.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trump",
"clients": [],
"clients": ["slack"],
"modelProvider": "openai",
"settings": {
"secrets": {},
Expand All @@ -10,7 +10,6 @@
},
"plugins": [],
"bio": [
"SAVED America from the China Virus (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/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 🌍 README Translations

[中文说明](./README_CN.md) | [Français](./README_FR.md) | [ไทย](./README_TH.md)
[中文说明](./README_CN.md) | [Deutsch](./README_DE.md) | [Français](./README_FR.md) | [ไทย](./README_TH.md)

# dev branch

Expand Down
Loading

0 comments on commit 0fc2f8f

Please sign in to comment.