You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[√] Flutter (Channel master, 3.10.0-10.0.pre.39, on Microsoft Windows [版本 10.0.18363.592], locale zh-CN)
• Flutter version 3.10.0-10.0.pre.39 on channel master at C:\tools\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d186792c00 (2 hours ago), 2023-04-20 20:50:59 -0700
• Engine revision 122c3b3820
• Dart version 3.1.0 (build 3.1.0-26.0.dev)
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at C:\Users\John\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Users\John\AppData\Local\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.5.33530.505
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[√] IntelliJ IDEA Ultimate Edition (version 2023.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2023.1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.77.3)
• VS Code at C:\Users\John\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.62.0
[!] Proxy Configuration
• HTTP_PROXY is set! NO_PROXY is not set
[√] Connected device (4 available)
• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.18363.592]
• Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.50
• Edge (web) • edge • web-javascript • Microsoft Edge 112.0.1722.39
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
Use the "ResponseType. stream" method to call the OpenAI interface, hoping to obtain real-time responses from the OpenAI interface.
Using dio: ^ 5.1.1, it works normally in both Android and Windows environments, “response.data?.stream.listen((List data)” -- Multiple data can be received per second.
But not work in a web environment(Chrome 112.0.5615.50). It should not be a browser caching issue, as using the same interface, JS can receive stream data in real-time.
Actual Result
response.data?.stream.listen((List data)
only one data
It takes about a few tens of seconds to receive stream data, and only a large data packet can be get when completion, and the process cannot be get in real-time.
The text was updated successfully, but these errors were encountered:
Package
dio
Version
v5.1.1
Output of
flutter doctor -v
Dart Version
Dart SDK version: 3.1.0-26.0.dev (dev) (Thu Apr 20 12:25:58 2023 -0700) on "windows_x64"
Steps to Reproduce
Future askAi(String text) async {
Response response = await dio.post(
'https://api.openai.com/v1/completions',
data: {
"model": "text-davinci-003",
"prompt": text,
"temperature": 0.6,
"max_tokens": 1024,
"stream": true,
},
options: Options(headers: {
'Authorization': 'Bearer ${Env.apiKey}',
'Content-Type': 'application/json'
}, responseType: ResponseType.stream),
);
response.data?.stream.listen((List data) {
String str = String.fromCharCodes(data);
print(str);
});
}
Expected Result
Use the "ResponseType. stream" method to call the OpenAI interface, hoping to obtain real-time responses from the OpenAI interface.
Using dio: ^ 5.1.1, it works normally in both Android and Windows environments, “response.data?.stream.listen((List data)” -- Multiple data can be received per second.
But not work in a web environment(Chrome 112.0.5615.50). It should not be a browser caching issue, as using the same interface, JS can receive stream data in real-time.
Actual Result
response.data?.stream.listen((List data)
only one data
It takes about a few tens of seconds to receive stream data, and only a large data packet can be get when completion, and the process cannot be get in real-time.
The text was updated successfully, but these errors were encountered: