File tree 1 file changed +11
-4
lines changed
code365scripts.openai/Public
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,8 @@ function New-ChatGPTConversation {
289
289
}
290
290
)
291
291
292
+ $messages += $systemPrompt
293
+
292
294
Write-Verbose " $ ( $systemPrompt | ConvertTo-Json - Depth 10 ) "
293
295
294
296
while ($true ) {
@@ -510,8 +512,14 @@ function New-ChatGPTConversation {
510
512
while ($response.choices -and $response.choices [0 ].message.tool_calls) {
511
513
# add the assistant message
512
514
$this_message = $response.choices [0 ].message
513
- $body.messages += $this_message
515
+ # $body.messages += $this_message
514
516
$tool_calls = $this_message.tool_calls
517
+
518
+ $messages += [pscustomobject ]@ {
519
+ role = " assistant"
520
+ content = " "
521
+ tool_calls = @ ($tool_calls )
522
+ }
515
523
516
524
foreach ($tool in $tool_calls ) {
517
525
Write-Host (" `r $ ( $resources.function_call ) : $ ( $tool.function.name ) " + (" " * 50 )) - NoNewline
@@ -532,6 +540,8 @@ function New-ChatGPTConversation {
532
540
533
541
$body.messages = $messages
534
542
$params.Body = ($body | ConvertTo-Json - Depth 10 )
543
+ Write-Verbose $params.Body
544
+
535
545
$response = Invoke-UniWebRequest $params
536
546
}
537
547
@@ -549,9 +559,6 @@ function New-ChatGPTConversation {
549
559
Write-Error ($_.Exception.Message )
550
560
}
551
561
}
552
-
553
-
554
-
555
562
}
556
563
557
564
}
You can’t perform that action at this time.
0 commit comments