From 1d551e211cf47de4e75fd018d860969bc607f571 Mon Sep 17 00:00:00 2001 From: Ophiuchus Date: Thu, 7 Nov 2024 02:40:53 -0600 Subject: [PATCH] tsconfig ref @eliza/core, target src, include types, & esm module resolution. & models.gguf stored in models folder --- .gitignore | 2 ++ package.json | 5 +++++ packages/agent/src/index.ts | 2 +- packages/agent/tsconfig.json | 13 +++++++++--- packages/core/src/services/LlamaCppService.ts | 6 +++--- pnpm-lock.yaml | 21 ++++++++++++++++--- 6 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 6d6af3ea83..3e8ec232c8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ embedding-cache.json .DS_Store dist/ +# Allow models directory but ignore model files +models/*.gguf cookies.json diff --git a/package.json b/package.json index d44cce6938..ad5058fd87 100644 --- a/package.json +++ b/package.json @@ -31,5 +31,10 @@ }, "engines": { "node": ">=22" + }, + "dependencies": { + "ollama-ai-provider": "^0.16.1", + "optional": "^0.1.4", + "sharp": "^0.33.5" } } diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index 4559bc6294..15c81c90df 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -21,7 +21,7 @@ import { walletProvider, } from "@eliza/core"; import readline from "readline"; - +console.log("Program starting") const args = parseArguments(); let charactersArg = args.characters || args.character; diff --git a/packages/agent/tsconfig.json b/packages/agent/tsconfig.json index 7a1d08c7b7..e5ac630d48 100644 --- a/packages/agent/tsconfig.json +++ b/packages/agent/tsconfig.json @@ -1,7 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "dist" + "outDir": "dist", + "rootDir": ".", + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] }, - "include": ["."] -} + "include": ["src"], + "references": [ + { "path": "../core" } + ] +} \ No newline at end of file diff --git a/packages/core/src/services/LlamaCppService.ts b/packages/core/src/services/LlamaCppService.ts index a4d0098f95..17cc5fbf42 100644 --- a/packages/core/src/services/LlamaCppService.ts +++ b/packages/core/src/services/LlamaCppService.ts @@ -73,7 +73,8 @@ class LlamaCppService { this.modelUrl = "https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B-GGUF/resolve/main/Hermes-3-Llama-3.1-8B.Q8_0.gguf?download=true"; const modelName = "model.gguf"; - this.modelPath = path.join(__dirname, modelName); + // in packages/core/src/services/LlamaCppService.ts + this.modelPath = path.join(__dirname, '../models/model.gguf'); } public static getInstance(): LlamaCppService { @@ -148,11 +149,10 @@ class LlamaCppService { } async checkModel() { - console.log("Checking model"); + console.log("Checking model") if (!fs.existsSync(this.modelPath)) { console.log("this.modelPath", this.modelPath); console.log("Model not found. Downloading..."); - await new Promise((resolve, reject) => { const file = fs.createWriteStream(this.modelPath); let downloadedSize = 0; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f8f303f79a..8e52635862 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,6 +10,16 @@ overrides: importers: .: + dependencies: + ollama-ai-provider: + specifier: ^0.16.1 + version: 0.16.1(zod@3.23.8) + optional: + specifier: ^0.1.4 + version: 0.1.4 + sharp: + specifier: ^0.33.5 + version: 0.33.5 devDependencies: concurrently: specifier: ^9.1.0 @@ -490,7 +500,7 @@ importers: version: 2.79.2 ts-jest: specifier: 29.2.5 - version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.17.19)(jest@29.7.0(@types/node@22.8.4)(ts-node@10.9.2(@types/node@22.8.4)(typescript@5.6.3)))(typescript@5.6.3) + version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.0)(jest@29.7.0(@types/node@22.8.4)(ts-node@10.9.2(@types/node@22.8.4)(typescript@5.6.3)))(typescript@5.6.3) ts-node: specifier: 10.9.2 version: 10.9.2(@types/node@22.8.4)(typescript@5.6.3) @@ -8689,6 +8699,9 @@ packages: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true + optional@0.1.4: + resolution: {integrity: sha512-gtvrrCfkE08wKcgXaVwQVgwEQ8vel2dc5DDBn9RLQZ3YtmtkBss6A2HY6BnJH4N/4Ku97Ri/SF8sNWE2225WJw==} + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -22293,6 +22306,8 @@ snapshots: opener@1.5.2: {} + optional@0.1.4: {} + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -24831,7 +24846,7 @@ snapshots: ts-interface-checker@0.1.13: {} - ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.17.19)(jest@29.7.0(@types/node@22.8.4)(ts-node@10.9.2(@types/node@22.8.4)(typescript@5.6.3)))(typescript@5.6.3): + ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(esbuild@0.24.0)(jest@29.7.0(@types/node@22.8.4)(ts-node@10.9.2(@types/node@22.8.4)(typescript@5.6.3)))(typescript@5.6.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 @@ -24849,7 +24864,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 babel-jest: 29.7.0(@babel/core@7.26.0) - esbuild: 0.17.19 + esbuild: 0.24.0 ts-mixer@6.0.4: {}