Skip to content

Commit 232143a

Browse files
committed
b
1 parent 76a60b9 commit 232143a

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

backend/files/system/openai/magic.startup/magic.ai.chat.hl

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ select prompt, max(completion) as completion
264264
* amount of tokens the model can handle.
265265
*/
266266
.cont:bool:true
267+
.finished_sent:bool:false
267268
while:x:@.cont
268269

269270
lambda2hyper:x:@.session/*
@@ -529,9 +530,15 @@ select prompt, max(completion) as completion
529530
error:bool:true
530531
status:int:500
531532
message:Too many function invocations. Configure your type to handle more invocations or change your prompt.
532-
sockets.signal:x:@.session
533-
args
534-
finished:bool:true
533+
if
534+
neq:x:@.finished_sent
535+
.:bool:true
536+
.lambda
537+
sockets.signal:x:@.session
538+
args
539+
finished:bool:true
540+
set-value:x:@.finished_sent
541+
.:bool:true
535542
else
536543

537544
// Executing Hyperlambda function file.
@@ -626,11 +633,17 @@ select prompt, max(completion) as completion
626633
else
627634

628635
// OpenAI is done.
629-
sockets.signal:x:@.session
630-
args
631-
finished:bool:true
632-
set-value:x:@.iterations
633-
.:int:0
636+
if
637+
neq:x:@.finished_sent
638+
.:bool:true
639+
.lambda
640+
sockets.signal:x:@.session
641+
args
642+
finished:bool:true
643+
set-value:x:@.finished_sent
644+
.:bool:true
645+
set-value:x:@.iterations
646+
.:int:0
634647

635648
else
636649

0 commit comments

Comments
 (0)