improve OCO_AI_PROVIDER=ollama[/model name] (#327)

* 🐛 (config.ts, engine/ollama.ts, utils/engine.ts): improve Ollama AI configuration and usage
 (config.ts): add support for multiple Ollama models and allow users to specify the model in their config
 (engine/ollama.ts, utils/engine.ts): refactor code to use the specified Ollama model instead of hardcoding it

* add build results
This commit is contained in:
tumf
2024-05-07 14:51:24 +07:00
committed by GitHub
parent 058bad95cd
commit 74024a4997
5 changed files with 4302 additions and 43880 deletions
+3 -4
View File
@@ -82,7 +82,7 @@ export const configValidators = {
//need api key unless running locally with ollama
validateConfig(
'OpenAI API_KEY',
value || config.OCO_ANTHROPIC_API_KEY || config.OCO_AI_PROVIDER == 'ollama' || config.OCO_AI_PROVIDER == 'test',
value || config.OCO_ANTHROPIC_API_KEY || config.OCO_AI_PROVIDER.startsWith('ollama') || config.OCO_AI_PROVIDER == 'test',
'You need to provide an OpenAI/Anthropic API key'
);
validateConfig(
@@ -223,10 +223,9 @@ export const configValidators = {
'',
'openai',
'anthropic',
'ollama',
'test'
].includes(value),
`${value} is not supported yet, use 'ollama' 'anthropic' or 'openai' (default)`
].includes(value) || value.startsWith('ollama'),
`${value} is not supported yet, use 'ollama/{model}' 'anthropic' or 'openai' (default)`
);
return value;
},