Compare commits

...

15 Commits

Author SHA1 Message Date
di-sukharev
5addb7df25 2.0.11 2023-05-04 14:29:11 +08:00
di-sukharev
e447575980 2.0.10 2023-05-04 14:29:05 +08:00
di-sukharev
ffebbc6e1b docs: update opencommit-example.png to reflect recent changes in UI 2023-05-04 14:28:55 +08:00
di-sukharev
dab0f58d14 2.0.9 2023-05-04 12:52:22 +08:00
di-sukharev
226e21c28f 2.0.8 2023-05-04 12:52:14 +08:00
di-sukharev
0bb89abccc Merge remote-tracking branch 'origin/dev' 2023-05-04 12:51:35 +08:00
Tanoshii
ad70a90b1f Update commit.ts (#154)
* fixed type
2023-05-04 12:50:09 +08:00
di-sukharev
4deaf56e5a 2.0.7 2023-05-04 12:42:30 +08:00
di-sukharev
7c1fc10248 2.0.6 2023-05-04 12:42:24 +08:00
di-sukharev
0c25a9e32c Merge branch 'dev' 2023-05-04 12:41:35 +08:00
Juan José López Lira
3f5df6ef7c Bugfix/increase tokens (#132)
* feat(api.ts): add support for OPENAI_MAX_TOKENS environment variable
feat(config.ts): add OPENAI_MAX_TOKENS to CONFIG_KEYS and configValidators

* 2.0.2

* 2.0.3

* docs(README.md): add GPT-4 usage instructions and mention the cost difference compared to GPT-3.5-turbo

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2023-05-04 12:33:06 +08:00
di-sukharev
6cb85e40e9 2.0.5 2023-04-28 15:36:53 +08:00
di-sukharev
ba82d4d476 2.0.4 2023-04-28 15:36:45 +08:00
di-sukharev
9bf2ed34a5 docs(README.md): add GPT-4 usage instructions and mention the cost difference compared to GPT-3.5-turbo 2023-04-28 15:35:40 +08:00
di-sukharev
f6ab25ed1b 2.0.3 2023-04-28 15:31:54 +08:00
8 changed files with 34 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 304 KiB

View File

@@ -54,6 +54,18 @@ oc
## Features
### Switch to GPT-4
By default OpenCommit uses GPT-3.5-turbo (ChatGPT).
You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠
```sh
oc config set model=gpt-4
```
Make sure you do lowercase `gpt-4`.
### Preface commits with emoji 🤠
[GitMoji](https://gitmoji.dev/) convention is used.

5
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "opencommit",
"version": "2.0.2",
"version": "2.0.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opencommit",
"version": "2.0.2",
"version": "2.0.11",
"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": {

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "2.0.2",
"version": "2.0.11",
"description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
"keywords": [
"git",

View File

@@ -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;

View File

@@ -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);

View File

@@ -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(

View File

@@ -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}`);