feat(api.ts): add support for OPENAI_BASE_PATH configuration variable (#80)

feat(config.ts): add OPENAI_BASE_PATH configuration key and validator function

Co-authored-by: yiminglu <yiming.lu@mioying.com>
This commit is contained in:
kimlym
2023-04-05 12:26:02 +08:00
committed by GitHub
parent 3364289034
commit 5a9b460033
2 changed files with 18 additions and 1 deletions
+10
View File
@@ -10,6 +10,7 @@ import { getI18nLocal } from '../i18n';
export enum CONFIG_KEYS {
OPENAI_API_KEY = 'OPENAI_API_KEY',
OPENAI_BASE_PATH = 'OPENAI_BASE_PATH',
description = 'description',
emoji = 'emoji',
language = 'language'
@@ -78,6 +79,15 @@ export const configValidators = {
`${value} is not supported yet`
);
return getI18nLocal(value);
},
[CONFIG_KEYS.OPENAI_BASE_PATH](value: any) {
validateConfig(
CONFIG_KEYS.OPENAI_BASE_PATH,
typeof value == 'string',
`${value} is not supported yet`
);
return value;
}
};