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

@@ -185,7 +185,17 @@ const genTencent = ({ text, from, to }) => {
return [URL_TENCENT_TRANSMART, init];
};
const genOpenAI = ({ text, from, to, url, key, prompt, model }) => {
const genOpenAI = ({
text,
from,
to,
url,
key,
prompt,
model,
temperature,
maxTokens,
}) => {
prompt = prompt
.replaceAll(INPUT_PLACE_FROM, from)
.replaceAll(INPUT_PLACE_TO, to);
@@ -202,8 +212,8 @@ const genOpenAI = ({ text, from, to, url, key, prompt, model }) => {
content: text,
},
],
temperature: 0,
max_tokens: 256,
temperature,
max_tokens: maxTokens,
};
const init = {