Skip to content

Commit 95a7b37

Browse files
committed
merge
2 parents 3aa0c98 + 3afd61c commit 95a7b37

File tree

16 files changed

+247
-11
lines changed

16 files changed

+247
-11
lines changed

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ GOOGLE_GENERATIVE_AI_API_KEY= # Gemini API key
1818

1919
ALI_BAILIAN_API_KEY= # Ali Bailian API Key
2020
VOLENGINE_API_KEY= # VolEngine API Key
21+
NANOGPT_API_KEY= # NanoGPT API Key
2122

2223
HYPERBOLIC_API_KEY= # Hyperbolic API Key
2324
HYPERBOLIC_MODEL=
@@ -96,6 +97,11 @@ MEDIUM_GROQ_MODEL= # Default: llama-3.3-70b-versatile
9697
LARGE_GROQ_MODEL= # Default: llama-3.2-90b-vision-preview
9798
EMBEDDING_GROQ_MODEL= # Default: llama-3.1-8b-instant
9899

100+
# NanoGPT Configuration
101+
SMALL_NANOGPT_MODEL= # Default: gpt-4o-mini
102+
MEDIUM_NANOGPT_MODEL= # Default: gpt-4o
103+
LARGE_NANOGPT_MODEL= # Default: gpt-4o
104+
99105
#LlamaLocal Configuration
100106
LLAMALOCAL_PATH= # Default: "" which is the current directory in plugin-node/dist/ which gets destroyed and recreated on every build
101107

.github/workflows/image.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
name: Create and publish a Docker image
3+
4+
# Configures this workflow to run every time a change is pushed to the branch called `release`.
5+
on:
6+
release:
7+
types: [created]
8+
workflow_dispatch:
9+
10+
# 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.
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
20+
permissions:
21+
contents: read
22+
packages: write
23+
attestations: write
24+
id-token: write
25+
#
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
# 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.
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
# 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.
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
# 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.
43+
# 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.
44+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
45+
- name: Build and push Docker image
46+
id: push
47+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
48+
with:
49+
context: .
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
54+
# 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)."
55+
- name: Generate artifact attestation
56+
uses: actions/attest-build-provenance@v1
57+
with:
58+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
59+
subject-digest: ${{ steps.push.outputs.digest }}
60+
push-to-registry: true
61+

agent/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ export function getTokenForProvider(
270270
character.settings?.secrets?.VOLENGINE_API_KEY ||
271271
settings.VOLENGINE_API_KEY
272272
);
273+
case ModelProviderName.NANOGPT:
274+
return (
275+
character.settings?.secrets?.NANOGPT_API_KEY ||
276+
settings.NANOGPT_API_KEY
277+
);
273278
case ModelProviderName.HYPERBOLIC:
274279
return (
275280
character.settings?.secrets?.HYPERBOLIC_API_KEY ||

docs/docs/guides/local-development.md

+16
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ pnpm run test:watch # Run tests in watch mode
9494
pnpm run lint # Lint code
9595
```
9696

97+
### Direct Client Chat UI
98+
99+
```
100+
# Open a terminal and Start with specific character
101+
pnpm run dev --characters="characters/my-character.json"
102+
```
103+
```
104+
# Open a 2nd terminal and start the client
105+
pnpm start:client
106+
```
107+
108+
Look for the message:
109+
` ➜ Local: http://localhost:5173/`
110+
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.
111+
112+
97113
## Database Development
98114

99115
### SQLite (Recommended for Development)

docs/docs/guides/wsl.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
sidebar_position: 5
3+
title: WSL Setup Guide
4+
description: Guide for setting up Eliza on Windows using WSL (Windows Subsystem for Linux)
5+
---
6+
7+
# WSL Setup Guide
8+
Steps to run Eliza on Windows computer using WSL.
9+
[AI Dev School Tutorial](https://www.youtube.com/watch?v=ArptLpQiKfI)
10+
11+
12+
## Install WSL
13+
14+
1. Open PowerShell as Administrator and run:
15+
```powershell
16+
wsl --install
17+
```
18+
19+
2. Restart your computer
20+
3. Launch Ubuntu from the Start menu and create your Linux username/password
21+
22+
## Install Dependencies
23+
24+
1. Update Ubuntu packages:
25+
```bash
26+
sudo apt update && sudo apt upgrade -y
27+
```
28+
29+
2. Install system dependencies:
30+
```bash
31+
sudo apt install -y \
32+
build-essential \
33+
python3 \
34+
python3-pip \
35+
git \
36+
curl \
37+
ffmpeg \
38+
libtool-bin \
39+
autoconf \
40+
automake \
41+
libopus-dev
42+
```
43+
44+
3. Install Node.js via nvm:
45+
```bash
46+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
47+
source ~/.bashrc
48+
nvm install 23
49+
nvm use 23
50+
```
51+
52+
4. Install pnpm:
53+
```bash
54+
curl -fsSL https://get.pnpm.io/install.sh | sh -
55+
source ~/.bashrc
56+
```
57+
58+
## Optional: CUDA Support
59+
60+
If you have an NVIDIA GPU and want CUDA support:
61+
62+
1. Install CUDA Toolkit on Windows from [NVIDIA's website](https://developer.nvidia.com/cuda-downloads)
63+
2. WSL will automatically detect and use the Windows CUDA installation
64+
65+
## Clone and Setup Eliza
66+
67+
Follow the [Quickstart Guide](../quickstart.md) starting from the "Installation" section.
68+
69+
## Troubleshooting
70+
71+
- If you encounter `node-gyp` errors, ensure build tools are installed:
72+
```bash
73+
sudo apt install -y nodejs-dev node-gyp
74+
```
75+
76+
- For audio-related issues, verify ffmpeg installation:
77+
```bash
78+
ffmpeg -version
79+
```
80+
81+
- For permission issues, ensure your user owns the project directory:
82+
```bash
83+
sudo chown -R $USER:$USER ~/path/to/eliza
84+
```

docs/docs/quickstart.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ sidebar_position: 2
77
## Prerequisites
88

99
Before getting started with Eliza, ensure you have:
10-
11-
- [Python 2.7+](https://www.python.org/downloads/)
1210
- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
1311
- [pnpm 9+](https://pnpm.io/installation)
1412
- Git for version control
@@ -125,6 +123,22 @@ You set which model to use inside the character JSON file
125123
pnpm start --characters="characters/trump.character.json,characters/tate.character.json"
126124
```
127125

126+
3. **Interact with the Agent**
127+
128+
Now you're ready to start a conversation with your agent!
129+
Open a new terminal window
130+
131+
```bash
132+
pnpm start:client
133+
```
134+
135+
Once the client is running, you'll see a message like this:
136+
```
137+
➜ Local: http://localhost:5173/
138+
```
139+
140+
Simply click the link or open your browser to `http://localhost:5173/`. You'll see the chat interface connect to the system, and you can begin interacting with your character.
141+
128142
## Platform Integration
129143

130144
### Discord Bot Setup

docs/sidebars.js

+5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ const sidebars = {
8080
id: "guides/local-development",
8181
label: "Local Development",
8282
},
83+
{
84+
type: "doc",
85+
id: "guides/wsl",
86+
label: "WSL Setup",
87+
},
8388
],
8489
},
8590
{

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"build": "turbo run build --filter=!eliza-docs",
66
"build-docker": "turbo run build",
77
"start": "pnpm --filter \"@ai16z/agent\" start --isRoot",
8-
"start:client": "pnpm --dir client start --isRoot",
8+
"start:client": "pnpm --dir client dev",
99
"start:debug": "cross-env NODE_ENV=development VERBOSE=true DEBUG=eliza:* pnpm --filter \"@ai16z/agent\" start --isRoot",
1010
"dev": "bash ./scripts/dev.sh",
1111
"lint": "bash ./scripts/lint.sh",

packages/core/src/generation.ts

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export async function generateText({
151151
case ModelProviderName.ALI_BAILIAN:
152152
case ModelProviderName.VOLENGINE:
153153
case ModelProviderName.LLAMACLOUD:
154+
case ModelProviderName.NANOGPT:
154155
case ModelProviderName.HYPERBOLIC:
155156
case ModelProviderName.TOGETHER: {
156157
elizaLogger.debug("Initializing OpenAI model.");
@@ -1243,6 +1244,7 @@ export async function handleProvider(
12431244
case ModelProviderName.VOLENGINE:
12441245
case ModelProviderName.LLAMACLOUD:
12451246
case ModelProviderName.TOGETHER:
1247+
case ModelProviderName.NANOGPT:
12461248
return await handleOpenAI(options);
12471249
case ModelProviderName.ANTHROPIC:
12481250
return await handleAnthropic(options);

packages/core/src/models.ts

+16
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,22 @@ export const models: Models = {
411411
[ModelClass.EMBEDDING]: "doubao-embedding",
412412
},
413413
},
414+
[ModelProviderName.NANOGPT]: {
415+
endpoint: "https://nano-gpt.com/api/v1",
416+
settings: {
417+
stop: [],
418+
maxInputTokens: 128000,
419+
maxOutputTokens: 8192,
420+
frequency_penalty: 0.0,
421+
presence_penalty: 0.0,
422+
temperature: 0.6,
423+
},
424+
model: {
425+
[ModelClass.SMALL]: settings.SMALL_NANOGPT_MODEL || "gpt-4o-mini",
426+
[ModelClass.MEDIUM]: settings.MEDIUM_NANOGPT_MODEL || "gpt-4o",
427+
[ModelClass.LARGE]: settings.LARGE_NANOGPT_MODEL || "gpt-4o",
428+
}
429+
},
414430
[ModelProviderName.HYPERBOLIC]: {
415431
endpoint: "https://api.hyperbolic.xyz/v1",
416432
settings: {

packages/core/src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export type Models = {
205205
[ModelProviderName.GAIANET]: Model;
206206
[ModelProviderName.ALI_BAILIAN]: Model;
207207
[ModelProviderName.VOLENGINE]: Model;
208+
[ModelProviderName.NANOGPT]: Model;
208209
[ModelProviderName.HYPERBOLIC]: Model;
209210
};
210211

@@ -231,6 +232,7 @@ export enum ModelProviderName {
231232
GAIANET = "gaianet",
232233
ALI_BAILIAN = "ali_bailian",
233234
VOLENGINE = "volengine",
235+
NANOGPT = "nanogpt",
234236
HYPERBOLIC = "hyperbolic",
235237
}
236238

packages/plugin-flow/src/actions/transfer.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
composeContext,
33
Content,
44
elizaLogger,
5-
generateObjectDEPRECATED,
5+
generateObjectArray,
66
ModelClass,
77
type Action,
88
type ActionExample,
@@ -87,12 +87,17 @@ export class TransferAction {
8787
});
8888

8989
// Generate transfer content
90-
const content = await generateObjectDEPRECATED({
90+
const recommendations = await generateObjectArray({
9191
runtime,
9292
context: transferContext,
93-
modelClass: ModelClass.SMALL,
93+
modelClass: ModelClass.MEDIUM,
9494
});
9595

96+
elizaLogger.debug("Recommendations", recommendations);
97+
98+
// Convert array to object
99+
const content = recommendations[recommendations.length - 1];
100+
96101
// Validate transfer content
97102
if (!isTransferContent(runtime, content)) {
98103
elizaLogger.error("Invalid content for SEND_COIN action.");

packages/plugin-flow/src/assets/cadence/transactions/evm/call.cdc

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ transaction(evmContractAddressHex: String, calldata: String, gasLimit: UInt64, v
1010
prepare(signer: auth(BorrowValue) &Account) {
1111
self.evmAddress = EVM.addressFromString(evmContractAddressHex)
1212

13-
self.coa = signer.storage.borrow<auth(EVM.Call) &EVM.CadenceOwnedAccount>(from: /storage/evm)
13+
let storagePath = StoragePath(identifier: "evm")!
14+
let publicPath = PublicPath(identifier: "evm")!
15+
16+
// Reference signer's COA if one exists
17+
let coa = signer.storage.borrow<auth(EVM.Withdraw) &EVM.CadenceOwnedAccount>(from: storagePath)
18+
if coa == nil {
19+
let coa <- EVM.createCadenceOwnedAccount()
20+
signer.storage.save<@EVM.CadenceOwnedAccount>(<-coa, to: storagePath)
21+
let addressableCap = signer.capabilities.storage.issue<&EVM.CadenceOwnedAccount>(storagePath)
22+
signer.capabilities.unpublish(publicPath)
23+
signer.capabilities.publish(addressableCap, at: publicPath)
24+
}
25+
26+
self.coa = signer.storage.borrow<auth(EVM.Call) &EVM.CadenceOwnedAccount>(from: storagePath)
1427
?? panic("Could not borrow COA from provided gateway address")
1528
}
1629

packages/plugin-flow/src/providers/connector.provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class FlowConnectorProvider {
7272
constructor(private readonly instance: FlowConnector) {}
7373

7474
getConnectorStatus(runtime: IAgentRuntime): string {
75-
let output = `${runtime.character.name}[${runtime.character.id ?? 0}] Connected to\n`;
75+
let output = `Now user<${runtime.character.name}> connected to\n`;
7676
output += `Flow network: ${this.instance.network}\n`;
7777
output += `Flow Endpoint: ${this.instance.rpcEndpoint}\n`;
7878
return output;

packages/plugin-flow/src/providers/wallet.provider.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ const flowWalletProvider: Provider = {
232232
elizaLogger.error("Invalid account info");
233233
return null;
234234
}
235-
return `Flow Wallet Address: ${walletProvider.address}\nBalance: ${info.balance} FLOW\nFlow COA(EVM) Address: ${info.coaAddress || "unknown"}\nFLOW COA(EVM) Balance: ${info.coaBalance ?? 0} FLOW`;
235+
let output = `Here is user<${runtime.character.name}>'s wallet status:\n`;
236+
output += `Flow wallet address: ${walletProvider.address}\n`;
237+
output += `FLOW balance: ${info.balance} FLOW\n`;
238+
output += `Flow wallet's COA(EVM) address: ${info.coaAddress || "unknown"}\n`;
239+
output += `FLOW balance in COA(EVM) address: ${info.coaBalance ?? 0} FLOW`;
240+
return output;
236241
} catch (error) {
237242
elizaLogger.error("Error in Flow wallet provider:", error.message);
238243
return null;

0 commit comments

Comments
 (0)