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:
@@ -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);
|
||||
|
||||
+5
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user