support read OCO_OLLAMA_API_URL from env to OllamaAiEngine and fix bug in getting ollma model name when slash exists (#375)
This commit is contained in:
+17
-7
@@ -30567,8 +30567,8 @@ var vi_VN_default = {
|
|||||||
// src/i18n/zh_CN.json
|
// src/i18n/zh_CN.json
|
||||||
var zh_CN_default = {
|
var zh_CN_default = {
|
||||||
localLanguage: "\u7B80\u4F53\u4E2D\u6587",
|
localLanguage: "\u7B80\u4F53\u4E2D\u6587",
|
||||||
commitFix: "\u4FEE\u590D(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT",
|
commitFix: "fix(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",
|
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"
|
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-5-sonnet-20240620",
|
||||||
"claude-3-opus-20240229",
|
"claude-3-opus-20240229",
|
||||||
"claude-3-sonnet-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) => {
|
var getDefaultModel = (provider4) => {
|
||||||
@@ -30930,8 +30937,9 @@ var getConfig = ({
|
|||||||
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
||||||
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
||||||
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false,
|
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false,
|
||||||
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "",
|
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0,
|
||||||
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 || void 0
|
||||||
};
|
};
|
||||||
const configExists = (0, import_fs.existsSync)(configPath);
|
const configExists = (0, import_fs.existsSync)(configPath);
|
||||||
if (!configExists)
|
if (!configExists)
|
||||||
@@ -41015,9 +41023,11 @@ function getEngine() {
|
|||||||
const provider4 = config11?.OCO_AI_PROVIDER;
|
const provider4 = config11?.OCO_AI_PROVIDER;
|
||||||
if (provider4?.startsWith("ollama")) {
|
if (provider4?.startsWith("ollama")) {
|
||||||
const ollamaAi = new OllamaAi();
|
const ollamaAi = new OllamaAi();
|
||||||
const model = provider4.split("/")[1];
|
const model = provider4.substring("ollama/".length);
|
||||||
if (model)
|
if (model) {
|
||||||
ollamaAi.setModel(model);
|
ollamaAi.setModel(model);
|
||||||
|
ollamaAi.setUrl(config11?.OCO_OLLAMA_API_URL);
|
||||||
|
}
|
||||||
return ollamaAi;
|
return ollamaAi;
|
||||||
} else if (provider4 == "anthropic") {
|
} else if (provider4 == "anthropic") {
|
||||||
return new AnthropicAi();
|
return new AnthropicAi();
|
||||||
|
|||||||
+10
-7
@@ -49377,8 +49377,8 @@ var vi_VN_default = {
|
|||||||
// src/i18n/zh_CN.json
|
// src/i18n/zh_CN.json
|
||||||
var zh_CN_default = {
|
var zh_CN_default = {
|
||||||
localLanguage: "\u7B80\u4F53\u4E2D\u6587",
|
localLanguage: "\u7B80\u4F53\u4E2D\u6587",
|
||||||
commitFix: "\u4FEE\u590D(server.ts)\uFF1A\u5C06\u7AEF\u53E3\u53D8\u91CF\u4ECE\u5C0F\u5199port\u6539\u4E3A\u5927\u5199PORT",
|
commitFix: "fix(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",
|
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"
|
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-5-sonnet-20240620",
|
||||||
"claude-3-opus-20240229",
|
"claude-3-opus-20240229",
|
||||||
"claude-3-sonnet-20240229",
|
"claude-3-sonnet-20240229",
|
||||||
"claude-3-opus-20240229"
|
"claude-3-haiku-20240307"
|
||||||
],
|
],
|
||||||
gemini: [
|
gemini: [
|
||||||
"gemini-1.5-flash",
|
"gemini-1.5-flash",
|
||||||
@@ -49747,8 +49747,9 @@ var getConfig = ({
|
|||||||
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
|
||||||
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
|
||||||
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false,
|
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false,
|
||||||
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || "",
|
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0,
|
||||||
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 || void 0
|
||||||
};
|
};
|
||||||
const configExists = (0, import_fs.existsSync)(configPath);
|
const configExists = (0, import_fs.existsSync)(configPath);
|
||||||
if (!configExists)
|
if (!configExists)
|
||||||
@@ -59832,9 +59833,11 @@ function getEngine() {
|
|||||||
const provider4 = config10?.OCO_AI_PROVIDER;
|
const provider4 = config10?.OCO_AI_PROVIDER;
|
||||||
if (provider4?.startsWith("ollama")) {
|
if (provider4?.startsWith("ollama")) {
|
||||||
const ollamaAi = new OllamaAi();
|
const ollamaAi = new OllamaAi();
|
||||||
const model = provider4.split("/")[1];
|
const model = provider4.substring("ollama/".length);
|
||||||
if (model)
|
if (model) {
|
||||||
ollamaAi.setModel(model);
|
ollamaAi.setModel(model);
|
||||||
|
ollamaAi.setUrl(config10?.OCO_OLLAMA_API_URL);
|
||||||
|
}
|
||||||
return ollamaAi;
|
return ollamaAi;
|
||||||
} else if (provider4 == "anthropic") {
|
} else if (provider4 == "anthropic") {
|
||||||
return new AnthropicAi();
|
return new AnthropicAi();
|
||||||
|
|||||||
@@ -396,7 +396,8 @@ export const getConfig = ({
|
|||||||
OCO_ONE_LINE_COMMIT:
|
OCO_ONE_LINE_COMMIT:
|
||||||
process.env.OCO_ONE_LINE_COMMIT === 'true' ? true : false,
|
process.env.OCO_ONE_LINE_COMMIT === 'true' ? true : false,
|
||||||
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || undefined,
|
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);
|
const configExists = existsSync(configPath);
|
||||||
|
|||||||
+5
-3
@@ -13,9 +13,11 @@ export function getEngine(): AiEngine {
|
|||||||
|
|
||||||
if (provider?.startsWith('ollama')) {
|
if (provider?.startsWith('ollama')) {
|
||||||
const ollamaAi = new OllamaAi();
|
const ollamaAi = new OllamaAi();
|
||||||
const model = provider.split('/')[1];
|
const model = provider.substring('ollama/'.length);
|
||||||
if (model) ollamaAi.setModel(model);
|
if (model) {
|
||||||
|
ollamaAi.setModel(model);
|
||||||
|
ollamaAi.setUrl(config?.OCO_OLLAMA_API_URL);
|
||||||
|
}
|
||||||
return ollamaAi;
|
return ollamaAi;
|
||||||
} else if (provider == 'anthropic') {
|
} else if (provider == 'anthropic') {
|
||||||
return new AnthropicAi();
|
return new AnthropicAi();
|
||||||
|
|||||||
Reference in New Issue
Block a user