Merge remote-tracking branch 'origin/dev'

This commit is contained in:
di-sukharev
2023-05-19 13:42:43 +08:00
+11 -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;
},