mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
feat: add waiting time before the responses
This commit is contained in:
1 parent
5ec9ae52ce
commit
3fdbca89f3
1 file changed
+9
@@ -36,6 +36,12 @@ function waitForEnter() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function waitTime(time) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(resolve, time)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function printLine(content, delay, color) {
|
function printLine(content, delay, color) {
|
||||||
const printContent = `${colorize(content, color)}${RETURN_SYMBOL}`
|
const printContent = `${colorize(content, color)}${RETURN_SYMBOL}`
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@@ -59,6 +65,9 @@ function printLine(content, delay, color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function printResponses(responses, delay = 100) {
|
async function printResponses(responses, delay = 100) {
|
||||||
|
await waitTime(1000)
|
||||||
|
console.log()
|
||||||
|
console.log(colorize('-------------', 'white'))
|
||||||
for (const response of responses) {
|
for (const response of responses) {
|
||||||
const { type, content, speaker, color } = response
|
const { type, content, speaker, color } = response
|
||||||
if (type === 'narrative') {
|
if (type === 'narrative') {
|
||||||
|
|||||||
Reference in new issue
Block a user