|
|
发表于
2025-10-5 23:22:06
来自手机
|
显示全部楼层
来自 河南
修改AiTranslationEngine.java文件
163行try部分代码
替换为Response response = null;
try {
response = client.newCall(request).execute();
if (!response.isSuccessful()) {
throw new IOException("API请求失败: " + response.code() + " - " + response.message());
}
String responseBody = response.body().string();
JSONObject jsonResponse = new JSONObject(responseBody);
getContext().showToast("分析完成");
return parseAiResponse(jsonResponse);
} catch (Exception e) {
throw new IOException("分析代码时出错: " + e.getMessage(), e);
}finally {
if (response != null) {
response.close();
}
} |
|