Skip to content

Commit d4268b3

Browse files
committed
changed plugin-image-gen tsconfig.json & added error handling ollama initialization
1 parent 5b79da6 commit d4268b3

File tree

5 files changed

+53
-41
lines changed

5 files changed

+53
-41
lines changed

packages/core/src/services/OllamaService.ts

+15-10
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,21 @@ class OllamaService {
3535
private isProcessing: boolean = false;
3636

3737
private constructor() {
38-
debug('Constructing OllamaService');
39-
dotenv.config();
40-
this.modelName = process.env.OLLAMA_MODEL || 'llama3.2';
41-
this.openai = new OpenAI({
42-
baseURL: process.env.OLLAMA_SERVER_URL || 'http://localhost:11434/v1',
43-
apiKey: 'ollama',
44-
dangerouslyAllowBrowser: true
45-
});
46-
debug(`Using model: ${this.modelName}`);
47-
debug('OpenAI client initialized');
38+
try {
39+
debug('Constructing OllamaService');
40+
dotenv.config();
41+
this.modelName = process.env.OLLAMA_MODEL || 'llama3.2';
42+
this.openai = new OpenAI({
43+
baseURL: process.env.OLLAMA_SERVER_URL || 'http://localhost:11434/v1',
44+
apiKey: 'ollama',
45+
dangerouslyAllowBrowser: true
46+
});
47+
debug(`Using model: ${this.modelName}`);
48+
debug('OpenAI client initialized');
49+
} catch (error) {
50+
debug('Failed to initialize OllamaService:', error);
51+
throw new Error(`Failed to initialize Ollama service: ${error}`);
52+
}
4853
}
4954

5055
public static getInstance(): OllamaService {

packages/core/src/services/llama.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LlamaService implements ILlamaService {
1313
private constructor() {
1414
const provider = process.env.LOCAL_LLAMA_PROVIDER;
1515
console.log("provider: ", provider)
16-
if (true){//provider === ModelProvider.OLLAMA) {
16+
if (provider === ModelProvider.OLLAMA) {
1717
console.log("running ollama")
1818
this.delegate = OllamaService.getInstance();
1919
} else {

packages/core/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
},
3030
"include": ["src/**/*"],
3131
"exclude": ["node_modules", "dist", "src/**/*.d.ts", "types/**/*.test.ts"]
32-
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "dist",
5-
"rootDir": "./src"
4+
"outDir": "dist",
5+
"rootDir": ".",
6+
"module": "ESNext",
7+
"moduleResolution": "Bundler",
8+
"types": ["node"]
69
},
7-
"include": ["src"]
8-
}
10+
"include": ["src"],
11+
"references": [
12+
{ "path": "../core" }
13+
]
14+
}
15+

pnpm-lock.yaml

+25-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)