Compare commits

...

3 Commits

3 changed files with 8 additions and 7 deletions

View File

@@ -127,9 +127,8 @@ public class WebConfig implements WebMvcConfigurer {
"/user/check",
"/user/wx-login",
"/user/refresh-token",
// 公开接口 - 作品列表和分类
"/work/list",
"/work/categories",
// 公开接口 - 作品相关由JwtAuthInterceptor内部处理可选认证
// /work/list, /work/categories, /work/{id} 不在此排除,通过拦截器内部正则匹配实现可选认证
// 分类和Banner
"/category/**",
"/banner/**",

View File

@@ -22,13 +22,15 @@ public class JwtAuthInterceptor implements HandlerInterceptor {
private final JwtUtil jwtUtil;
// 公开路径可选认证有token则解析无token也放行
// 匹配: /work/list, /work/categories, /work/{数字ID}
private static final java.util.regex.Pattern OPTIONAL_AUTH_PATTERN =
java.util.regex.Pattern.compile("^/work/\\d+$");
java.util.regex.Pattern.compile("^/work/(list|categories|\\d+)$");
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String requestURI = request.getRequestURI();
boolean isOptionalAuthPath = OPTIONAL_AUTH_PATTERN.matcher(requestURI).matches();
// 使用 servletPath不含context-path与拦截器路径匹配一致
String servletPath = request.getServletPath();
boolean isOptionalAuthPath = OPTIONAL_AUTH_PATTERN.matcher(servletPath).matches();
// 从请求头获取token
String authHeader = request.getHeader("Authorization");

View File

@@ -268,7 +268,7 @@ INSERT INTO `ai_model` (`id`, `provider_id`, `name`, `code`, `type`, `category`,
'{}',
'{}',
'[{"name":"prompt","label":"图片描述","type":"textarea","required":true,"placeholder":"描述你想要生成的图片内容推荐使用中文最多8192字符"},{"name":"images","label":"垫图","type":"image","required":false,"placeholder":"可选上传参考图片最多3张支持jpg/png/webp","maxSize":10,"maxCount":3},{"name":"resolution","label":"图片分辨率","type":"select","options":[{"label":"1024x1024","value":"1024:1024"},{"label":"1248x832(横屏)","value":"1248:832"},{"label":"832x1248(竖屏)","value":"832:1248"},{"label":"768x1024","value":"768:1024"},{"label":"1024x768","value":"1024:768"},{"label":"512x1024","value":"512:1024"},{"label":"1024x512","value":"1024:512"}],"default":"1024:1024"},{"name":"revise","label":"Prompt改写","type":"select","options":[{"label":"开启提示词改写推荐约增加20s耗时","value":1},{"label":"关闭","value":0}],"default":1}]',
30, 300, 120, 'tencent_cloud_api', NULL, '{"service":"aiart","host":"aiart.tencentcloudapi.com","version":"2022-12-29","region":"ap-guangzhou","submit_action":"SubmitTextToImageJob","query_action":"QueryTextToImageJob"}', 1, NULL, 'POST', NULL, NULL, NULL, 10000, 60, 300, 1, 'result', 1, 1, 9),
30, 300, 120, 'tencent_cloud_api', NULL, '{"service":"aiart","host":"aiart.tencentcloudapi.com","version":"2022-12-29","region":"ap-guangzhou","submit_action":"SubmitTextToImageJob","query_action":"QueryTextToImageJob","default_params":{"LogoAdd":0}}', 1, NULL, 'POST', NULL, NULL, NULL, 10000, 60, 300, 1, 'result', 1, 1, 9),
-- 火山引擎豆包Seedream 4.5图片生成(同步任务,用户端)
-- 接口: POST /api/v3/images/generations
-- 返回: {"data":[{"url":"xxx"}]}