This commit is contained in:
Luke.Ye 2025-07-08 11:21:55 +08:00
parent e4d8214eac
commit 068bf0419c

View File

@ -157,7 +157,9 @@ public class LLMAppServiceImpl implements LLMAppService {
*/ */
public static List<String> extractKeywords(String text) { public static List<String> extractKeywords(String text) {
List<String> keywords = new ArrayList<>(); List<String> keywords = new ArrayList<>();
Pattern pattern = Pattern.compile(ConstantConfig.KEYWORD_PATTERN_LEFT + "(.*?)" + ConstantConfig.KEYWORD_PATTERN_RIGHT); String left = ConstantConfig.KEYWORD_PATTERN_LEFT;
String right = ConstantConfig.KEYWORD_PATTERN_RIGHT;
Pattern pattern = Pattern.compile(Pattern.quote(left) + "(.*?)" + Pattern.quote(right));
Matcher matcher = pattern.matcher(text); Matcher matcher = pattern.matcher(text);
while (matcher.find()) { while (matcher.find()) {
keywords.add(matcher.group(1)); keywords.add(matcher.group(1));