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:
XIAOTIAN LIU
2024-08-18 19:22:30 +08:00
committed by GitHub
parent c425878f21
commit 07f7a05c4b
4 changed files with 34 additions and 18 deletions

View File

@@ -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();