perf: abort

This commit is contained in:
archer
2023-07-18 15:20:58 +08:00
parent 8a25aeabc4
commit 2330186a09
8 changed files with 50 additions and 28 deletions

View File

@@ -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
}
]
: []),

View File

@@ -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({