mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-13 07:38:01 -05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1080544631 | ||
|
|
de68e6cc7a | ||
|
|
5addb7df25 | ||
|
|
e447575980 | ||
|
|
ffebbc6e1b | ||
|
|
dab0f58d14 | ||
|
|
226e21c28f | ||
|
|
0bb89abccc | ||
|
|
ad70a90b1f | ||
|
|
4deaf56e5a | ||
|
|
7c1fc10248 | ||
|
|
0c25a9e32c | ||
|
|
3f5df6ef7c |
BIN
.github/opencommit-example.png
vendored
BIN
.github/opencommit-example.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 318 KiB After Width: | Height: | Size: 304 KiB |
18
README.md
18
README.md
@@ -96,6 +96,24 @@ To remove description:
|
||||
oc config set description=false
|
||||
```
|
||||
|
||||
### Configure openAI maxTokens param
|
||||
|
||||
Default value for `maxTokens` is 196, sometimes you can get 400 error if request+response exceeds `maxToken` parameter.
|
||||
|
||||
so you can increase it:
|
||||
|
||||
```sh
|
||||
oc config set OPENAI_MAX_TOKENS=<number>
|
||||
```
|
||||
|
||||
### Configure BASE_PATH for openAI api
|
||||
|
||||
if you want to call GPT via proxy — you can change `BASE_PATH` parameter:
|
||||
|
||||
```sh
|
||||
oc config set OPENAI_BASE_PATH=<string>
|
||||
```
|
||||
|
||||
### Internationalization support
|
||||
|
||||
To specify the language used to generate commit messages:
|
||||
|
||||
5
package-lock.json
generated
5
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.12",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "opencommit",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.6.1",
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"bin": {
|
||||
"oc": "out/cli.cjs",
|
||||
"oco": "out/cli.cjs",
|
||||
"opencommit": "out/cli.cjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.12",
|
||||
"description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
|
||||
"keywords": [
|
||||
"git",
|
||||
|
||||
@@ -13,6 +13,7 @@ const config = getConfig();
|
||||
|
||||
let apiKey = config?.OPENAI_API_KEY;
|
||||
let basePath = config?.OPENAI_BASE_PATH;
|
||||
let maxTokens = config?.OPENAI_MAX_TOKENS;
|
||||
|
||||
const [command, mode] = process.argv.slice(2);
|
||||
|
||||
@@ -53,7 +54,7 @@ class OpenAi {
|
||||
messages,
|
||||
temperature: 0,
|
||||
top_p: 0.1,
|
||||
max_tokens: 196
|
||||
max_tokens: maxTokens ?? 196
|
||||
});
|
||||
|
||||
const message = data.choices[0].message;
|
||||
|
||||
@@ -73,7 +73,7 @@ ${chalk.grey('——————————————————')}`
|
||||
...extraArgs
|
||||
]);
|
||||
|
||||
outro(`${chalk.green('✔')} successfully committed`);
|
||||
outro(`${chalk.green('✔')} Successfully committed`);
|
||||
|
||||
outro(stdout);
|
||||
|
||||
@@ -102,7 +102,7 @@ ${chalk.grey('——————————————————')}`
|
||||
]);
|
||||
|
||||
pushSpinner.stop(
|
||||
`${chalk.green('✔')} successfully pushed all commits to ${remotes[0]}`
|
||||
`${chalk.green('✔')} Successfully pushed all commits to ${remotes[0]}`
|
||||
);
|
||||
|
||||
if (stdout) outro(stdout);
|
||||
@@ -126,7 +126,7 @@ ${chalk.grey('——————————————————')}`
|
||||
pushSpinner.stop(
|
||||
`${chalk.green(
|
||||
'✔'
|
||||
)} successfully pushed all commits to ${selectedRemote}`
|
||||
)} Successfully pushed all commits to ${selectedRemote}`
|
||||
);
|
||||
|
||||
if (stdout) outro(stdout);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getI18nLocal } from '../i18n';
|
||||
|
||||
export enum CONFIG_KEYS {
|
||||
OPENAI_API_KEY = 'OPENAI_API_KEY',
|
||||
OPENAI_MAX_TOKENS = 'OPENAI_MAX_TOKENS',
|
||||
OPENAI_BASE_PATH = 'OPENAI_BASE_PATH',
|
||||
description = 'description',
|
||||
emoji = 'emoji',
|
||||
@@ -63,6 +64,16 @@ export const configValidators = {
|
||||
return value;
|
||||
},
|
||||
|
||||
[CONFIG_KEYS.OPENAI_MAX_TOKENS](value: any) {
|
||||
validateConfig(
|
||||
CONFIG_KEYS.OPENAI_MAX_TOKENS,
|
||||
typeof value === 'number',
|
||||
'Must be a number'
|
||||
);
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
[CONFIG_KEYS.emoji](value: any) {
|
||||
validateConfig(
|
||||
CONFIG_KEYS.emoji,
|
||||
@@ -148,7 +159,7 @@ export const setConfig = (keyValues: [key: string, value: string][]) => {
|
||||
|
||||
writeFileSync(configPath, iniStringify(config), 'utf8');
|
||||
|
||||
outro(`${chalk.green('✔')} config successfully set`);
|
||||
outro(`${chalk.green('✔')} Config successfully set`);
|
||||
};
|
||||
|
||||
export const configCommand = command(
|
||||
|
||||
@@ -92,7 +92,7 @@ export const hookCommand = command(
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`unsupported mode: ${mode}. Supported modes are: 'set' or 'unset'`
|
||||
`Unsupported mode: ${mode}. Supported modes are: 'set' or 'unset'`
|
||||
);
|
||||
} catch (error) {
|
||||
outro(`${chalk.red('✖')} ${error}`);
|
||||
|
||||
Reference in New Issue
Block a user