fix(config.ts): add optional config parameter to [CONFIG_KEYS.OCO_ MODEL] validator to allow for dynamic model selection based on configuration (#337)

feat(engine/ollama.ts): integrate with config command to load OCO_MODEL from configuration and use it as the default AI engine model
This commit is contained in:
Kai Xu
2024-05-12 06:56:04 -06:00
committed by GitHub
parent 7cd3ef09cb
commit 9a0f412fff
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -180,10 +180,10 @@ export const configValidators = {
return value;
},
[CONFIG_KEYS.OCO_MODEL](value: any) {
[CONFIG_KEYS.OCO_MODEL](value: any, config: any = {}) {
validateConfig(
CONFIG_KEYS.OCO_MODEL,
[...MODEL_LIST.openai, ...MODEL_LIST.anthropic].includes(value),
[...MODEL_LIST.openai, ...MODEL_LIST.anthropic].includes(value) || config.OCO_AI_PROVIDER == 'ollama' || config.OCO_AI_PROVIDER == 'test',
`${value} is not supported yet, use 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview', 'gpt-4-0125-preview', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229' or 'claude-3-haiku-20240307'`
);
return value;