File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -619,9 +619,18 @@ where
619619 while let Some ( ev) = event_source. next ( ) . await {
620620 match ev {
621621 Err ( e) => {
622- if let Err ( _e) = tx. send ( Err ( map_stream_error ( e) . await ) ) {
623- // rx dropped
624- break ;
622+ // Handle StreamEnded gracefully - it's a normal end of stream, not an error
623+ // https://github.com/64bit/async-openai/issues/456
624+ match & e {
625+ EventSourceError :: StreamEnded => {
626+ break ;
627+ }
628+ _ => {
629+ if let Err ( _e) = tx. send ( Err ( map_stream_error ( e) . await ) ) {
630+ // rx dropped
631+ break ;
632+ }
633+ }
625634 }
626635 }
627636 Ok ( event) => match event {
@@ -664,9 +673,18 @@ where
664673 while let Some ( ev) = event_source. next ( ) . await {
665674 match ev {
666675 Err ( e) => {
667- if let Err ( _e) = tx. send ( Err ( map_stream_error ( e) . await ) ) {
668- // rx dropped
669- break ;
676+ // Handle StreamEnded gracefully - it's a normal end of stream, not an error
677+ // https://github.com/64bit/async-openai/issues/456
678+ match & e {
679+ EventSourceError :: StreamEnded => {
680+ break ;
681+ }
682+ _ => {
683+ if let Err ( _e) = tx. send ( Err ( map_stream_error ( e) . await ) ) {
684+ // rx dropped
685+ break ;
686+ }
687+ }
670688 }
671689 }
672690 Ok ( event) => match event {
You can’t perform that action at this time.
0 commit comments