git-aicommit 7.2.5 → 7.4.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/config.js CHANGED
@@ -22,7 +22,7 @@ export default {
22
22
  '*.lock', '*.lockb', '*-lock.json', '*-lock.yaml'
23
23
  ],
24
24
  diffFilter: 'ACMRTUXB',
25
- modelName: "gpt-4.1-mini",
25
+ modelName: "gpt-5-mini",
26
26
  temperature: 0.0,
27
27
  maxTokens: 2000,
28
28
  }
package/count_tokens.js CHANGED
@@ -18,6 +18,10 @@ export const getModelNameForTiktoken = (modelName) => {
18
18
  if (modelName.startsWith("gpt-4o-")) {
19
19
  return "gpt-4o";
20
20
  }
21
+
22
+ if (modelName.startsWith("gpt-4.1")) {
23
+ return "gpt-4o";
24
+ }
21
25
  return modelName;
22
26
  };
23
27
 
@@ -51,18 +55,25 @@ export const importTiktoken = async () => {
51
55
 
52
56
  export const calculateMaxTokens = async ({ prompt, modelName }) => {
53
57
  const { encoding_for_model } = await importTiktoken();
54
- // fallback to approximate calculation if tiktoken is not available
55
- let numTokens = Math.ceil(prompt.length / 4);
58
+ let numTokens;
59
+
56
60
  try {
57
61
  if (encoding_for_model) {
58
62
  const encoding = encoding_for_model(getModelNameForTiktoken(modelName));
59
63
  const tokenized = encoding.encode(prompt);
60
64
  numTokens = tokenized.length;
61
65
  encoding.free();
66
+ } else {
67
+ console.warn("tiktoken is not available, falling back to approximate token count");
68
+
69
+ numTokens = Math.ceil(prompt.length / 4);
62
70
  }
63
71
  } catch (error) {
64
72
  console.warn("Failed to calculate number of tokens with tiktoken, falling back to approximate count", error);
73
+
74
+ numTokens = Math.ceil(prompt.length / 4);
65
75
  }
76
+
66
77
  const maxTokens = getModelContextSize(modelName);
67
78
  return maxTokens - numTokens;
68
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-aicommit",
3
- "version": "7.2.5",
3
+ "version": "7.4.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,9 +8,9 @@
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "openai": "^4.100.0",
11
+ "openai": "^4.104.0",
12
12
  "rc": "^1.2.8",
13
- "tiktoken": "^1.0.21"
13
+ "tiktoken": "^1.0.22"
14
14
  },
15
15
  "preferGlobal": true,
16
16
  "bin": {