Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Devex Fixes #583

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .husky/commit-msg

This file was deleted.

2 changes: 0 additions & 2 deletions .husky/pre-commit

This file was deleted.

4 changes: 2 additions & 2 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function intializeDbCache(character: Character, db: IDatabaseCacheAdapter) {
return cache;
}

async function startAgent(character: Character, directClient: DirectClient) {
async function startAgent(character: Character, directClient: any) {
try {
character.id ??= stringToUuid(character.name);
character.username ??= character.name;
Expand Down Expand Up @@ -326,7 +326,7 @@ const startAgents = async () => {

try {
for (const character of characters) {
await startAgent(character, directClient as DirectClient);
await startAgent(character, directClient as any);
}
} catch (error) {
elizaLogger.error("Error starting agents:", error);
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@
"docker:bash": "bash ./scripts/docker.sh bash",
"docker:start": "bash ./scripts/docker.sh start",
"docker": "pnpm docker:build && pnpm docker:run && pnpm docker:bash",
"test": "bash ./scripts/test.sh",
"prepare": "husky install"
"test": "bash ./scripts/test.sh"
},
"devDependencies": {
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"concurrently": "^9.1.0",
"husky": "^9.1.6",
"lerna": "^8.1.5",
"only-allow": "^1.2.1",
"prettier": "^3.3.3",
"typedoc": "^0.26.11",
"typescript": "5.6.3",
"vite": "^5.4.11",
"vitest": "^2.1.5",
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4"
"vitest": "^2.1.5"
},
"pnpm": {
"overrides": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/defaultCharacter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const defaultCharacter: Character = {
username: "eliza",
plugins: [],
clients: [],
modelProvider: ModelProviderName.OLLAMA,
modelProvider: ModelProviderName.LLAMALOCAL,
settings: {
secrets: {},
voice: {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"lint": "eslint . --fix",
"postinstall": "npx playwright install-deps && npx playwright install"
"postinstall": "node scripts/postinstall.js"
},
"peerDependencies": {
"onnxruntime-node": "^1.20.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/plugin-node/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os from 'os';
const platform = os.platform();

if ((platform === 'linux' && !(os.release().includes('ubuntu') || os.release().includes('debian')))) {
console.log('Skipping playwright installation on unsupported platform:', platform);
} else {
const { execSync } = await import('child_process');
execSync('npx playwright install-deps && npx playwright install', { stdio: 'inherit' });
}
22 changes: 11 additions & 11 deletions packages/plugin-node/src/services/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,8 @@ export class ImageDescriptionService
}

async initialize(runtime: IAgentRuntime): Promise<void> {
console.log("Initializing ImageDescriptionService");
this.runtime = runtime;
const model = models[runtime?.character?.modelProvider];

if (model === models[ModelProviderName.LLAMALOCAL]) {
await this.initializeLocalModel();
} else {
this.modelId = "gpt-4o-mini";
this.device = "cloud";
}

this.initialized = true;
}

private async initializeLocalModel(): Promise<void> {
Expand Down Expand Up @@ -102,7 +93,16 @@ export class ImageDescriptionService
imageUrl: string
): Promise<{ title: string; description: string }> {
if (!this.initialized) {
throw new Error("ImageDescriptionService not initialized");
const model = models[this.runtime?.character?.modelProvider];

if (model === models[ModelProviderName.LLAMALOCAL]) {
await this.initializeLocalModel();
} else {
this.modelId = "gpt-4o-mini";
this.device = "cloud";
}

this.initialized = true;
}

if (this.device === "cloud") {
Expand Down
22 changes: 3 additions & 19 deletions packages/plugin-node/src/services/llama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export class LlamaService extends Service {
private messageQueue: QueuedMessage[] = [];
private isProcessing: boolean = false;
private modelInitialized: boolean = false;
private runtime: IAgentRuntime | undefined;

static serviceType: ServiceType = ServiceType.TEXT_GENERATION;

Expand All @@ -189,25 +190,8 @@ export class LlamaService extends Service {
}

async initialize(runtime: IAgentRuntime): Promise<void> {
try {
if (runtime.modelProvider === ModelProviderName.LLAMALOCAL) {
elizaLogger.info("Initializing LlamaService...");
elizaLogger.info("Using local GGUF model");
elizaLogger.info("Ensuring model is initialized...");
await this.ensureInitialized();
elizaLogger.success("LlamaService initialized successfully");
} else {
elizaLogger.info(
"Not using local model, skipping initialization"
);
return;
}
} catch (error) {
elizaLogger.error("Failed to initialize LlamaService:", error);
throw new Error(
`LlamaService initialization failed: ${error.message}`
);
}
elizaLogger.info("Initializing LlamaService...");
this.runtime = runtime;
}

private async ensureInitialized() {
Expand Down
Loading
Loading