File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
apps/models_provider/impl/aliyun_bai_lian_model_provider/model Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11# coding=utf-8
2-
2+ import datetime
33from typing import Dict , Optional , Any , Iterator
44
55import requests
1313from models_provider .impl .base_chat_open_ai import BaseChatOpenAI
1414import json
1515
16+
1617class QwenVLChatModel (MaxKBBaseModel , BaseChatOpenAI ):
1718
1819 @staticmethod
@@ -116,7 +117,7 @@ def stream(
116117 ** self .extra_body ,
117118 "stream" : True ,
118119 }
119- response = requests .post (url , headers = headers , json = data )
120+ response = requests .post (url , headers = headers , json = data , stream = True )
120121 if response .status_code != 200 :
121122 raise Exception (f"Failed to get response: { response .text } " )
122123 for line in response .iter_lines ():
@@ -138,7 +139,6 @@ def stream(
138139 delta = chunk_data ['choices' ][0 ].get ('delta' , {})
139140 content = delta .get ('content' , '' )
140141 if content :
141- print (content )
142142 yield AIMessage (content = content )
143143 except json .JSONDecodeError :
144144 # 忽略无法解析的行
You can’t perform that action at this time.
0 commit comments