Compare commits

...

14 Commits

Author SHA1 Message Date
di-sukharev
54006826f8 2.0.15 2023-05-19 13:47:51 +08:00
di-sukharev
f674e2d99a 2.0.14 2023-05-19 13:47:45 +08:00
di-sukharev
8140322c32 refactor(prepare-commit-msg-hook.ts): remove console.log statement for commitSource variable to reduce noise in logs 2023-05-19 13:47:26 +08:00
di-sukharev
1cb8d580bb refactor(api.ts): reorder variable declarations to improve readability and semantics
refactor(prepare-commit-msg-hook.ts): remove console.log statement used for debugging purposes
2023-05-19 13:46:33 +08:00
di-sukharev
8daa3ca130 Merge remote-tracking branch 'origin/dev' 2023-05-19 13:42:43 +08:00
Takuya Ono
13015a9033 🐛 fix(config.ts): convert string value to number in OPENAI_MAX_TOKENS validator (#162)
The OPENAI_MAX_TOKENS validator now converts a string value to a number before validating it. This ensures that the validator works correctly when a string value is passed in.
2023-05-07 17:16:32 +08:00
Takuya Ono
7b90b6a287 🐛 fix(config.ts): error message for OPENAI_BASE_PATH validation (#164)
The error message for the OPENAI_BASE_PATH validation has been updated
to be more descriptive and helpful. The message now reads "Must be
string" instead of "${value} is not supported yet". This change improves
the clarity of the error message and makes it easier for developers to
understand what went wrong when the validation fails.
2023-05-07 17:15:55 +08:00
di-sukharev
598881a41c 2.0.13 2023-05-04 16:38:35 +08:00
di-sukharev
1080544631 2.0.12 2023-05-04 16:38:28 +08:00
di-sukharev
de68e6cc7a docs(README.md): add instructions for configuring openAI maxTokens and BASE_PATH parameters to customize API usage 2023-05-04 16:38:02 +08:00
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
6 changed files with 34 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 304 KiB

View File

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

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "opencommit",
"version": "2.0.8",
"version": "2.0.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opencommit",
"version": "2.0.8",
"version": "2.0.15",
"license": "MIT",
"dependencies": {
"@clack/prompts": "^0.6.1",

View File

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

View File

@@ -11,9 +11,9 @@ import { CONFIG_MODES, getConfig } from './commands/config';
const config = getConfig();
let apiKey = config?.OPENAI_API_KEY;
let basePath = config?.OPENAI_BASE_PATH;
let maxTokens = config?.OPENAI_MAX_TOKENS;
let basePath = config?.OPENAI_BASE_PATH;
let apiKey = config?.OPENAI_API_KEY;
const [command, mode] = process.argv.slice(2);

View File

@@ -65,6 +65,15 @@ export const configValidators = {
},
[CONFIG_KEYS.OPENAI_MAX_TOKENS](value: any) {
// If the value is a string, convert it to a number.
if (typeof value === 'string') {
value = parseInt(value);
validateConfig(
CONFIG_KEYS.OPENAI_MAX_TOKENS,
!isNaN(value),
'Must be a number'
);
}
validateConfig(
CONFIG_KEYS.OPENAI_MAX_TOKENS,
typeof value === 'number',
@@ -96,8 +105,8 @@ export const configValidators = {
[CONFIG_KEYS.OPENAI_BASE_PATH](value: any) {
validateConfig(
CONFIG_KEYS.OPENAI_BASE_PATH,
typeof value == 'string',
`${value} is not supported yet`
typeof value === 'string',
'Must be string'
);
return value;
},