-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add extension point for excerpt generation (#6348)
#### What type of PR is this? /kind feature /area core /milestone 2.18.x #### What this PR does / why we need it: 新增文章摘要生成扩展点用于扩展自动生成摘要的方式 #### Does this PR introduce a user-facing change? ```release-note 新增文章摘要生成扩展点用于扩展自动生成摘要的方式 ```
- Loading branch information
Showing
6 changed files
with
176 additions
and
29 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
api/src/main/java/run/halo/app/content/ExcerptGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package run.halo.app.content; | ||
|
||
import java.util.Set; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import org.pf4j.ExtensionPoint; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface ExcerptGenerator extends ExtensionPoint { | ||
|
||
Mono<String> generate(ExcerptGenerator.Context context); | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
class Context { | ||
private String raw; | ||
/** | ||
* html content. | ||
*/ | ||
private String content; | ||
|
||
private String rawType; | ||
/** | ||
* keywords in the content to help the excerpt generation more accurate. | ||
*/ | ||
private Set<String> keywords; | ||
/** | ||
* Max length of the generated excerpt. | ||
*/ | ||
private int maxLength; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.