Skip to content

Commit

Permalink
Update translator.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cerlancism committed Jan 19, 2024
1 parent 97abd86 commit 8f89fa6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/translator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class Translator
if (writeQueue.length === 0 && !hasNewline)
{
// process.stdout.write(data)
this.services?.onStreamChunk(data)
this.services.onStreamChunk?.(data)
}
else if (hasNewline)
{
Expand All @@ -148,14 +148,14 @@ export class Translator
{
writeQueue += data
// process.stdout.write(writeQueue)
this.services?.onStreamChunk(writeQueue)
this.services.onStreamChunk?.(writeQueue)
writeQueue = ''
}
}, () =>
{
endTime = Date.now()
// process.stdout.write("\n")
this.services?.onStreamEnd()
this.services.onStreamEnd?.()
})
const prompt_tokens = numTokensFromMessages(messages)
const completion_tokens = numTokensFromMessages([{ content: streamOutput }])
Expand Down

0 comments on commit 8f89fa6

Please sign in to comment.