fix(config.ts): move 'gpt-4o-mini' in MODEL_LIST
docs(config.ts): update API key validation message with detailed instructions refactor(config.ts): simplify model validation logic to check for string type instead of MODEL_LIST
This commit is contained in:
+3
-7
@@ -30663,6 +30663,7 @@ var TestAi = class {
|
|||||||
// src/commands/config.ts
|
// src/commands/config.ts
|
||||||
var MODEL_LIST = {
|
var MODEL_LIST = {
|
||||||
openai: [
|
openai: [
|
||||||
|
"gpt-4o-mini",
|
||||||
"gpt-3.5-turbo",
|
"gpt-3.5-turbo",
|
||||||
"gpt-3.5-turbo-instruct",
|
"gpt-3.5-turbo-instruct",
|
||||||
"gpt-3.5-turbo-0613",
|
"gpt-3.5-turbo-0613",
|
||||||
@@ -30687,7 +30688,6 @@ var MODEL_LIST = {
|
|||||||
"gpt-4-32k-0613",
|
"gpt-4-32k-0613",
|
||||||
"gpt-4o",
|
"gpt-4o",
|
||||||
"gpt-4o-2024-05-13",
|
"gpt-4o-2024-05-13",
|
||||||
"gpt-4o-mini",
|
|
||||||
"gpt-4o-mini-2024-07-18"
|
"gpt-4o-mini-2024-07-18"
|
||||||
],
|
],
|
||||||
anthropic: [
|
anthropic: [
|
||||||
@@ -30731,7 +30731,7 @@ var configValidators = {
|
|||||||
validateConfig(
|
validateConfig(
|
||||||
"OpenAI API_KEY",
|
"OpenAI API_KEY",
|
||||||
value || config12.OCO_ANTHROPIC_API_KEY || config12.OCO_AI_PROVIDER.startsWith("ollama") || config12.OCO_AZURE_API_KEY || config12.OCO_AI_PROVIDER == "test" || config12.OCO_AI_PROVIDER == "flowise",
|
value || config12.OCO_ANTHROPIC_API_KEY || config12.OCO_AI_PROVIDER.startsWith("ollama") || config12.OCO_AZURE_API_KEY || config12.OCO_AI_PROVIDER == "test" || config12.OCO_AI_PROVIDER == "flowise",
|
||||||
"You need to provide an OpenAI/Anthropic/Azure API key"
|
"You need to provide an OpenAI/Anthropic/Azure or other provider API key via `oco config set OCO_OPENAI_API_KEY=your_key`, for help refer to docs https://github.com/di-sukharev/opencommit"
|
||||||
);
|
);
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
||||||
@@ -30841,11 +30841,7 @@ var configValidators = {
|
|||||||
["OCO_MODEL" /* OCO_MODEL */](value, config12 = {}) {
|
["OCO_MODEL" /* OCO_MODEL */](value, config12 = {}) {
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_MODEL" /* OCO_MODEL */,
|
"OCO_MODEL" /* OCO_MODEL */,
|
||||||
[
|
typeof value === "string",
|
||||||
...MODEL_LIST.openai,
|
|
||||||
...MODEL_LIST.anthropic,
|
|
||||||
...MODEL_LIST.gemini
|
|
||||||
].includes(value) || config12.OCO_AI_PROVIDER == "ollama" || config12.OCO_AI_PROVIDER == "azure" || config12.OCO_AI_PROVIDER == "test" || config12.OCO_AI_PROVIDER == "flowise",
|
|
||||||
`${value} is not supported yet, use:
|
`${value} is not supported yet, use:
|
||||||
|
|
||||||
${[
|
${[
|
||||||
|
|||||||
@@ -49470,6 +49470,7 @@ var TestAi = class {
|
|||||||
// src/commands/config.ts
|
// src/commands/config.ts
|
||||||
var MODEL_LIST = {
|
var MODEL_LIST = {
|
||||||
openai: [
|
openai: [
|
||||||
|
"gpt-4o-mini",
|
||||||
"gpt-3.5-turbo",
|
"gpt-3.5-turbo",
|
||||||
"gpt-3.5-turbo-instruct",
|
"gpt-3.5-turbo-instruct",
|
||||||
"gpt-3.5-turbo-0613",
|
"gpt-3.5-turbo-0613",
|
||||||
@@ -49494,7 +49495,6 @@ var MODEL_LIST = {
|
|||||||
"gpt-4-32k-0613",
|
"gpt-4-32k-0613",
|
||||||
"gpt-4o",
|
"gpt-4o",
|
||||||
"gpt-4o-2024-05-13",
|
"gpt-4o-2024-05-13",
|
||||||
"gpt-4o-mini",
|
|
||||||
"gpt-4o-mini-2024-07-18"
|
"gpt-4o-mini-2024-07-18"
|
||||||
],
|
],
|
||||||
anthropic: [
|
anthropic: [
|
||||||
@@ -49538,7 +49538,7 @@ var configValidators = {
|
|||||||
validateConfig(
|
validateConfig(
|
||||||
"OpenAI API_KEY",
|
"OpenAI API_KEY",
|
||||||
value || config11.OCO_ANTHROPIC_API_KEY || config11.OCO_AI_PROVIDER.startsWith("ollama") || config11.OCO_AZURE_API_KEY || config11.OCO_AI_PROVIDER == "test" || config11.OCO_AI_PROVIDER == "flowise",
|
value || config11.OCO_ANTHROPIC_API_KEY || config11.OCO_AI_PROVIDER.startsWith("ollama") || config11.OCO_AZURE_API_KEY || config11.OCO_AI_PROVIDER == "test" || config11.OCO_AI_PROVIDER == "flowise",
|
||||||
"You need to provide an OpenAI/Anthropic/Azure API key"
|
"You need to provide an OpenAI/Anthropic/Azure or other provider API key via `oco config set OCO_OPENAI_API_KEY=your_key`, for help refer to docs https://github.com/di-sukharev/opencommit"
|
||||||
);
|
);
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
"OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */,
|
||||||
@@ -49648,11 +49648,7 @@ var configValidators = {
|
|||||||
["OCO_MODEL" /* OCO_MODEL */](value, config11 = {}) {
|
["OCO_MODEL" /* OCO_MODEL */](value, config11 = {}) {
|
||||||
validateConfig(
|
validateConfig(
|
||||||
"OCO_MODEL" /* OCO_MODEL */,
|
"OCO_MODEL" /* OCO_MODEL */,
|
||||||
[
|
typeof value === "string",
|
||||||
...MODEL_LIST.openai,
|
|
||||||
...MODEL_LIST.anthropic,
|
|
||||||
...MODEL_LIST.gemini
|
|
||||||
].includes(value) || config11.OCO_AI_PROVIDER == "ollama" || config11.OCO_AI_PROVIDER == "azure" || config11.OCO_AI_PROVIDER == "test" || config11.OCO_AI_PROVIDER == "flowise",
|
|
||||||
`${value} is not supported yet, use:
|
`${value} is not supported yet, use:
|
||||||
|
|
||||||
${[
|
${[
|
||||||
|
|||||||
+4
-11
@@ -45,6 +45,7 @@ export enum CONFIG_MODES {
|
|||||||
|
|
||||||
export const MODEL_LIST = {
|
export const MODEL_LIST = {
|
||||||
openai: [
|
openai: [
|
||||||
|
'gpt-4o-mini',
|
||||||
'gpt-3.5-turbo',
|
'gpt-3.5-turbo',
|
||||||
'gpt-3.5-turbo-instruct',
|
'gpt-3.5-turbo-instruct',
|
||||||
'gpt-3.5-turbo-0613',
|
'gpt-3.5-turbo-0613',
|
||||||
@@ -69,7 +70,6 @@ export const MODEL_LIST = {
|
|||||||
'gpt-4-32k-0613',
|
'gpt-4-32k-0613',
|
||||||
'gpt-4o',
|
'gpt-4o',
|
||||||
'gpt-4o-2024-05-13',
|
'gpt-4o-2024-05-13',
|
||||||
'gpt-4o-mini',
|
|
||||||
'gpt-4o-mini-2024-07-18'
|
'gpt-4o-mini-2024-07-18'
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ export const configValidators = {
|
|||||||
config.OCO_AZURE_API_KEY ||
|
config.OCO_AZURE_API_KEY ||
|
||||||
config.OCO_AI_PROVIDER == 'test' ||
|
config.OCO_AI_PROVIDER == 'test' ||
|
||||||
config.OCO_AI_PROVIDER == 'flowise',
|
config.OCO_AI_PROVIDER == 'flowise',
|
||||||
'You need to provide an OpenAI/Anthropic/Azure API key'
|
'You need to provide an OpenAI/Anthropic/Azure or other provider API key via `oco config set OCO_OPENAI_API_KEY=your_key`, for help refer to docs https://github.com/di-sukharev/opencommit'
|
||||||
);
|
);
|
||||||
validateConfig(
|
validateConfig(
|
||||||
CONFIG_KEYS.OCO_OPENAI_API_KEY,
|
CONFIG_KEYS.OCO_OPENAI_API_KEY,
|
||||||
@@ -276,15 +276,7 @@ export const configValidators = {
|
|||||||
[CONFIG_KEYS.OCO_MODEL](value: any, config: any = {}) {
|
[CONFIG_KEYS.OCO_MODEL](value: any, config: any = {}) {
|
||||||
validateConfig(
|
validateConfig(
|
||||||
CONFIG_KEYS.OCO_MODEL,
|
CONFIG_KEYS.OCO_MODEL,
|
||||||
[
|
typeof value === 'string',
|
||||||
...MODEL_LIST.openai,
|
|
||||||
...MODEL_LIST.anthropic,
|
|
||||||
...MODEL_LIST.gemini
|
|
||||||
].includes(value) ||
|
|
||||||
config.OCO_AI_PROVIDER == 'ollama' ||
|
|
||||||
config.OCO_AI_PROVIDER == 'azure' ||
|
|
||||||
config.OCO_AI_PROVIDER == 'test' ||
|
|
||||||
config.OCO_AI_PROVIDER == 'flowise',
|
|
||||||
`${value} is not supported yet, use:\n\n ${[
|
`${value} is not supported yet, use:\n\n ${[
|
||||||
...MODEL_LIST.openai,
|
...MODEL_LIST.openai,
|
||||||
...MODEL_LIST.anthropic,
|
...MODEL_LIST.anthropic,
|
||||||
@@ -459,6 +451,7 @@ export const getConfig = ({
|
|||||||
outro(
|
outro(
|
||||||
`Manually fix the '.env' file or global '~/.opencommit' config file.`
|
`Manually fix the '.env' file or global '~/.opencommit' config file.`
|
||||||
);
|
);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user