3939PIPELINE_MODULES = {}
4040PIPELINE_NAMES = {}
4141
42- #Add GLOBAL_LOG_LEVEL for Pipeplines
43- log_level = os .getenv (' GLOBAL_LOG_LEVEL' , ' INFO' ).upper ()
42+ # Add GLOBAL_LOG_LEVEL for Pipeplines
43+ log_level = os .getenv (" GLOBAL_LOG_LEVEL" , " INFO" ).upper ()
4444logging .basicConfig (level = LOG_LEVELS [log_level ])
4545
4646
@@ -694,7 +694,6 @@ def stream_content():
694694 messages = messages ,
695695 body = form_data .model_dump (),
696696 )
697-
698697 logging .info (f"stream:true:{ res } " )
699698
700699 if isinstance (res , str ):
@@ -708,18 +707,22 @@ def stream_content():
708707 line = line .model_dump_json ()
709708 line = f"data: { line } "
710709
710+ elif isinstance (line , dict ):
711+ line = json .dumps (line )
712+ line = f"data: { line } "
713+
711714 try :
712715 line = line .decode ("utf-8" )
713- except :
714- pass
716+ logging .info (f"stream_content:Generator:{ line } " )
715717
716- logging .info (f"stream_content:Generator:{ line } " )
718+ if line .startswith ("data:" ):
719+ yield f"{ line } \n \n "
720+ else :
721+ line = stream_message_template (form_data .model , line )
722+ yield f"data: { json .dumps (line )} \n \n "
717723
718- if line .startswith ("data:" ):
719- yield f"{ line } \n \n "
720- else :
721- line = stream_message_template (form_data .model , line )
722- yield f"data: { json .dumps (line )} \n \n "
724+ except :
725+ pass
723726
724727 if isinstance (res , str ) or isinstance (res , Generator ):
725728 finish_message = {
0 commit comments