diff --git a/out/cli.cjs b/out/cli.cjs index 5b98d58..4fe8348 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -28209,6 +28209,9 @@ var package_default = { ini: "^3.0.1", inquirer: "^9.1.4", openai: "^3.2.1" + }, + overrides: { + "whatwg-url": "13.0.0" } }; @@ -30964,7 +30967,8 @@ var getConfig = ({ OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0, OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message", OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":", - OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0 + OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0, + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0 }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -34231,11 +34235,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" / process.exit(1); } var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo"; -if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== "config" && mode !== "set" /* set */) { +if (provider === "openai" && MODEL.typeof !== "string" && command !== "config" && mode !== "set" /* set */) { ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL} for OpenAI. Supported models are: ${MODEL_LIST.openai.join( - ", " - )}` + `${source_default.red("\u2716")} Unsupported model ${MODEL}. The model can be any string, but the current configuration is not supported.` ); process.exit(1); } @@ -37280,11 +37282,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !== process.exit(1); } var MODEL2 = config5?.OCO_MODEL; -if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) { +if (provider2 === "anthropic" && MODEL2.typeof !== "string" && command2 !== "config" && mode2 !== "set" /* set */) { ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( - ", " - )}` + `${source_default.red("\u2716")} Unsupported model ${MODEL2}. The model can be any string, but the current configuration is not supported.` ); process.exit(1); } @@ -41076,9 +41076,11 @@ function getEngine() { const provider4 = config12?.OCO_AI_PROVIDER; if (provider4?.startsWith("ollama")) { const ollamaAi = new OllamaAi(); - const model = provider4.split("/")[1]; - if (model) + const model = provider4.substring("ollama/".length); + if (model) { ollamaAi.setModel(model); + ollamaAi.setUrl(config12?.OCO_OLLAMA_API_URL); + } return ollamaAi; } else if (provider4 == "anthropic") { return new AnthropicAi(); diff --git a/out/github-action.cjs b/out/github-action.cjs index 2046bcb..6cf111d 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -49774,7 +49774,8 @@ var getConfig = ({ OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0, OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message", OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":", - OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0 + OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0, + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0 }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -53041,11 +53042,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" / process.exit(1); } var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo"; -if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== "config" && mode !== "set" /* set */) { +if (provider === "openai" && MODEL.typeof !== "string" && command !== "config" && mode !== "set" /* set */) { ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL} for OpenAI. Supported models are: ${MODEL_LIST.openai.join( - ", " - )}` + `${source_default.red("\u2716")} Unsupported model ${MODEL}. The model can be any string, but the current configuration is not supported.` ); process.exit(1); } @@ -56090,11 +56089,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !== process.exit(1); } var MODEL2 = config5?.OCO_MODEL; -if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) { +if (provider2 === "anthropic" && MODEL2.typeof !== "string" && command2 !== "config" && mode2 !== "set" /* set */) { ce( - `${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join( - ", " - )}` + `${source_default.red("\u2716")} Unsupported model ${MODEL2}. The model can be any string, but the current configuration is not supported.` ); process.exit(1); } @@ -59886,9 +59883,11 @@ function getEngine() { const provider4 = config11?.OCO_AI_PROVIDER; if (provider4?.startsWith("ollama")) { const ollamaAi = new OllamaAi(); - const model = provider4.split("/")[1]; - if (model) + const model = provider4.substring("ollama/".length); + if (model) { ollamaAi.setModel(model); + ollamaAi.setUrl(config11?.OCO_OLLAMA_API_URL); + } return ollamaAi; } else if (provider4 == "anthropic") { return new AnthropicAi(); diff --git a/src/commands/config.ts b/src/commands/config.ts index 604a715..fe01b96 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -432,7 +432,8 @@ export const getConfig = ({ OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || undefined, OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || 'commit-message', OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ':', - OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || undefined + OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || undefined, + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || undefined }; const configExists = existsSync(configPath); if (!configExists) return configFromEnv; diff --git a/src/utils/engine.ts b/src/utils/engine.ts index d176d1f..e584530 100644 --- a/src/utils/engine.ts +++ b/src/utils/engine.ts @@ -14,9 +14,11 @@ export function getEngine(): AiEngine { if (provider?.startsWith('ollama')) { const ollamaAi = new OllamaAi(); - const model = provider.split('/')[1]; - if (model) ollamaAi.setModel(model); - + const model = provider.substring('ollama/'.length); + if (model) { + ollamaAi.setModel(model); + ollamaAi.setUrl(config?.OCO_OLLAMA_API_URL); + } return ollamaAi; } else if (provider == 'anthropic') { return new AnthropicAi();