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

plugin-image-generation tsconfig.json fix & ollama error handling #228

Merged
merged 3 commits into from
Nov 7, 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
2 changes: 1 addition & 1 deletion packages/core/elizaConfig.example.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Load custom actions from the actions directory

# Close this into a elizaConfig.yaml file that is ignored by git
# Clone this into a elizaConfig.yaml file that is ignored by git

# Paths are relative to the core/src directory

Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/core/defaultCharacter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Character, ModelProvider } from "./types.ts";
import { Character, ModelProvider, Clients } from "./types.ts";

export const defaultCharacter: Character = {
name: "Eliza",
plugins: [],
clients: [],
modelProvider: ModelProvider.LLAMALOCAL,
settings: {
secrets: {},
secrets: {
},
voice: {
model: "en_US-hfc_female-medium",
},
Expand Down
25 changes: 15 additions & 10 deletions packages/core/src/services/OllamaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,21 @@ class OllamaService {
private isProcessing: boolean = false;

private constructor() {
debug('Constructing OllamaService');
dotenv.config();
this.modelName = process.env.OLLAMA_MODEL || 'llama3.2';
this.openai = new OpenAI({
baseURL: process.env.OLLAMA_SERVER_URL || 'http://localhost:11434/v1',
apiKey: 'ollama',
dangerouslyAllowBrowser: true
});
debug(`Using model: ${this.modelName}`);
debug('OpenAI client initialized');
try {
debug('Constructing OllamaService');
dotenv.config();
this.modelName = process.env.OLLAMA_MODEL || 'llama3.2';
this.openai = new OpenAI({
baseURL: process.env.OLLAMA_SERVER_URL || 'http://localhost:11434/v1',
apiKey: 'ollama',
dangerouslyAllowBrowser: true
});
debug(`Using model: ${this.modelName}`);
debug('OpenAI client initialized');
} catch (error) {
debug('Failed to initialize OllamaService:', error);
throw new Error(`Failed to initialize Ollama service: ${error}`);
}
}

public static getInstance(): OllamaService {
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/services/llama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ class LlamaService implements ILlamaService {
private delegate: ILlamaService;

private constructor() {
const provider = settings.LOCAL_LLAMA_PROVIDER;
const provider = process.env.LOCAL_LLAMA_PROVIDER;
console.log("provider: ", provider)
if (provider === ModelProvider.OLLAMA) {
console.log("running ollama")
this.delegate = OllamaService.getInstance();
} else {
console.log("running llama-cpp")
this.delegate = LlamaCppService.getInstance();
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "src/**/*.d.ts", "types/**/*.test.ts"]
}
}
15 changes: 11 additions & 4 deletions packages/plugin-image-generation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
"outDir": "dist",
"rootDir": ".",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
},
"include": ["src"]
}
"include": ["src"],
"references": [
{ "path": "../core" }
]
}

50 changes: 25 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading