feat: img compress;perf: color.prompt response

This commit is contained in:
archer
2023-05-03 21:42:23 +08:00
parent 17a42ac0cc
commit 91b02bbfd9
7 changed files with 87 additions and 19 deletions

View File

@@ -142,14 +142,16 @@ export const resStreamResponse = async ({
prompts
});
// push system prompt
!stream.destroyed &&
systemPrompt &&
stream.push(`${SYSTEM_PROMPT_PREFIX}${systemPrompt.replace(/\n/g, '<br/>')}`);
setTimeout(() => {
// push system prompt
!stream.destroyed &&
systemPrompt &&
stream.push(`${SYSTEM_PROMPT_PREFIX}${systemPrompt.replace(/\n/g, '<br/>')}`);
// close stream
!stream.destroyed && stream.push(null);
stream.destroy();
// close stream
!stream.destroyed && stream.push(null);
stream.destroy();
}, 100);
return { responseContent, totalTokens, finishMessages };
};