!1346 排除多余依赖,代码优化

Merge pull request !1346 from eli_chow/v5-dev
This commit is contained in:
eli_chow 2025-05-23 08:03:47 +00:00 committed by Gitee
commit ce232cdd4f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -18,7 +18,7 @@ package cn.hutool.ai.core;
import cn.hutool.ai.AIException;
import cn.hutool.http.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import cn.hutool.json.JSONUtil;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -133,7 +133,7 @@ public class BaseAIService {
connection.setConnectTimeout(180000);
// 发送请求体
try (OutputStream os = connection.getOutputStream()) {
String jsonInputString = new ObjectMapper().writeValueAsString(paramMap);
String jsonInputString = JSONUtil.toJsonStr(paramMap);
os.write(jsonInputString.getBytes());
os.flush();
}