1
This commit is contained in:
@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小红书/抖音提示词模板配置Controller
|
* 小红书/抖音提示词模板配置Controller
|
||||||
@@ -31,7 +33,10 @@ public class SocialMediaPromptController {
|
|||||||
"keywords",
|
"keywords",
|
||||||
"content:xhs",
|
"content:xhs",
|
||||||
"content:douyin",
|
"content:douyin",
|
||||||
"content:both"
|
"content:both",
|
||||||
|
"xianyu:wenan_base",
|
||||||
|
"xianyu:jiaonixiadan_extra",
|
||||||
|
"xianyu:title_clean_regex"
|
||||||
};
|
};
|
||||||
|
|
||||||
// 模板说明
|
// 模板说明
|
||||||
@@ -40,6 +45,9 @@ public class SocialMediaPromptController {
|
|||||||
put("content:xhs", "小红书文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
put("content:xhs", "小红书文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
||||||
put("content:douyin", "抖音文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
put("content:douyin", "抖音文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
||||||
put("content:both", "通用文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
put("content:both", "通用文案生成提示词模板\n占位符:%s - 商品名称,%s - 价格信息,%s - 关键词信息");
|
||||||
|
put("xianyu:wenan_base", "闲鱼文案·正文基础说明\n用于「一键代下」与「教你下单」两版文案中,紧接在标题/型号行之后(纯文本,无占位符)");
|
||||||
|
put("xianyu:jiaonixiadan_extra", "闲鱼文案·教你下单版尾部附加说明\n接在「更新日期:yyyy-MM-dd」之后(纯文本)");
|
||||||
|
put("xianyu:title_clean_regex", "闲鱼文案·标题/型号清洗正则\n从标题与型号备注中移除营销敏感片段;须为 Java 正则,匹配到的内容会被删除");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,6 +154,16 @@ public class SocialMediaPromptController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("xianyu:title_clean_regex".equals(key)) {
|
||||||
|
try {
|
||||||
|
Pattern.compile(template.trim());
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
response.put("code", 400);
|
||||||
|
response.put("msg", "正则表达式无效: " + e.getMessage());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String redisKey = REDIS_KEY_PREFIX + key;
|
String redisKey = REDIS_KEY_PREFIX + key;
|
||||||
redisTemplate.opsForValue().set(redisKey, template);
|
redisTemplate.opsForValue().set(redisKey, template);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user