京粉备注
This commit is contained in:
@@ -17,4 +17,7 @@ public interface CommentRepository extends JpaRepository<Comment, Integer> {
|
||||
|
||||
List<Comment> findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(String productId, Integer isUse);
|
||||
|
||||
List<Comment> findByProductIdAndPictureUrlsIsNotNull(String productId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user