Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
di-sukharev
2024-08-18 14:23:26 +03:00
4 changed files with 30 additions and 26 deletions
+13 -11
View File
@@ -28209,6 +28209,9 @@ var package_default = {
ini: "^3.0.1", ini: "^3.0.1",
inquirer: "^9.1.4", inquirer: "^9.1.4",
openai: "^3.2.1" 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_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_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":", 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); const configExists = (0, import_fs.existsSync)(configPath);
if (!configExists) if (!configExists)
@@ -34231,11 +34235,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" /
process.exit(1); process.exit(1);
} }
var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo"; 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( 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); process.exit(1);
} }
@@ -37280,11 +37282,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !==
process.exit(1); process.exit(1);
} }
var MODEL2 = config5?.OCO_MODEL; 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( 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); process.exit(1);
} }
@@ -41076,9 +41076,11 @@ function getEngine() {
const provider4 = config12?.OCO_AI_PROVIDER; const provider4 = config12?.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(config12?.OCO_OLLAMA_API_URL);
}
return ollamaAi; return ollamaAi;
} else if (provider4 == "anthropic") { } else if (provider4 == "anthropic") {
return new AnthropicAi(); return new AnthropicAi();
+10 -11
View File
@@ -49774,7 +49774,8 @@ var getConfig = ({
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0, 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_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":", 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); const configExists = (0, import_fs.existsSync)(configPath);
if (!configExists) if (!configExists)
@@ -53041,11 +53042,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" /
process.exit(1); process.exit(1);
} }
var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo"; 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( 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); process.exit(1);
} }
@@ -56090,11 +56089,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !==
process.exit(1); process.exit(1);
} }
var MODEL2 = config5?.OCO_MODEL; 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( 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); process.exit(1);
} }
@@ -59886,9 +59883,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();
+2 -1
View File
@@ -432,7 +432,8 @@ export const getConfig = ({
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_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ':', 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); const configExists = existsSync(configPath);
if (!configExists) return configFromEnv; if (!configExists) return configFromEnv;
+5 -3
View File
@@ -14,9 +14,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();