Skip to content

Commit a265dd8

Browse files
authored
Merge branch 'elizaOS:develop' into develop
2 parents fc0dc5c + bf5b72d commit a265dd8

31 files changed

+2383
-450
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ FLOW_ENDPOINT_URL= # Default: https://mainnet.onflow.org
363363
INTERNET_COMPUTER_PRIVATE_KEY=
364364
INTERNET_COMPUTER_ADDRESS=
365365

366+
367+
#Cloudflare AI Gateway
368+
CLOUDFLARE_GW_ENABLED= # Set to true to enable Cloudflare AI Gateway
369+
CLOUDFLARE_AI_ACCOUNT_ID= # Cloudflare AI Account ID - found in the Cloudflare Dashboard under AI Gateway
370+
CLOUDFLARE_AI_GATEWAY_ID= # Cloudflare AI Gateway ID - found in the Cloudflare Dashboard under AI Gateway
371+
366372
# Aptos
367373
APTOS_PRIVATE_KEY= # Aptos private key
368374
APTOS_NETWORK= # Must be one of mainnet, testnet

agent/src/index.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
8181
import { tonPlugin } from "@elizaos/plugin-ton";
8282
import { webSearchPlugin } from "@elizaos/plugin-web-search";
8383

84-
import { coingeckoPlugin } from "@elizaos/plugin-coingecko";
8584
import { giphyPlugin } from "@elizaos/plugin-giphy";
8685
import { letzAIPlugin } from "@elizaos/plugin-letzai";
8786
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb";
@@ -704,8 +703,8 @@ export async function createAgent(
704703
goatPlugin,
705704
getSecret(character, "COINGECKO_API_KEY") ||
706705
getSecret(character, "COINGECKO_PRO_API_KEY")
707-
? coingeckoPlugin
708-
: null,
706+
? coingeckoPlugin
707+
: null,
709708
getSecret(character, "EVM_PROVIDER_URL") ? goatPlugin : null,
710709
getSecret(character, "ABSTRACT_PRIVATE_KEY")
711710
? abstractPlugin
@@ -720,8 +719,8 @@ export async function createAgent(
720719
: null,
721720
getSecret(character, "LENS_ADDRESS") &&
722721
getSecret(character, "LENS_PRIVATE_KEY")
723-
? lensPlugin
724-
: null,
722+
? lensPlugin
723+
: null,
725724
getSecret(character, "APTOS_PRIVATE_KEY") ? aptosPlugin : null,
726725
getSecret(character, "MVX_PRIVATE_KEY") ? multiversxPlugin : null,
727726
getSecret(character, "ZKSYNC_PRIVATE_KEY") ? zksyncEraPlugin : null,
@@ -761,8 +760,8 @@ export async function createAgent(
761760
getSecret(character, "ALLORA_API_KEY") ? alloraPlugin : null,
762761
getSecret(character, "AKASH_MNEMONIC") &&
763762
getSecret(character, "AKASH_WALLET_ADDRESS")
764-
? akashPlugin
765-
: null,
763+
? akashPlugin
764+
: null,
766765
].filter(Boolean),
767766
providers: [],
768767
actions: [],

docs/README_PT.md

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Eliza - framework de simulação Multi-agentes
2+
3+
# https://github.com/elizaOS/eliza
4+
5+
# Visite https://eliza.builders para suporte
6+
7+
## 🌍 README Traduções
8+
9+
[中文说明](README_CN.md) | [Deutsch](README_DE.md) | [Français](README_FR.md) | [ไทย](README_TH.md) | [Español](README_ES.md) | [Português](README_PT.md)
10+
11+
# dev branch
12+
13+
<img src="static/img/eliza_banner.jpg" alt="Eliza Banner" width="100%" />
14+
15+
_Como visto dando funcionamento em [@DegenSpartanAI](https://x.com/degenspartanai) e [@MarcAIndreessen](https://x.com/pmairca)_
16+
17+
- Framework Multi-agente de simulação
18+
- Adicione quantos personagens únicos quiser com o [characterfile](https://github.com/lalalune/characterfile/)
19+
- Conectores completos para Discord e Twitter, com suporte para canais de voz no Discord
20+
- Memória RAG completa para conversas e documentos
21+
- Pode ler links e PDFs, transcrever áudios e vídeos, resumir conversas e muito mais
22+
- Altamente extensível - crie suas próprias ações e clientes para ampliar as capacidades do Eliza
23+
- Suporte para modelos de código aberto e locais (configuração padrão com Nous Hermes Llama 3.1B)
24+
- Suporte ao OpenAI para inferência em nuvem em dispositivos com configurações leves
25+
- Modo "Perguntar ao Claude" para chamadas a Claude em consultas mais complexas
26+
- 100% Typescript
27+
28+
# Iniciando
29+
30+
**Pré-requisitos (OBRIGATÓRIO):**
31+
32+
- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
33+
- [pnpm](https://pnpm.io/installation)
34+
35+
### Edite o arquivo .env
36+
37+
- Copie .env.example para .env e preencha com valores apropriados
38+
- Edite as variáveis de ambiente do TWITTER para adicionar o nome de usuário e a senha do seu bot
39+
40+
### Edite o arquivo de personagem (character file)
41+
42+
- Verifique o arquivo `src/core/defaultCharacter.ts` - você pode modificá-lo
43+
- Você também pode carregar personagens com o comando `pnpm start --characters="path/to/your/character.json"` e executar vários bots ao mesmo tempo.
44+
45+
Após configurar o arquivo .env e o arquivo de personagem (character file), você pode iniciar o bot com o seguinte comando:
46+
47+
```
48+
pnpm i
49+
pnpm start
50+
```
51+
52+
# Personalizando Eliza
53+
54+
### Adicionando ações personalizadas
55+
56+
Para evitar conflitos no diretório principal, recomendamos adicionar ações personalizadas a um diretório chamado `custom_actions` e, em seguida, incluí-las no arquivo `elizaConfig.yaml`. Consulte o arquivo `elizaConfig.example.yaml` para um exemplo.
57+
58+
## Rodando com diferentes modelos
59+
60+
### Rode com Llama
61+
62+
Você pode executar modelos Llama 70B ou 405B configurando a variável de ambiente `XAI_MODEL` para `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` ou `meta-llama/Meta-Llama-3.1-405B-Instruct`
63+
64+
### Rode com Grok
65+
66+
Você pode executar modelos Grok configurando a variável de ambiente `XAI_MODEL` para `grok-beta`.
67+
68+
### Rode com OpenAI
69+
70+
Você pode executar modelos OpenAI configurando a variável de ambiente para `gpt-4-mini` or `gpt-4o`
71+
72+
## Requisitos Adicionais
73+
74+
Você pode precisar instalar o Sharp. Se aparecer um erro ao iniciar, tente instalá-lo com o seguinte comando:
75+
76+
```
77+
pnpm install --include=optional sharp
78+
```
79+
80+
# Configuração do Ambiente
81+
82+
Você precisará adicionar variáveis de ambiente ao seu arquivo .env para conectar a diversas plataformas:
83+
84+
```
85+
# Variaveis de ambiente obrigatorias
86+
DISCORD_APPLICATION_ID=
87+
DISCORD_API_TOKEN= # Bot token
88+
OPENAI_API_KEY=sk-* # OpenAI API key, começando com sk-
89+
ELEVENLABS_XI_API_KEY= # API key da elevenlabs
90+
91+
# Configuracoes ELEVENLABS
92+
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
93+
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
94+
ELEVENLABS_VOICE_STABILITY=0.5
95+
ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9
96+
ELEVENLABS_VOICE_STYLE=0.66
97+
ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false
98+
ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4
99+
ELEVENLABS_OUTPUT_FORMAT=pcm_16000
100+
101+
TWITTER_DRY_RUN=false
102+
TWITTER_USERNAME= # Usuário da conta
103+
TWITTER_PASSWORD= # Senha da conta
104+
TWITTER_EMAIL= # Email da conta
105+
106+
X_SERVER_URL=
107+
XAI_API_KEY=
108+
XAI_MODEL=
109+
110+
111+
# Para perguntas ao Claude
112+
ANTHROPIC_API_KEY=
113+
114+
WALLET_SECRET_KEY=EXAMPLE_WALLET_SECRET_KEY
115+
WALLET_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY
116+
117+
BIRDEYE_API_KEY=
118+
119+
SOL_ADDRESS=So11111111111111111111111111111111111111112
120+
SLIPPAGE=1
121+
RPC_URL=https://api.mainnet-beta.solana.com
122+
HELIUS_API_KEY=
123+
124+
125+
## Telegram
126+
TELEGRAM_BOT_TOKEN=
127+
128+
TOGETHER_API_KEY=
129+
```
130+
131+
# Configuração de Inferência Local
132+
133+
### Configuração CUDA
134+
135+
Se você tiver uma GPU NVIDIA, pode instalar o CUDA para acelerar significativamente a inferência local.
136+
137+
```
138+
pnpm install
139+
npx --no node-llama-cpp source download --gpu cuda
140+
```
141+
142+
Certifique-se de que você instalou o CUDA Toolkit, incluindo o cuDNN e cuBLAS.
143+
144+
### Rodando localmente
145+
146+
Add XAI_MODEL e defina-o para uma das opções mencionadas em [Run with
147+
Llama](#run-with-llama) - você pode deixar X_SERVER_URL e XAI_API_KEY em branco,
148+
pois o modelo será baixado do Hugging Face e consultado localmente.
149+
150+
# Clientes
151+
152+
## Discord Bot
153+
154+
Para ajuda com a configuração do seu bot no Discord, consulte aqui: https://discordjs.guide/preparations/setting-up-a-bot-application.html
155+
156+
# Desenvolvimento
157+
158+
## Testando
159+
160+
Para executar a suíte de testes:
161+
162+
```bash
163+
pnpm test # Executar os testes uma vez
164+
pnpm test:watch # Executar os testes no modo de observação/monitoramento (watch mode)
165+
```
166+
167+
Para testes específicos de banco de dados:
168+
169+
```bash
170+
pnpm test:sqlite # Rode testes com SQLite
171+
pnpm test:sqljs # Rode testes com SQL.js
172+
```
173+
174+
Os testes são escritos usando o Jest e podem ser encontrados nos arquivos. O ambiente de teste está configurado para:
175+
176+
- Carregar variáveis de ambiente do arquivo `.env.test`
177+
- Usar um tempo limite de 2 minutos para testes de longa duração
178+
- Suportar módulos ESM
179+
- Executar os testes em sequência (--runInBand)
180+
181+
Para criar novos testes, adicione um arquivo `.test.ts` ao lado do código que você está testando.
182+
183+
## Atualizações da Documentação
184+
185+
Por favor, verifique se a documentação fornecida está correta. Para fazer isso, execute o serviço de documentação (docs) abaixo.
186+
187+
```console
188+
docker compose -f docker-compose-docs.yaml up --build
189+
```
190+
191+
O servidor do Docusaurus será iniciado e você poderá verificar a documentação localmente em https://localhost:3000/eliza.

docs/docs/guides/configuration.md

+53
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,59 @@ HEURIST_API_KEY=
7171
# Livepeer Settings
7272
LIVEPEER_GATEWAY_URL=
7373
```
74+
75+
### Cloudflare AI Gateway Integration
76+
77+
Eliza supports routing API calls through [Cloudflare AI Gateway](https://developers.cloudflare.com/ai-gateway/), which provides several benefits:
78+
79+
- Detailed analytics and monitoring of message traffic and response times
80+
- Cost optimization through request caching and usage tracking across providers
81+
- Improved latency through Cloudflare's global network
82+
- Comprehensive visibility into message content and token usage
83+
- Cost analysis and comparison between different AI providers
84+
- Usage patterns and trends visualization
85+
- Request/response logging for debugging and optimization
86+
87+
To enable Cloudflare AI Gateway:
88+
89+
```bash
90+
# Cloudflare AI Gateway Settings
91+
CLOUDFLARE_GW_ENABLED=true
92+
CLOUDFLARE_AI_ACCOUNT_ID=your-account-id
93+
CLOUDFLARE_AI_GATEWAY_ID=your-gateway-id
94+
```
95+
96+
Supported providers through Cloudflare AI Gateway:
97+
- OpenAI
98+
- Anthropic
99+
- Groq
100+
101+
When enabled, Eliza will automatically route requests through your Cloudflare AI Gateway endpoint. The gateway URL is constructed in the format:
102+
```
103+
https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/${provider}
104+
```
105+
106+
If the gateway configuration is incomplete or disabled, Eliza will fall back to direct API calls.
107+
108+
```bash
109+
# Cloudflare AI Gateway Settings
110+
CLOUDFLARE_GW_ENABLED=true
111+
CLOUDFLARE_AI_ACCOUNT_ID=your-account-id
112+
CLOUDFLARE_AI_GATEWAY_ID=your-gateway-id
113+
```
114+
115+
Supported providers through Cloudflare AI Gateway:
116+
- OpenAI
117+
- Anthropic
118+
- Groq
119+
120+
When enabled, Eliza will automatically route requests through your Cloudflare AI Gateway endpoint. The gateway URL is constructed in the format:
121+
```
122+
https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/${provider}
123+
```
124+
125+
If the gateway configuration is incomplete or disabled, Eliza will fall back to direct API calls.
126+
74127
### Image Generation
75128

76129
Configure image generation in your character file:

packages/adapter-postgres/src/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ export class PostgresDatabaseAdapter
329329
roomIds: UUID[];
330330
agentId?: UUID;
331331
tableName: string;
332+
limit?: number;
332333
}): Promise<Memory[]> {
333334
return this.withDatabase(async () => {
334335
if (params.roomIds.length === 0) return [];
@@ -344,6 +345,13 @@ export class PostgresDatabaseAdapter
344345
queryParams = [...queryParams, params.agentId];
345346
}
346347

348+
// Add sorting, and conditionally add LIMIT if provided
349+
query += ` ORDER BY "createdAt" DESC`;
350+
if (params.limit) {
351+
query += ` LIMIT $${queryParams.length + 1}`;
352+
queryParams.push(params.limit.toString());
353+
}
354+
347355
const { rows } = await this.pool.query(query, queryParams);
348356
return rows.map((row) => ({
349357
...row,

packages/adapter-supabase/seed.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
INSERT INTO public.accounts (id, name, email, avatarUrl, details) VALUES ('00000000-0000-0000-0000-000000000000', 'Default Agent', 'default@agent.com', '', '{}');
2-
INSERT INTO public.rooms (id) VALUES ('00000000-0000-0000-0000-000000000000');
3-
INSERT INTO public.participants (userId, roomId) VALUES ('00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000');
1+
INSERT INTO public.accounts (id, name, email, "avatarUrl", details) VALUES ('00000000-0000-0000-0000-000000000000', 'Default Agent', 'default@agent.com', '', '{}');
2+
INSERT INTO public.rooms (id, "createdAt") VALUES ('00000000-0000-0000-0000-000000000000', NOW());
3+
INSERT INTO public.participants (id, "createdAt", "userId", "roomId", "userState", last_messsage_read) VALUES ('00000000-0000-0000-0000-000000000000', NOW(), 'Default Agent', '00000000-0000-0000-0000-000000000000', NULL, NULL);

0 commit comments

Comments
 (0)