feat(bot): 增加图片处理功能并优化日志系统

- 新增 textToImage 和 imageToText 功能,实现文本与图片的相互转换
- 优化日志系统,使用 log4j2 实现动态日志记录- 重构 BaiduGPTManager 类,增加多线程支持和错误处理
- 更新 MessageHandleBuild 类,支持 message_id 参数
- 修复部分功能的逻辑错误,提高系统稳定性
This commit is contained in:
2025-02-04 17:13:48 +08:00
parent 237c9273ca
commit 1041dfa909
15 changed files with 679 additions and 109 deletions

View File

@@ -7,10 +7,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.yutou.napcat.QQDatabase;
import com.yutou.napcat.enums.MessageEnum;
import com.yutou.napcat.event.GroupMessageEvent;
import com.yutou.napcat.handle.At;
import com.yutou.napcat.handle.BaseHandle;
import com.yutou.napcat.handle.Image;
import com.yutou.napcat.handle.Text;
import com.yutou.napcat.handle.*;
import com.yutou.napcat.http.NapCatApi;
import com.yutou.napcat.model.MessageBean;
import com.yutou.okhttp.HttpBody;
@@ -70,7 +67,9 @@ public class QQSetu extends Model {
RedisTools.set(db_print, redisKey, json.toJSONString());
JSONObject info = setu.getJSONObject("info");
JSONObject score = setu.getJSONObject("score");
HttpBody<MessageBean> body = NapCatApi.getMessageApi().getMessage(info.getLong("id")).execute().body();
HttpBody<MessageBean> body = NapCatApi.getMessageApi().getMessage(
MessageHandleBuild.create().setMessageId(String.valueOf(info.getLong("id"))).build()
).execute().body();
List<BaseHandle<?>> sendList = new ArrayList<>();
if (body == null) {
sendList.add(new Text("[图片获取失败]"));