feat: the temperature and maxTokens of the openai can be configured

This commit is contained in:
Gabe Yuan
2024-05-21 23:15:46 +08:00
parent 0198963584
commit 5d1d65c2d3
4 changed files with 55 additions and 4 deletions

View File

@@ -15,6 +15,16 @@ export const limitNumber = (num, min = 0, max = 100) => {
return number;
};
export const limitFloat = (num, min = 0, max = 100) => {
const number = parseFloat(num);
if (Number.isNaN(number) || number < min) {
return min;
} else if (number > max) {
return max;
}
return number;
};
/**
* 匹配是否为数组中的值
* @param {*} arr