git-aicommit 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/autocommit.js CHANGED
@@ -20,6 +20,7 @@ const config = rc(
20
20
  {
21
21
  ...defaultConfig,
22
22
  openAiKey: process.env.OPENAI_API_KEY,
23
+ azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY
23
24
  },
24
25
  );
25
26
 
@@ -33,8 +34,15 @@ try {
33
34
  process.exit(1);
34
35
  }
35
36
 
36
- if (!config.openAiKey) {
37
- console.error("Please set OPENAI_API_KEY");
37
+ if (!config.openAiKey && !config.azureOpenAiKey) {
38
+ console.error("Please set OPENAI_API_KEY or AZURE_OPENAI_API_KEY");
39
+ process.exit(1);
40
+ }
41
+
42
+ // if any settings related to AZURE are set, if there are items that are not set, will error.
43
+ if (!(config.azureOpenAiKey && config.azureOpenAiInstanceName
44
+ && config.azureOpenAiDeploymentName && config.azureOpenAiVersion)){
45
+ console.error("Please set AZURE_OPENAI_API_KEY, AZURE_OPENAI_API_INSTANCE_NAME, AZURE_OPENAI_API_DEPLOYMENT_NAME, AZURE_OPENAI_API_VERSION when Azure OpenAI Service.");
38
46
  process.exit(1);
39
47
  }
40
48
 
@@ -58,6 +66,10 @@ if (!diff) {
58
66
  const openai = new ChatOpenAI({
59
67
  modelName: config.modelName,
60
68
  openAIApiKey: config.openAiKey,
69
+ azureOpenAIApiKey: config.azureOpenAiKey,
70
+ azureOpenAIApiInstanceName: config.azureOpenAiInstanceName,
71
+ azureOpenAIApiDeploymentName: config.azureOpenAiDeploymentName,
72
+ azureOpenAIApiVersion: config.azureOpenAiVersion,
61
73
  temperature: config.temperature,
62
74
  maxTokens: config.maxTokens,
63
75
  });
package/config.js CHANGED
@@ -1,5 +1,9 @@
1
1
  export default {
2
2
  openAiKey: process.env.OPENAI_API_KEY,
3
+ azureOpenAiKey: process.env.AZURE_OPENAI_API_KEY,
4
+ azureOpenAiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME,
5
+ azureOpenAiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME,
6
+ azureOpenAiVersion: process.env.AZURE_OPENAI_API_VERSION,
3
7
  addAllChangesBeforeCommit: true,
4
8
  autocommit: true,
5
9
  openCommitTextEditor: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-aicommit",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Generates auto commit messages with OpenAI GPT3 model",
5
5
  "main": "autocommit.js",
6
6
  "repository": "https://github.com/shanginn/autocommit",
@@ -8,8 +8,8 @@
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@dqbd/tiktoken": "^1.0.6",
12
- "langchain": "^0.0.59",
11
+ "@dqbd/tiktoken": "^1.0.7",
12
+ "langchain": "^0.0.75",
13
13
  "openai": "^3.2.1",
14
14
  "rc": "^1.2.8"
15
15
  },