uni-app 重大bug uni.request流式请求在app端没有实现
uni-app 重大bug uni.request流式请求在app端没有实现
| 类别 | 信息 |
|---|---|
| 产品分类 | uniapp/App |
| PC开发环境 | Windows |
| 版本号 | win10 |
| HBuilderX | Alpha |
| 版本号 | 4.81 |
| 手机系统 | 全部 |
| 手机厂商 | 华为 |
| 页面类型 | vue |
| vue版本 | vue3 |
| 打包方式 | 云端 |
| 项目创建方式 | HBuilderX |
测试过的手机
- 安卓模拟器
- ios真机
示例代码
this.currentRequestTask = uni.request({
url: 'https://api.deepseek.com/chat/completions',
method: 'POST',
header: {
'Content-Type': 'application/json',
'Authorization': 'Bearer xxxxxxxxxxxxxxx密钥隐藏',
},
data: {
model: "deepseek-chat",
messages: [
{ role: 'user', content: '你好' }
],
stream: true
},
enableChunked: true,
success: (res) => {
console.log('请求成功:', this.currentRequestTask, res);
this.isLoading = false;
},
fail: err => {
this.requestError(aiMessageIndex, err)
},
complete: () => {
this.isLoading = false;
}
});
let accumulatedData = '';
console.log(999, this.currentRequestTask, this.currentRequestTask.onChunkReceived)
操作步骤
- 执行代码
- app端只返回完整数据,其他端可以返回流式数据
预期结果
- 支持流式响应
实际结果
- 不支持流式响应
bug描述
uni.request在app端上无法返回流式监听方法,但在h5、小程序正常。
在安卓模拟器,ios真机都无法使用流式方法,打印requestTask.onChunkReceived返回undefined, 在4.75正式版上也是如此。 我看你们的更新日志,早在4.71版就发布了对app端的支持,但现在依然没有解决,市面上的插件都得另外用比如axios来解决。
更多关于uni-app 重大bug uni.request流式请求在app端没有实现的实战教程也可以访问 https://www.itying.com/category-93-b0.html

