Skip to content

Commit

Permalink
fix: do not use logUpdate if noConsoleClear
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jun 12, 2024
1 parent d0d51f8 commit bb5c825
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lib/run-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,27 @@ export async function runScript(filename: string, options: IRunScriptOptions) {
if (stream) {
runtime.on('llm-stream', async function(llmResult, content: string, count: number) {
const runtime = this.target as AIScriptEx
const s = llmResult.content
llmLastContent += s
let s = llmResult.content

if (quit) {
runtime.abort('quit')
process.emit('SIGINT')
}
if (count !== retryCount) {
retryCount = count
llmLastContent += colors.blue(`<续:${count}>`)
s += colors.blue(`<续:${count}>`)
}
llmLastContent += s
// if (llmLastContent.length > 100) {
// llmLastContent = llmLastContent.slice(llmLastContent.length-100)
// }
if (!isSilence && llmLastContent) {logUpdate(llmLastContent)}
if (!isSilence && llmLastContent) {
if (!options.noConsoleClear) {
logUpdate(llmLastContent)
} else {
process.stdout.write(s)
}
}
})
}

Expand Down

0 comments on commit bb5c825

Please sign in to comment.