Skip to content

Commit

Permalink
Merge branch 'develop' into tcm-refactor-modelConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tcm390 authored Jan 5, 2025
2 parents f3792e0 + 09517c5 commit f5103f5
Show file tree
Hide file tree
Showing 13 changed files with 825 additions and 52 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG NODE_VER=23.5.0
ARG BASE_IMAGE=node:${NODE_VER}
FROM $BASE_IMAGE

ENV DEBIAN_FRONTEND=noninteractive

# Install pnpm globally and install necessary build tools
RUN apt-get update \
&& apt-get install -y \
git \
python3 \
make \
g++ \
nano \
vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ARG PNPM_VER=9.15.2
RUN npm install -g pnpm@${PNPM_VER}

# Set Python 3 as the default python
RUN ln -s /usr/bin/python3 /usr/bin/python
ENV DEBIAN_FRONTEND=dialog
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "elizaos-dev",
"dockerFile": "Dockerfile",
"build": {
"args": {
"NODE_VER": "23.5.0",
"PNPM_VER": "9.15.2"
}
},
"privileged": true,
"runArgs": [
"-p=3000:3000", // Add port for server api
"-p=5173:5173", // Add port for client
//"--volume=/usr/lib/wsl:/usr/lib/wsl", // uncomment for WSL
//"--volume=/mnt/wslg:/mnt/wslg", // uncomment for WSL
"--gpus=all", // ! uncomment for vGPU
//"--device=/dev/dxg", // uncomment this for vGPU under WSL
"--device=/dev/dri"
],
"containerEnv": {
//"MESA_D3D12_DEFAULT_ADAPTER_NAME": "NVIDIA", // uncomment for WSL
//"LD_LIBRARY_PATH": "/usr/lib/wsl/lib" // uncomment for WSL
},
"customizations": {
"vscode": {
"extensions": [
"vscode.json-language-features",
"vscode.css-language-features",
// "foxundermoon.shell-format",
// "dbaeumer.vscode-eslint",
// "esbenp.prettier-vscode"
"ms-python.python"
]
}
},
"features": {}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ tsup.config.bundled_*.mjs

.turbo
.cursorrules
.pnpm-store

coverage
.eslintcache
Expand Down
183 changes: 183 additions & 0 deletions README_RO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Eliza

<img src="./docs/static/img/eliza_banner.jpg" alt="Eliza Banner" width="100%" />

## Funcționalități

- 🛠 Conectori compleți pentru Discord, Twitter și Telegram
- 👥 Suport pentru agenți multipli și camere
- 📚 Ingestie și interacțiune ușoară cu documentele tale
- 💾 Memorie recuperabilă și stocare de documente
- 🚀 Extensibil în mod ridicat – creează propriile acțiuni și clienți pentru a extinde capacitățile
- ☁️ Suportă multe modele, inclusiv Llama local, OpenAI, Anthropic, Groq și altele
- 📦 Funcționează perfect!

## Pentru ce pot să-l folosesc?

- 🤖 Chatbot-uri
- 🕵️ Agenți autonomi
- 📈 Gestiunea proceselor de afaceri
- 🎮 NPC-uri în jocuri video

# Început

**Cerințe preliminare (OBLIGATORIU):**

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

### Edite fișierul .env

- Copiați `.env.example` în `.env` și completați valorile corespunzătoare
- Editați variabilele de mediu pentru TWITTER pentru a adăuga numele de utilizator și parola botului dvs.

### Edite fișierul de personaj

- Verificați fișierul `src/core/defaultCharacter.ts` – îl puteți modifica
- De asemenea, puteți încărca personaje cu comanda `pnpm start --characters="path/to/your/character.json"` și rula mai mulți boți în același timp.

După ce ați configurat fișierul .env și fișierul de personaj, puteți porni botul cu următoarea comandă:

```
pnpm i
pnpm start
```

# Personalizarea Eliza

### Adăugarea de acțiuni personalizate

Pentru a evita conflicte în directorul core, vă recomandăm să adăugați acțiuni personalizate într-un director `custom_actions` și apoi să le includeți în fișierul `elizaConfig.yaml`. Consultați fișierul `elizaConfig.example.yaml` pentru un exemplu.

## Rularea cu modele diferite

### Rularea cu Llama

Puteți rula modele Llama 70B sau 405B setând variabila de mediu `XAI_MODEL` la `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` sau `meta-llama/Meta-Llama-3.1-405B-Instruct`.

### Rularea cu Grok

Puteți rula modele Grok setând variabila de mediu `XAI_MODEL` la `grok-beta`.

### Rularea cu OpenAI

Puteți rula modele OpenAI setând variabila de mediu `XAI_MODEL` la `gpt-4o-mini` sau `gpt-4o`.

## Cerințe suplimentare

Este posibil să fie necesară instalarea Sharp. Dacă întâmpinați o eroare la pornire, încercați să îl instalați cu următoarea comandă:

```
pnpm install --include=optional sharp
```

# Configurarea mediului

Va trebui să adăugați variabile de mediu în fișierul dvs. `.env` pentru a vă conecta la diverse platforme:

```
# Variáveis de ambiente obrigatórias
DISCORD_APPLICATION_ID=
DISCORD_API_TOKEN= # Token do bot
OPENAI_API_KEY=sk-* # Chave API do OpenAI, começando com sk-
ELEVENLABS_XI_API_KEY= # Chave API do elevenlabs
GOOGLE_GENERATIVE_AI_API_KEY= # Chave API do Gemini
# CONFIGURAÇÕES DO ELEVENLABS
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
ELEVENLABS_VOICE_STABILITY=0.5
ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9
ELEVENLABS_VOICE_STYLE=0.66
ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false
ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4
ELEVENLABS_OUTPUT_FORMAT=pcm_16000
TWITTER_DRY_RUN=false
TWITTER_USERNAME= # Nome de usuário da conta
TWITTER_PASSWORD= # Senha da conta
TWITTER_EMAIL= # Email da conta
X_SERVER_URL=
XAI_API_KEY=
XAI_MODEL=
# Para perguntar coisas ao Claude
ANTHROPIC_API_KEY=
# EVM
EVM_PRIVATE_KEY=EXAMPLE_WALLET_PRIVATE_KEY
# Solana
SOLANA_PRIVATE_KEY=EXAMPLE_WALLET_PRIVATE_KEY
SOLANA_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY
# Fallback Wallet Configuration (deprecated)
WALLET_PRIVATE_KEY=EXAMPLE_WALLET_PRIVATE_KEY
WALLET_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY
BIRDEYE_API_KEY=
SOL_ADDRESS=So11111111111111111111111111111111111111112
SLIPPAGE=1
RPC_URL=https://api.mainnet-beta.solana.com
HELIUS_API_KEY=
## Telegram
TELEGRAM_BOT_TOKEN=
TOGETHER_API_KEY=
```

# Configurarea inferenței locale

### Configurarea CUDA

Dacă aveți un GPU NVIDIA, puteți instala CUDA pentru a accelera dramatic inferența locală.

```
pnpm install
npx --no node-llama-cpp source download --gpu cuda
```

Asigurați-vă că ați instalat CUDA Toolkit, inclusiv cuDNN și cuBLAS.

### Rularea locală

Adăugați `XAI_MODEL` și setați-l la una dintre opțiunile de mai sus din [Rularea cu Llama](#rularea-cu-llama) – puteți lăsa `X_SERVER_URL` și `XAI_API_KEY` necompletate, modelul va fi descărcat de pe Hugging Face și interogările vor fi făcute local.

# Clienți

## Bot Discord

Pentru ajutor la configurarea Bot-ului Discord, consultați: https://discordjs.guide/preparations/setting-up-a-bot-application.html

# Dezvoltare

## Teste

Pentru a rula suita de teste:

```bash
pnpm test # Execută testele o dată
pnpm test:watch # Execută testele în modul watch
```

Pentru teste specifice bazei de date:

```bash
pnpm test:sqlite # Execută testele cu SQLite
pnpm test:sqljs # Execută testele cu SQL.js
```

Testele sunt scrise folosind Jest și pot fi găsite în fișierele `src/**/*.test.ts`. Mediul de testare este configurat pentru:

- Încărcarea variabilelor de mediu din `.env.test`
- Utilizarea unui timeout de 2 minute pentru teste de lungă durată
- Suport pentru module ESM
- Rularea testelor în secvență (`--runInBand`)

Pentru a crea teste noi, adăugați un fișier `.test.ts` adiacent codului pe care îl testați.
48 changes: 39 additions & 9 deletions docs/docs/guides/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,61 @@ This guide covers setting up and working with Eliza in a development environment

## Prerequisites

Before you begin, ensure you have:
You can develop either in a **dev container** or directly on your **host machine**.

### Requirements:

```bash
# Required
Node.js 23+
pnpm
Node.js (v23+; not required if using the dev container)
pnpm (not required if using the dev container)
Git

# Optional but recommended
VS Code
Docker (for database development)
CUDA Toolkit (for GPU acceleration)
VS Code (mandatory for using the dev container or coding)
Docker (mandatory for using the dev container or database development)
CUDA Toolkit (optional, for GPU acceleration)
```
## Initial Setup
### 1. Repository Setup
Clone the repository and navigate to the project directory:
```bash
# Clone the repository
git clone https://github.com/elizaos/eliza.git
cd eliza
```
### 2. (Optional) Run Inside a Dev Container
1. Open the project directory in **VS Code**:
```bash
code .
```
2. In the bottom-right corner, you'll see a popup:
**"Reopen in Container"** – Click it.
- If you don't see the popup or miss it, press `F1`, type:
**"Reopen in Container"**, and select it.
3. Wait for the container to initialize.
4. Open a terminal (hotkey: `Ctrl+Shift+\``) and run commands from the **container terminal** going forward.
### 3. Setup dependencies
```bash
# Install dependencies
pnpm install
# Install optional dependencies
pnpm install --include=optional sharp
```
### 2. Environment Configuration
### 4. Environment Configuration
Create your development environment file:
Expand All @@ -56,7 +80,7 @@ XAI_API_KEY= # Leave blank for local inference
XAI_MODEL=meta-llama/Llama-3.1-7b-instruct # Local model
```
### 3. Local Model Setup
### 5. Local Model Setup
For local inference without API dependencies:
Expand Down Expand Up @@ -106,10 +130,16 @@ pnpm run dev --characters="characters/my-character.json"
pnpm start:client
```
NOTE: If you are using devcontainer, add --host argument to client:
```
pnpm start:client --host
```
Look for the message:
` ➜ Local: http://localhost:5173/`
Click on that link or open a browser window to that location. Once you do that you should see the chat interface connect with the system and you can start interacting with your character.
## Database Development
### SQLite (Recommended for Development)
Expand Down
23 changes: 1 addition & 22 deletions packages/client-twitter/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,28 +729,10 @@ export class ClientBase extends EventEmitter {
);
}

async getCachedProfile(username: string) {
return await this.runtime.cacheManager.get<TwitterProfile>(
`twitter/${username}/profile`
);
}

async cacheProfile(profile: TwitterProfile) {
await this.runtime.cacheManager.set(
`twitter/${profile.username}/profile`,
profile
);
}

async fetchProfile(username: string): Promise<TwitterProfile> {
const cached = await this.getCachedProfile(username);

if (cached) return cached;

try {
const profile = await this.requestQueue.add(async () => {
const profile = await this.twitterClient.getProfile(username);
// console.log({ profile });
return {
id: profile.userId,
username,
Expand All @@ -767,13 +749,10 @@ export class ClientBase extends EventEmitter {
} satisfies TwitterProfile;
});

this.cacheProfile(profile);

return profile;
} catch (error) {
console.error("Error fetching Twitter profile:", error);

return undefined;
throw error;
}
}
}
Loading

0 comments on commit f5103f5

Please sign in to comment.