mirror of https://github.com/halo-dev/halo
feat: generate summary for sheet.
parent
32701ab7bd
commit
ed734a6a16
|
@ -133,8 +133,8 @@ public class ContentSheetController {
|
|||
Page<BaseCommentVO> comments = sheetCommentService.pageVosBy(sheet.getId(), PageRequest.of(cp, optionService.getCommentPageSize(), sort));
|
||||
|
||||
// sheet and post all can use
|
||||
model.addAttribute("sheet", sheetService.convertToDetail(sheet));
|
||||
model.addAttribute("post", sheetService.convertToDetail(sheet));
|
||||
model.addAttribute("sheet", sheetService.convertToDetailVo(sheet));
|
||||
model.addAttribute("post", sheetService.convertToDetailVo(sheet));
|
||||
model.addAttribute("is_sheet", true);
|
||||
model.addAttribute("comments", comments);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package run.halo.app.service.impl;
|
|||
|
||||
import cn.hutool.core.text.StrBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
@ -280,6 +281,10 @@ public class SheetServiceImpl extends BasePostServiceImpl<Sheet> implements Shee
|
|||
// Get sheet meta ids
|
||||
sheetDetailVO.setSheetMetaIds(sheetMetaIds);
|
||||
sheetDetailVO.setSheetMetas(sheetMetaService.convertTo(sheetMetas));
|
||||
|
||||
if (StringUtils.isBlank(sheetDetailVO.getSummary())) {
|
||||
sheetDetailVO.setSummary(generateSummary(sheet.getFormatContent()));
|
||||
}
|
||||
return sheetDetailVO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue