diff --git a/out/cli.cjs b/out/cli.cjs index 3788260..40dde38 100755 --- a/out/cli.cjs +++ b/out/cli.cjs @@ -30567,8 +30567,8 @@ var vi_VN_default = { // src/i18n/zh_CN.json var zh_CN_default = { localLanguage: "\u7B80\u4F53\u4E2D\u6587", - commitFix: "\u4FEE\u590D(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT", - commitFeat: "\u529F\u80FD(server.ts)\uFF1A\u6DFB\u52A0\u5BF9process.env.PORT\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301", + commitFix: "fix(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT", + commitFeat: "feat(server.ts)\uFF1A\u6DFB\u52A0\u5BF9process.env.PORT\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301", commitDescription: "\u73B0\u5728\u7AEF\u53E3\u53D8\u91CF\u88AB\u547D\u540D\u4E3APORT\uFF0C\u8FD9\u63D0\u9AD8\u4E86\u547D\u540D\u7EA6\u5B9A\u7684\u4E00\u81F4\u6027\uFF0C\u56E0\u4E3APORT\u662F\u4E00\u4E2A\u5E38\u91CF\u3002\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301\u4F7F\u5E94\u7528\u7A0B\u5E8F\u66F4\u52A0\u7075\u6D3B\uFF0C\u56E0\u4E3A\u5B83\u73B0\u5728\u53EF\u4EE5\u901A\u8FC7process.env.PORT\u73AF\u5883\u53D8\u91CF\u5728\u4EFB\u4F55\u53EF\u7528\u7AEF\u53E3\u4E0A\u8FD0\u884C\u3002" }; @@ -30691,7 +30691,14 @@ var MODEL_LIST = { "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", - "claude-3-opus-20240229" + "claude-3-haiku-20240307" + ], + gemini: [ + "gemini-1.5-flash", + "gemini-1.5-pro", + "gemini-1.0-pro", + "gemini-pro-vision", + "text-embedding-004" ] }; var getDefaultModel = (provider4) => { @@ -30930,8 +30937,9 @@ var getConfig = ({ OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai", OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true, OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false, - OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "", - OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message" + OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0, + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message", + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0 }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -41015,9 +41023,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/out/github-action.cjs b/out/github-action.cjs index 87b2a09..68ac2e8 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -49377,8 +49377,8 @@ var vi_VN_default = { // src/i18n/zh_CN.json var zh_CN_default = { localLanguage: "\u7B80\u4F53\u4E2D\u6587", - commitFix: "\u4FEE\u590D(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT", - commitFeat: "\u529F\u80FD(server.ts)\uFF1A\u6DFB\u52A0\u5BF9process.env.PORT\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301", + commitFix: "fix(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT", + commitFeat: "feat(server.ts)\uFF1A\u6DFB\u52A0\u5BF9process.env.PORT\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301", commitDescription: "\u73B0\u5728\u7AEF\u53E3\u53D8\u91CF\u88AB\u547D\u540D\u4E3APORT\uFF0C\u8FD9\u63D0\u9AD8\u4E86\u547D\u540D\u7EA6\u5B9A\u7684\u4E00\u81F4\u6027\uFF0C\u56E0\u4E3APORT\u662F\u4E00\u4E2A\u5E38\u91CF\u3002\u73AF\u5883\u53D8\u91CF\u7684\u652F\u6301\u4F7F\u5E94\u7528\u7A0B\u5E8F\u66F4\u52A0\u7075\u6D3B\uFF0C\u56E0\u4E3A\u5B83\u73B0\u5728\u53EF\u4EE5\u901A\u8FC7process.env.PORT\u73AF\u5883\u53D8\u91CF\u5728\u4EFB\u4F55\u53EF\u7528\u7AEF\u53E3\u4E0A\u8FD0\u884C\u3002" }; @@ -49501,7 +49501,7 @@ var MODEL_LIST = { "claude-3-5-sonnet-20240620", "claude-3-opus-20240229", "claude-3-sonnet-20240229", - "claude-3-opus-20240229" + "claude-3-haiku-20240307" ], gemini: [ "gemini-1.5-flash", @@ -49747,8 +49747,9 @@ var getConfig = ({ OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai", OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true, OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false, - OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "", - OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message" + OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0, + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message", + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0 }; const configExists = (0, import_fs.existsSync)(configPath); if (!configExists) @@ -59832,9 +59833,11 @@ function getEngine() { const provider4 = config10?.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(config10?.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 8987144..67d7f0e 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -396,7 +396,8 @@ export const getConfig = ({ OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === 'true' ? true : false, OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || undefined, - OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || 'commit-message' + OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || 'commit-message', + OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || undefined, }; const configExists = existsSync(configPath); diff --git a/src/utils/engine.ts b/src/utils/engine.ts index ac9fdfd..c4f1151 100644 --- a/src/utils/engine.ts +++ b/src/utils/engine.ts @@ -13,9 +13,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();