mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
perf: abort
This commit is contained in:
@@ -89,6 +89,14 @@ export async function chatCompletion({
|
||||
// FastGpt temperature range: 1~10
|
||||
temperature = +(modelConstantsData.maxTemperature * (temperature / 10)).toFixed(2);
|
||||
|
||||
const limitText = (() => {
|
||||
if (limitPrompt) return limitPrompt;
|
||||
if (quotePrompt && !limitPrompt) {
|
||||
return '根据知识库内容回答问题,仅回复知识库提供的内容。';
|
||||
}
|
||||
return '';
|
||||
})();
|
||||
|
||||
const messages: ChatItemType[] = [
|
||||
...(quotePrompt
|
||||
? [
|
||||
@@ -107,11 +115,11 @@ export async function chatCompletion({
|
||||
]
|
||||
: []),
|
||||
...history,
|
||||
...(limitPrompt
|
||||
...(limitText
|
||||
? [
|
||||
{
|
||||
obj: ChatRoleEnum.System,
|
||||
value: limitPrompt
|
||||
value: limitText
|
||||
}
|
||||
]
|
||||
: []),
|
||||
|
@@ -145,7 +145,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`finish time: ${(Date.now() - startTime) / 100}s`);
|
||||
console.log(`finish time: ${(Date.now() - startTime) / 1000}s`);
|
||||
|
||||
if (stream) {
|
||||
sseResponse({
|
||||
|
Reference in New Issue
Block a user