Skip to content

Commit 0b3526d

Browse files
committed
feat(log): 增强大模型评论&文章审核的日志记录
增强大模型评论&文章审核的日志记录
1 parent 67cd4a5 commit 0b3526d

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

backend/src/main/java/xyz/lingview/dimstack/service/impl/CommentServiceImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public int addComment(String username, AddCommentRequestDTO request) {
129129

130130
// AI审核
131131
if (commentStatus == 3 && siteConfigUtil.isLlmCommentReviewEnabled()) {
132+
log.info("评论 {}(用户:{})进入大模型审核", comment.getComment_id(), username);
132133
triggerLlmCommentReview(comment, article, username);
133134
} else if (commentStatus == 3) {
134135
sendCommentReviewNotification(comment, article, username);
@@ -375,20 +376,25 @@ private void sendCommentReviewNotification(Comment comment, Article article, Str
375376

376377
private void triggerLlmCommentReview(Comment comment, Article article, String commenterName) {
377378
new Thread(() -> {
379+
log.info("评论 {} 开始执行大模型审核(文章:{})", comment.getComment_id(), article.getArticle_name());
378380
try {
379381
String result = llmService.reviewComment(comment.getContent());
380382
if ("PASS".equals(result)) {
383+
log.info("评论 {} 大模型审核通过,自动发布", comment.getComment_id());
381384
commentMapper.updateCommentStatus(comment.getComment_id(), 1);
382385
sendReviewResultToAuthor(comment, true);
383386
sendCommentNotification(comment, article, commenterName);
384387
} else if ("REJECT".equals(result)) {
388+
log.warn("评论 {} 大模型审核不通过,标记为违规", comment.getComment_id());
385389
commentMapper.updateCommentStatus(comment.getComment_id(), 4);
386390
sendReviewResultToAuthor(comment, false);
387391
} else {
392+
log.warn("评论 {} 大模型审核异常,保持待审核状态,等待人工审核", comment.getComment_id());
388393
sendCommentReviewNotification(comment, article, commenterName);
389394
}
390395
} catch (Exception e) {
391-
log.warn("LLM评论审核异常: {}", e.getMessage());
396+
log.error("评论 {} 大模型审核发生未预期异常,保持待审核状态,等待人工审核", comment.getComment_id(), e);
397+
sendCommentReviewNotification(comment, article, commenterName);
392398
}
393399
}).start();
394400
}

backend/src/main/java/xyz/lingview/dimstack/service/impl/EditArticleServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,8 @@ private static class ReviewContext {
796796

797797
private void asyncAiReview(ReviewContext context) {
798798
new Thread(() -> {
799+
log.info("文章 {}《{}》(作者:{})进入大模型审核", context.articleId, context.articleName, context.authorUsername);
799800
try {
800-
log.debug("开始对文章 {} 进行异步大模型审核", context.articleId);
801801
AiReviewResult reviewResult = llmService.reviewArticle(context.articleContent);
802802

803803
if (reviewResult == AiReviewResult.PASS) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.86
1+
12.87

0 commit comments

Comments
 (0)