File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
code365scripts.openai/Public Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -534,13 +534,21 @@ function New-ChatGPTConversation {
534534
535535 if ($stream ) {
536536 Write-Verbose ($resources.verbose_chat_stream_mode )
537+
538+ # new stopwatch
539+ $stopwatch = [System.Diagnostics.Stopwatch ]::StartNew()
537540 $callapi = Invoke-StreamWebRequest - uri $params.Uri - body $params.Body - header $header
538541 # if the status of callapi is not ok, then write the error message to host and continue
539542 if ($callapi.status -ne " ok" ) {
540543 Write-Host " `r [$current ] $ ( $callapi.message ) " - NoNewline - ForegroundColor Red
541544 Write-Host " "
542545 continue
543546 }
547+
548+ # print the verbose message include the stopwatch time
549+ Write-Verbose (" FCFR - {0} ms " -f ($stopwatch.ElapsedMilliseconds ))
550+ $stopwatch.Stop ()
551+
544552
545553 # otherwise, get the read of the result
546554 $reader = $callapi.reader
@@ -633,7 +641,6 @@ function New-ChatGPTConversation {
633641 $chunk = ($line -replace " data: " , " " | ConvertFrom-Json ).choices.delta.content
634642 Write-Host $chunk - NoNewline - ForegroundColor Green
635643 $result += $chunk
636- Start-Sleep - Milliseconds 5
637644 }
638645
639646 Write-Host " "
@@ -642,6 +649,8 @@ function New-ChatGPTConversation {
642649 content = $result
643650 }
644651
652+
653+
645654 Write-Verbose ($resources.verbose_chat_message_combined -f ($messages | ConvertTo-Json - Depth 10 ))
646655
647656 }
You can’t perform that action at this time.
0 commit comments