@@ -4421,7 +4421,7 @@ var require_base = __commonJS({
44214421 tsv: " ",
44224422 pipes: "|"
44234423 };
4424- var BaseAPI2 = class {
4424+ var BaseAPI = class {
44254425 constructor(configuration, basePath2 = exports.BASE_PATH, axios2 = axios_1.default) {
44264426 this.basePath = basePath2;
44274427 this.axios = axios2;
@@ -4431,7 +4431,7 @@ var require_base = __commonJS({
44314431 }
44324432 }
44334433 };
4434- exports.BaseAPI = BaseAPI2 ;
4434+ exports.BaseAPI = BaseAPI ;
44354435 var RequiredError = class extends Error {
44364436 constructor(field, msg) {
44374437 super(msg);
@@ -17287,6 +17287,7 @@ var package_default = {
1728717287 watch: "npm run -S build -- --sourcemap --watch",
1728817288 start: "node ./out/cli.cjs",
1728917289 dev: "ts-node ./src/cli.ts",
17290+ clean: "rm -rf .npm/ node_modules/ out/*; npm ci",
1729017291 build: "rimraf out && node esbuild.config.js",
1729117292 deploy: "npm run build && npm version patch && npm publish --tag latest",
1729217293 lint: "eslint src --ext ts && tsc --noEmit",
@@ -17295,9 +17296,9 @@ var package_default = {
1729517296 devDependencies: {
1729617297 "@types/ini": "^1.3.31",
1729717298 "@types/inquirer": "^9.0.3",
17298- "@types/node": "^20.1.0 ",
17299- "@typescript-eslint/eslint-plugin": "^5.59.2 ",
17300- "@typescript-eslint/parser": "^5.59.2 ",
17299+ "@types/node": "^20.1.1 ",
17300+ "@typescript-eslint/eslint-plugin": "^5.59.5 ",
17301+ "@typescript-eslint/parser": "^5.59.5 ",
1730117302 dotenv: "^16.0.3",
1730217303 esbuild: "^0.17.18",
1730317304 eslint: "^8.40.0",
@@ -17314,7 +17315,7 @@ var package_default = {
1731417315 execa: "^7.1.1",
1731517316 ignore: "^5.2.4",
1731617317 ini: "^4.1.0",
17317- inquirer: "^9.2.1 ",
17318+ inquirer: "^9.2.2 ",
1731817319 openai: "^3.2.1"
1731917320 }
1732017321};
@@ -18592,7 +18593,7 @@ var configValidators = {
1859218593 validateConfig(
1859318594 "OPENAI_API_KEY" /* OPENAI_API_KEY */,
1859418595 value.length === 51 || value.length === 32,
18595- "Must be 32 or 51 characters long"
18596+ "Must be 51 or 32 characters long"
1859618597 );
1859718598 return value;
1859818599 },
@@ -23006,56 +23007,6 @@ var {
2300623007
2300723008// src/api.ts
2300823009var import_openai = __toESM(require_dist(), 1);
23009-
23010- // src/utils/AzureOpenAI.ts
23011- var import_base = __toESM(require_base(), 1);
23012- var AzureOpenAIApi = class extends import_base.BaseAPI {
23013- constructor(configuration) {
23014- super(configuration);
23015- }
23016- /**
23017- *
23018- * @summary Creates a completion for the chat message
23019- * @param {CreateChatCompletionRequest} createChatCompletionRequest
23020- * @param {*} [options] Override http request option.
23021- * @throws {RequiredError}
23022- * @memberof AzureOpenAIApi
23023- */
23024- async createChatCompletion(createChatCompletionRequest, options) {
23025- if (!this.configuration) {
23026- throw new Error("Required parameter configuration was null or undefined when calling createChatCompletion.");
23027- }
23028- if (!this.configuration.basePath) {
23029- throw new Error("Required parameter basePath was null or undefined when calling createChatCompletion.");
23030- }
23031- if (!this.configuration.apiKey) {
23032- throw new Error("Required parameter apiKey was null or undefined when calling createChatCompletion.");
23033- }
23034- if (typeof this.configuration.apiKey !== "string") {
23035- throw new Error("Required parameter apiKey was of type string when calling createChatCompletion.");
23036- }
23037- const url3 = this.configuration.basePath + "openai/deployments/" + createChatCompletionRequest.model + "/chat/completions";
23038- if (!options)
23039- options = {};
23040- if (!options.headers)
23041- options.headers = {};
23042- if (!options.params)
23043- options.params = {};
23044- options.headers = {
23045- "Content-Type": "application/json",
23046- "api-key": this.configuration.apiKey,
23047- ...options.headers
23048- };
23049- options.params = {
23050- "api-version": "2023-03-15-preview",
23051- ...options.params
23052- };
23053- const response = await this.axios.post(url3, createChatCompletionRequest, options);
23054- return response;
23055- }
23056- };
23057-
23058- // src/api.ts
2305923010var config = getConfig();
2306023011var apiKey = config?.OPENAI_API_KEY;
2306123012var basePath = config?.OPENAI_BASE_PATH;
@@ -23079,10 +23030,28 @@ var OpenAi = class {
2307923030 });
2308023031 openAI;
2308123032 constructor() {
23082- if (basePath) {
23083- this.openAiApiConfiguration.basePath = basePath;
23033+ switch (apiType) {
23034+ case "azure":
23035+ this.openAiApiConfiguration.baseOptions = {
23036+ headers: {
23037+ "api-key": apiKey
23038+ },
23039+ params: {
23040+ "api-version": "2023-03-15-preview"
23041+ }
23042+ };
23043+ if (basePath) {
23044+ this.openAiApiConfiguration.basePath = basePath + "openai/deployments/" + MODEL;
23045+ }
23046+ break;
23047+ case "openai":
23048+ default:
23049+ if (basePath) {
23050+ this.openAiApiConfiguration.basePath = basePath;
23051+ }
23052+ break;
2308423053 }
23085- this.openAI = apiType === "azure" ? new AzureOpenAIApi(this.openAiApiConfiguration) : new import_openai.OpenAIApi(this.openAiApiConfiguration);
23054+ this.openAI = new import_openai.OpenAIApi(this.openAiApiConfiguration);
2308623055 }
2308723056 generateCommitMessage = async (messages, prefix) => {
2308823057 try {
0 commit comments