feat: add waiting time before the responses

This commit is contained in:
wancat committed 2023-08-31 16:45:03 +08:00
1 parent 5ec9ae52ce
commit 3fdbca89f3
1 file changed
+9
+9
View File
@@ -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') {