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
+7 -1
View File
@@ -2,11 +2,17 @@ import axios, { AxiosError } from 'axios';
import { ChatCompletionRequestMessage } from 'openai';
import { AiEngine } from './Engine';
import {
getConfig
} from '../commands/config';
const config = getConfig();
export class OllamaAi implements AiEngine {
async generateCommitMessage(
messages: Array<ChatCompletionRequestMessage>
): Promise<string | undefined> {
const model = 'mistral'; // todo: allow other models
const model = config?.OCO_MODEL || 'mistral';
//console.log(messages);
//process.exit()