mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
feat(api.ts): add support for OPENAI_BASE_PATH configuration variable (#80)
feat(config.ts): add OPENAI_BASE_PATH configuration key and validator function Co-authored-by: yiminglu <yiming.lu@mioying.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { CONFIG_MODES, getConfig } from './commands/config';
|
||||
const config = getConfig();
|
||||
|
||||
let apiKey = config?.OPENAI_API_KEY;
|
||||
let basePath = config?.OPENAI_BASE_PATH;
|
||||
|
||||
const [command, mode] = process.argv.slice(2);
|
||||
|
||||
@@ -32,8 +33,14 @@ class OpenAi {
|
||||
private openAiApiConfiguration = new OpenAiApiConfiguration({
|
||||
apiKey: apiKey
|
||||
});
|
||||
private openAI!: OpenAIApi;
|
||||
|
||||
private openAI = new OpenAIApi(this.openAiApiConfiguration);
|
||||
constructor() {
|
||||
if (basePath) {
|
||||
this.openAiApiConfiguration.basePath = basePath;
|
||||
}
|
||||
this.openAI = new OpenAIApi(this.openAiApiConfiguration);
|
||||
}
|
||||
|
||||
public generateCommitMessage = async (
|
||||
messages: Array<ChatCompletionRequestMessage>
|
||||
|
||||
Reference in New Issue
Block a user