import 'package:dio/dio.dart';

void main() async { String url = "https://chatgpt-chatgpt-lswirmtbkx.us-east-1.fcapp.run/test";

Map<String, dynamic> data = { 'content': '给我写一个200字的小说,随机题材' };

Response response = await Dio().post(url, data: data);

//流式输出 List chunks = response.data; for (var chunk in chunks) { if (chunk != null) { print(String.fromCharCode(chunk)); } } }

用dart语言改写下面的代码并且要求使用dio import requestsurl = httpschatgpt-chatgpt-lswirmtbkxus-east-1fcappruntestdata= content给我写一个200字的小说随机题材response = requestsrequestPOST url stream=True data=data#流式输出for chunk

原文地址: https://www.cveoy.top/t/topic/ffUg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录