京粉备注

This commit is contained in:
雷欧(林平凡)
2025-05-09 09:47:45 +08:00
parent 358258ab66
commit 29ef2d2968
2 changed files with 14 additions and 2 deletions

View File

@@ -17,4 +17,7 @@ public interface CommentRepository extends JpaRepository<Comment, Integer> {
List<Comment> findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(String productId, Integer isUse);
List<Comment> findByProductIdAndPictureUrlsIsNotNull(String productId);
}

View File

@@ -1764,12 +1764,21 @@ public class JDUtil {
}
}
// 调用 DeepSeek 生成新的评论内容
String deepSeekPrompt = COMMENT_TEMPLATES_DS + commentToUse.getCommentText();
StringBuilder deepSeekPrompt = new StringBuilder(COMMENT_TEMPLATES_DS + commentToUse.getCommentText());
//String deepSeekResponse = "";
String gptResponse = "";
try {
//deepSeekResponse = deepSeekClientUtil.getDeepSeekResponse(deepSeekPrompt);
gptResponse = gptClientUtil.getGPTResponse(deepSeekPrompt);
List<Comment> comments = commentRepository.findByProductIdAndPictureUrlsIsNotNull(product_id);
// 随机截取至多10个
comments = comments.subList(0, Math.min(10, comments.size()));
for (Comment comment : comments) {
String commentText = comment.getCommentText();
if (commentText != null && !commentText.isEmpty()) {
deepSeekPrompt.append("\n" ).append(commentText);
}
}
gptResponse = gptClientUtil.getGPTResponse(deepSeekPrompt.toString());
} catch (IOException e) {
logger.error("生成评论异常 - 用户: {}", fromWxid, e);
wxUtil.sendTextMessage(fromWxid, "AI 评论生成失败", 1, fromWxid, false);