perf: 文案优化

This commit is contained in:
archer
2023-04-06 09:07:07 +08:00
parent 144bed5a77
commit d460305871
8 changed files with 13 additions and 9 deletions

View File

@@ -105,7 +105,8 @@ export async function generateAbstract(next = false): Promise<any> {
isPay: !userApiKey && splitContents.length > 0,
userId: dataItem.userId,
type: 'abstract',
text: systemPrompt.content + dataItem.text + rawContent
text: systemPrompt.content + dataItem.text + rawContent,
tokenLen: 0
});
} catch (error: any) {
console.log('error: 生成摘要错误', dataItem?._id);

View File

@@ -79,8 +79,10 @@ export async function generateQA(next = false): Promise<any> {
.createChatCompletion(
{
model: ChatModelNameEnum.GPT35,
temperature: 0.8,
temperature: 0.7,
n: 1,
frequency_penalty: 1, // 越大,重复内容越少
presence_penalty: -1, // 越大,越容易出现新内容
messages: [
systemPrompt,
{

View File

@@ -93,5 +93,5 @@ export const systemPromptFilter = (prompts: string[], maxTokens: number) => {
}
}
return splitText;
return splitText.slice(0, splitText.length - 1);
};