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