Skip to content

Commit fc43262

Browse files
committed
Merge remote-tracking branch 'origin/master' into dev
2 parents 9b2e41d + 07f7a05 commit fc43262

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

out/cli.cjs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28209,6 +28209,9 @@ var package_default = {
2820928209
ini: "^3.0.1",
2821028210
inquirer: "^9.1.4",
2821128211
openai: "^3.2.1"
28212+
},
28213+
overrides: {
28214+
"whatwg-url": "13.0.0"
2821228215
}
2821328216
};
2821428217

@@ -30964,7 +30967,8 @@ var getConfig = ({
3096430967
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0,
3096530968
OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message",
3096630969
OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":",
30967-
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0
30970+
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0,
30971+
OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0
3096830972
};
3096930973
const configExists = (0, import_fs.existsSync)(configPath);
3097030974
if (!configExists)
@@ -34231,11 +34235,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" /
3423134235
process.exit(1);
3423234236
}
3423334237
var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo";
34234-
if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== "config" && mode !== "set" /* set */) {
34238+
if (provider === "openai" && MODEL.typeof !== "string" && command !== "config" && mode !== "set" /* set */) {
3423534239
ce(
34236-
`${source_default.red("\u2716")} Unsupported model ${MODEL} for OpenAI. Supported models are: ${MODEL_LIST.openai.join(
34237-
", "
34238-
)}`
34240+
`${source_default.red("\u2716")} Unsupported model ${MODEL}. The model can be any string, but the current configuration is not supported.`
3423934241
);
3424034242
process.exit(1);
3424134243
}
@@ -37280,11 +37282,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !==
3728037282
process.exit(1);
3728137283
}
3728237284
var MODEL2 = config5?.OCO_MODEL;
37283-
if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) {
37285+
if (provider2 === "anthropic" && MODEL2.typeof !== "string" && command2 !== "config" && mode2 !== "set" /* set */) {
3728437286
ce(
37285-
`${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join(
37286-
", "
37287-
)}`
37287+
`${source_default.red("\u2716")} Unsupported model ${MODEL2}. The model can be any string, but the current configuration is not supported.`
3728837288
);
3728937289
process.exit(1);
3729037290
}
@@ -41076,9 +41076,11 @@ function getEngine() {
4107641076
const provider4 = config12?.OCO_AI_PROVIDER;
4107741077
if (provider4?.startsWith("ollama")) {
4107841078
const ollamaAi = new OllamaAi();
41079-
const model = provider4.split("/")[1];
41080-
if (model)
41079+
const model = provider4.substring("ollama/".length);
41080+
if (model) {
4108141081
ollamaAi.setModel(model);
41082+
ollamaAi.setUrl(config12?.OCO_OLLAMA_API_URL);
41083+
}
4108241084
return ollamaAi;
4108341085
} else if (provider4 == "anthropic") {
4108441086
return new AnthropicAi();

out/github-action.cjs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49774,7 +49774,8 @@ var getConfig = ({
4977449774
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || void 0,
4977549775
OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || "commit-message",
4977649776
OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ":",
49777-
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0
49777+
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || void 0,
49778+
OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || void 0
4977849779
};
4977949780
const configExists = (0, import_fs.existsSync)(configPath);
4978049781
if (!configExists)
@@ -53041,11 +53042,9 @@ if (provider === "openai" && !apiKey && command !== "config" && mode !== "set" /
5304153042
process.exit(1);
5304253043
}
5304353044
var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo";
53044-
if (provider === "openai" && !MODEL_LIST.openai.includes(MODEL) && command !== "config" && mode !== "set" /* set */) {
53045+
if (provider === "openai" && MODEL.typeof !== "string" && command !== "config" && mode !== "set" /* set */) {
5304553046
ce(
53046-
`${source_default.red("\u2716")} Unsupported model ${MODEL} for OpenAI. Supported models are: ${MODEL_LIST.openai.join(
53047-
", "
53048-
)}`
53047+
`${source_default.red("\u2716")} Unsupported model ${MODEL}. The model can be any string, but the current configuration is not supported.`
5304953048
);
5305053049
process.exit(1);
5305153050
}
@@ -56090,11 +56089,9 @@ if (provider2 === "anthropic" && !apiKey2 && command2 !== "config" && mode2 !==
5609056089
process.exit(1);
5609156090
}
5609256091
var MODEL2 = config5?.OCO_MODEL;
56093-
if (provider2 === "anthropic" && !MODEL_LIST.anthropic.includes(MODEL2) && command2 !== "config" && mode2 !== "set" /* set */) {
56092+
if (provider2 === "anthropic" && MODEL2.typeof !== "string" && command2 !== "config" && mode2 !== "set" /* set */) {
5609456093
ce(
56095-
`${source_default.red("\u2716")} Unsupported model ${MODEL2} for Anthropic. Supported models are: ${MODEL_LIST.anthropic.join(
56096-
", "
56097-
)}`
56094+
`${source_default.red("\u2716")} Unsupported model ${MODEL2}. The model can be any string, but the current configuration is not supported.`
5609856095
);
5609956096
process.exit(1);
5610056097
}
@@ -59886,9 +59883,11 @@ function getEngine() {
5988659883
const provider4 = config11?.OCO_AI_PROVIDER;
5988759884
if (provider4?.startsWith("ollama")) {
5988859885
const ollamaAi = new OllamaAi();
59889-
const model = provider4.split("/")[1];
59890-
if (model)
59886+
const model = provider4.substring("ollama/".length);
59887+
if (model) {
5989159888
ollamaAi.setModel(model);
59889+
ollamaAi.setUrl(config11?.OCO_OLLAMA_API_URL);
59890+
}
5989259891
return ollamaAi;
5989359892
} else if (provider4 == "anthropic") {
5989459893
return new AnthropicAi();

src/commands/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ export const getConfig = ({
432432
OCO_AZURE_ENDPOINT: process.env.OCO_AZURE_ENDPOINT || undefined,
433433
OCO_TEST_MOCK_TYPE: process.env.OCO_TEST_MOCK_TYPE || 'commit-message',
434434
OCO_FLOWISE_ENDPOINT: process.env.OCO_FLOWISE_ENDPOINT || ':',
435-
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || undefined
435+
OCO_FLOWISE_API_KEY: process.env.OCO_FLOWISE_API_KEY || undefined,
436+
OCO_OLLAMA_API_URL: process.env.OCO_OLLAMA_API_URL || undefined
436437
};
437438
const configExists = existsSync(configPath);
438439
if (!configExists) return configFromEnv;

src/utils/engine.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ export function getEngine(): AiEngine {
1414

1515
if (provider?.startsWith('ollama')) {
1616
const ollamaAi = new OllamaAi();
17-
const model = provider.split('/')[1];
18-
if (model) ollamaAi.setModel(model);
19-
17+
const model = provider.substring('ollama/'.length);
18+
if (model) {
19+
ollamaAi.setModel(model);
20+
ollamaAi.setUrl(config?.OCO_OLLAMA_API_URL);
21+
}
2022
return ollamaAi;
2123
} else if (provider == 'anthropic') {
2224
return new AnthropicAi();

0 commit comments

Comments
 (0)