mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 10:07:24 +00:00
perf: 文案优化
This commit is contained in:
@@ -60,9 +60,9 @@ export const chatProblem = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const versionIntro = `
|
export const versionIntro = `
|
||||||
## Fast GPT V2.3
|
## Fast GPT V2.4
|
||||||
* 数据集导出功能,可用于知识库分享。
|
|
||||||
* 优化文件拆分功能,可自定义提示词。
|
* 优化文件拆分功能,可自定义提示词。
|
||||||
|
* 优化文件拆分和索引生成的速度。
|
||||||
* 定制知识库:创建模型时可以选择【知识库】模型, 可以手动导入知识点或者直接导入一个文件自动学习。
|
* 定制知识库:创建模型时可以选择【知识库】模型, 可以手动导入知识点或者直接导入一个文件自动学习。
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@@ -119,6 +119,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
try {
|
try {
|
||||||
const json = JSON.parse(data);
|
const json = JSON.parse(data);
|
||||||
const content: string = json?.choices?.[0].delta.content || '';
|
const content: string = json?.choices?.[0].delta.content || '';
|
||||||
|
// 空内容不要。首行换行符不要
|
||||||
if (!content || (responseContent === '' && content === '\n')) return;
|
if (!content || (responseContent === '' && content === '\n')) return;
|
||||||
|
|
||||||
responseContent += content;
|
responseContent += content;
|
||||||
|
@@ -110,7 +110,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
|
|
||||||
prompts.unshift({
|
prompts.unshift({
|
||||||
obj: 'SYSTEM',
|
obj: 'SYSTEM',
|
||||||
value: `${model.systemPrompt} 知识库内容是最新的,知识库内容为: "${systemPrompt}"`
|
value: `${model.systemPrompt} 知识库内容是最新的,知识库内容为: "${systemPrompt}"`
|
||||||
});
|
});
|
||||||
|
|
||||||
// 控制在 tokens 数量,防止超出
|
// 控制在 tokens 数量,防止超出
|
||||||
|
@@ -148,8 +148,8 @@ const ModelDataCard = ({ model }: { model: ModelSchema }) => {
|
|||||||
>
|
>
|
||||||
手动输入
|
手动输入
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={onOpenSelectFileModal}>文件导入</MenuItem>
|
<MenuItem onClick={onOpenSelectFileModal}>文件QA拆分</MenuItem>
|
||||||
<MenuItem onClick={onOpenSelectUrlModal}>网站地址导入</MenuItem>
|
<MenuItem onClick={onOpenSelectUrlModal}>网站内容QA拆分</MenuItem>
|
||||||
<MenuItem onClick={onOpenSelectJsonModal}>JSON导入</MenuItem>
|
<MenuItem onClick={onOpenSelectJsonModal}>JSON导入</MenuItem>
|
||||||
</MenuList>
|
</MenuList>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@@ -37,7 +37,7 @@ const ModelDetail = ({ modelId }: { modelId: string }) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await getModelById(modelId);
|
const res = await getModelById(modelId);
|
||||||
console.log(res);
|
// console.log(res);
|
||||||
res.security.expiredTime /= 60 * 60 * 1000;
|
res.security.expiredTime /= 60 * 60 * 1000;
|
||||||
setModel(res);
|
setModel(res);
|
||||||
formHooks.reset(res);
|
formHooks.reset(res);
|
||||||
|
@@ -105,7 +105,8 @@ export async function generateAbstract(next = false): Promise<any> {
|
|||||||
isPay: !userApiKey && splitContents.length > 0,
|
isPay: !userApiKey && splitContents.length > 0,
|
||||||
userId: dataItem.userId,
|
userId: dataItem.userId,
|
||||||
type: 'abstract',
|
type: 'abstract',
|
||||||
text: systemPrompt.content + dataItem.text + rawContent
|
text: systemPrompt.content + dataItem.text + rawContent,
|
||||||
|
tokenLen: 0
|
||||||
});
|
});
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log('error: 生成摘要错误', dataItem?._id);
|
console.log('error: 生成摘要错误', dataItem?._id);
|
||||||
|
@@ -79,8 +79,10 @@ export async function generateQA(next = false): Promise<any> {
|
|||||||
.createChatCompletion(
|
.createChatCompletion(
|
||||||
{
|
{
|
||||||
model: ChatModelNameEnum.GPT35,
|
model: ChatModelNameEnum.GPT35,
|
||||||
temperature: 0.8,
|
temperature: 0.7,
|
||||||
n: 1,
|
n: 1,
|
||||||
|
frequency_penalty: 1, // 越大,重复内容越少
|
||||||
|
presence_penalty: -1, // 越大,越容易出现新内容
|
||||||
messages: [
|
messages: [
|
||||||
systemPrompt,
|
systemPrompt,
|
||||||
{
|
{
|
||||||
|
@@ -93,5 +93,5 @@ export const systemPromptFilter = (prompts: string[], maxTokens: number) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return splitText;
|
return splitText.slice(0, splitText.length - 1);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user