关于1.06.2412050 Stable SSE/Checked请求严重BUG?
const req = wx.request({
url: BASE_URL + '/api/chat/createAndChat',
method: 'POST',
responseType: 'text',
enableChunked: true,
timeout: 1800000,
header: {
'Authorization': uni.getStorageSync('token'),
'Accept': 'text/event-stream',
'Content-Type': 'application/json',
},
data: {
conversation_id: this.conversation_id,
bot_id: this.botId,
content: this.inputMessage,
},
complete: (res) => {
console.log(res);
}
})
req.onChunkReceived((response) => {
const arrayBuffer = response.data;
console.log(response.data);
const uint8Array = new Uint8Array(arrayBuffer);
// let text = uni.arrayBufferToBase64(uint8Array)
let item = this.Utf8ArrayToStr(uint8Array);
let json = item.split('\r\n');
json.forEach((item) => {
if (item) {
let obj = JSON.parse(item);
//后面代码省略 该代码段在最新的开发者工具中无法调试,一直运行不出来。但我把版本回退到1.06.2407120 就可以了。找问题找了好几个晚上!!!!