Skip to content

Commit 03e4bda

Browse files
authored
fix: Alibaba Cloud Bailian Stream Response (#4266)
1 parent 267bdae commit 03e4bda

File tree

1 file changed

+3
-3
lines changed
  • apps/models_provider/impl/aliyun_bai_lian_model_provider/model

1 file changed

+3
-3
lines changed

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
2+
import datetime
33
from typing import Dict, Optional, Any, Iterator
44

55
import requests
@@ -13,6 +13,7 @@
1313
from models_provider.impl.base_chat_open_ai import BaseChatOpenAI
1414
import json
1515

16+
1617
class 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
# 忽略无法解析的行

0 commit comments

Comments
 (0)