Compare commits

..

4 Commits

Author SHA1 Message Date
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
4 changed files with 17 additions and 4 deletions

5
package-lock.json generated
View File

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

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