修改漏洞问题-pc端已测试完成

This commit is contained in:
sh
2026-04-11 13:05:08 +08:00
parent 8b2ae55baf
commit 62e86f24c9
25 changed files with 439 additions and 126 deletions

View File

@@ -98,6 +98,10 @@ public class ChatClient {
// 逐行读取 SSE 格式的响应
try (var bufferedSource = body.source()) {
//判断 bufferedSource
if (bufferedSource != null) {
return;
}
while (!bufferedSource.exhausted()) {
String chunk = bufferedSource.readUtf8Line();
if (chunk != null && !chunk.trim().isEmpty()) {
@@ -248,8 +252,12 @@ public class ChatClient {
// 发送同步请求
try (Response response = client.newCall(request).execute()) {
if (response == null) {
return "请求失败,响应为空";
}
if (!response.isSuccessful()) {
String errorBody = response.body() != null ? response.body().string() : "无错误信息";
ResponseBody body = response.body();
String errorBody = (body != null) ? body.string() : "无错误信息";
String errorMsg = String.format("API 响应错误: 状态码=%d, 错误信息=%s",
response.code(), errorBody);
throw new IOException(errorMsg);