Skip to content

Commit 11dfe9a

Browse files
authoredNov 25, 2024
Merge pull request #583 from ai16z/shaw/devex-fixes
fix: Devex Fixes
2 parents c130e68 + df0869f commit 11dfe9a

File tree

10 files changed

+148
-184
lines changed

10 files changed

+148
-184
lines changed
 

‎.husky/commit-msg

-12
This file was deleted.

‎.husky/pre-commit

-2
This file was deleted.

‎agent/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ function intializeDbCache(character: Character, db: IDatabaseCacheAdapter) {
276276
return cache;
277277
}
278278

279-
async function startAgent(character: Character, directClient: DirectClient) {
279+
async function startAgent(character: Character, directClient: any) {
280280
try {
281281
character.id ??= stringToUuid(character.name);
282282
character.username ??= character.name;
@@ -326,7 +326,7 @@ const startAgents = async () => {
326326

327327
try {
328328
for (const character of characters) {
329-
await startAgent(character, directClient as DirectClient);
329+
await startAgent(character, directClient as any);
330330
}
331331
} catch (error) {
332332
elizaLogger.error("Error starting agents:", error);

‎package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,19 @@
2020
"docker:bash": "bash ./scripts/docker.sh bash",
2121
"docker:start": "bash ./scripts/docker.sh start",
2222
"docker": "pnpm docker:build && pnpm docker:run && pnpm docker:bash",
23-
"test": "bash ./scripts/test.sh",
24-
"prepare": "husky install"
23+
"test": "bash ./scripts/test.sh"
2524
},
2625
"devDependencies": {
26+
"@commitlint/cli": "^18.4.4",
27+
"@commitlint/config-conventional": "^18.4.4",
2728
"concurrently": "^9.1.0",
28-
"husky": "^9.1.6",
2929
"lerna": "^8.1.5",
3030
"only-allow": "^1.2.1",
3131
"prettier": "^3.3.3",
3232
"typedoc": "^0.26.11",
3333
"typescript": "5.6.3",
3434
"vite": "^5.4.11",
35-
"vitest": "^2.1.5",
36-
"@commitlint/cli": "^18.4.4",
37-
"@commitlint/config-conventional": "^18.4.4"
35+
"vitest": "^2.1.5"
3836
},
3937
"pnpm": {
4038
"overrides": {

‎packages/core/src/defaultCharacter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const defaultCharacter: Character = {
55
username: "eliza",
66
plugins: [],
77
clients: [],
8-
modelProvider: ModelProviderName.OLLAMA,
8+
modelProvider: ModelProviderName.LLAMALOCAL,
99
settings: {
1010
secrets: {},
1111
voice: {

‎packages/plugin-node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"build": "tsup --format esm --dts",
7171
"dev": "tsup --watch",
7272
"lint": "eslint . --fix",
73-
"postinstall": "npx playwright install-deps && npx playwright install"
73+
"postinstall": "node scripts/postinstall.js"
7474
},
7575
"peerDependencies": {
7676
"onnxruntime-node": "^1.20.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import os from 'os';
2+
const platform = os.platform();
3+
4+
if ((platform === 'linux' && !(os.release().includes('ubuntu') || os.release().includes('debian')))) {
5+
console.log('Skipping playwright installation on unsupported platform:', platform);
6+
} else {
7+
const { execSync } = await import('child_process');
8+
execSync('npx playwright install-deps && npx playwright install', { stdio: 'inherit' });
9+
}

‎packages/plugin-node/src/services/image.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,8 @@ export class ImageDescriptionService
4343
}
4444

4545
async initialize(runtime: IAgentRuntime): Promise<void> {
46+
console.log("Initializing ImageDescriptionService");
4647
this.runtime = runtime;
47-
const model = models[runtime?.character?.modelProvider];
48-
49-
if (model === models[ModelProviderName.LLAMALOCAL]) {
50-
await this.initializeLocalModel();
51-
} else {
52-
this.modelId = "gpt-4o-mini";
53-
this.device = "cloud";
54-
}
55-
56-
this.initialized = true;
5748
}
5849

5950
private async initializeLocalModel(): Promise<void> {
@@ -102,7 +93,16 @@ export class ImageDescriptionService
10293
imageUrl: string
10394
): Promise<{ title: string; description: string }> {
10495
if (!this.initialized) {
105-
throw new Error("ImageDescriptionService not initialized");
96+
const model = models[this.runtime?.character?.modelProvider];
97+
98+
if (model === models[ModelProviderName.LLAMALOCAL]) {
99+
await this.initializeLocalModel();
100+
} else {
101+
this.modelId = "gpt-4o-mini";
102+
this.device = "cloud";
103+
}
104+
105+
this.initialized = true;
106106
}
107107

108108
if (this.device === "cloud") {

‎packages/plugin-node/src/services/llama.ts

+3-19
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class LlamaService extends Service {
174174
private messageQueue: QueuedMessage[] = [];
175175
private isProcessing: boolean = false;
176176
private modelInitialized: boolean = false;
177+
private runtime: IAgentRuntime | undefined;
177178

178179
static serviceType: ServiceType = ServiceType.TEXT_GENERATION;
179180

@@ -189,25 +190,8 @@ export class LlamaService extends Service {
189190
}
190191

191192
async initialize(runtime: IAgentRuntime): Promise<void> {
192-
try {
193-
if (runtime.modelProvider === ModelProviderName.LLAMALOCAL) {
194-
elizaLogger.info("Initializing LlamaService...");
195-
elizaLogger.info("Using local GGUF model");
196-
elizaLogger.info("Ensuring model is initialized...");
197-
await this.ensureInitialized();
198-
elizaLogger.success("LlamaService initialized successfully");
199-
} else {
200-
elizaLogger.info(
201-
"Not using local model, skipping initialization"
202-
);
203-
return;
204-
}
205-
} catch (error) {
206-
elizaLogger.error("Failed to initialize LlamaService:", error);
207-
throw new Error(
208-
`LlamaService initialization failed: ${error.message}`
209-
);
210-
}
193+
elizaLogger.info("Initializing LlamaService...");
194+
this.runtime = runtime;
211195
}
212196

213197
private async ensureInitialized() {

0 commit comments

Comments
 (0)