From 3fdbca89f35849f42e58c94daecc899199b0087e Mon Sep 17 00:00:00 2001 From: wancat Date: Thu, 31 Aug 2023 16:45:03 +0800 Subject: [PATCH] feat: add waiting time before the responses --- packages/container/print.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/container/print.js b/packages/container/print.js index 76a77a5..e2b6f95 100644 --- a/packages/container/print.js +++ b/packages/container/print.js @@ -36,6 +36,12 @@ function waitForEnter() { }) } +function waitTime(time) { + return new Promise((resolve) => { + setTimeout(resolve, time) + }) +} + function printLine(content, delay, color) { const printContent = `${colorize(content, color)}${RETURN_SYMBOL}` return new Promise((resolve) => { @@ -59,6 +65,9 @@ function printLine(content, delay, color) { } async function printResponses(responses, delay = 100) { + await waitTime(1000) + console.log() + console.log(colorize('-------------', 'white')) for (const response of responses) { const { type, content, speaker, color } = response if (type === 'narrative') {