This commit is contained in:
zhaoyuhang
2023-06-29 23:52:48 +08:00
parent 3218b37ffc
commit fb90e98a4e
11 changed files with 542 additions and 5 deletions

View File

@@ -38,6 +38,7 @@ import com.abin.mallchat.custom.chat.service.strategy.mark.MsgMarkFactory;
import com.abin.mallchat.custom.chat.service.strategy.msg.AbstractMsgHandler;
import com.abin.mallchat.custom.chat.service.strategy.msg.MsgHandlerFactory;
import com.abin.mallchat.custom.chat.service.strategy.msg.RecallMsgHandler;
import com.abin.mallchat.custom.openai.event.OpenAIEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -95,6 +96,7 @@ public class ChatServiceImpl implements ChatService {
msgHandler.saveMsg(insert, request);
//发布消息发送事件
applicationEventPublisher.publishEvent(new MessageSendEvent(this, insert.getId()));
applicationEventPublisher.publishEvent(new OpenAIEvent(this, insert.getId()));
return insert.getId();
}

View File

@@ -66,7 +66,7 @@ public class TextMsgHandler extends AbstractMsgHandler {
AssertUtil.equal(replyMsg.getRoomId(), request.getRoomId(), "只能回复相同会话内的消息");
}
if (CollectionUtil.isNotEmpty(body.getAtUidList())) {
AssertUtil.isTrue(body.getAtUidList().size() > 10, "一次别艾特这么多人");
AssertUtil.isFalse(body.getAtUidList().size() > 10, "一次别艾特这么多人");
List<Long> atUidList = body.getAtUidList();
Map<Long, User> batch = userInfoCache.getBatch(atUidList);
AssertUtil.equal(atUidList.size(), batch.values().size(), "@用户不存在");