diff --git a/mms-admin/pom.xml b/mms-admin/pom.xml index 866b61d..50bf947 100644 --- a/mms-admin/pom.xml +++ b/mms-admin/pom.xml @@ -62,16 +62,6 @@ com.sxpcwlkj mms-ai - - com.sxpcwlkj - mms-doc - - - com.sxpcwlkj - ms-framework - - - diff --git a/mms-admin/src/main/resources/application.yml b/mms-admin/src/main/resources/application.yml index 75dca87..ddbe8ee 100644 --- a/mms-admin/src/main/resources/application.yml +++ b/mms-admin/src/main/resources/application.yml @@ -91,7 +91,10 @@ spring: suffix: .html # 模板后缀(默认值) servlet: content-type: text/html # 设置响应的 Content-Type(默认 text/html) - static-resource-url: 'https://cdn.jsdelivr.net' # 注入静态资源 CDN 前缀(需在配置文件中定义) + static: + resource: + version: '1.0.0' + cdn: 'https://cdn.jsdelivr.net' # 注入静态资源 CDN 前缀(需在配置文件中定义) web: # 排除路径 diff --git a/mms-admin/src/main/resources/template/html/ai/index.html b/mms-admin/src/main/resources/template/html/ai/index.html index b989e51..ff5212d 100644 --- a/mms-admin/src/main/resources/template/html/ai/index.html +++ b/mms-admin/src/main/resources/template/html/ai/index.html @@ -6,12 +6,13 @@ 智能对话助手 | AI Chat - - - - - - + + + + + + +
diff --git a/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/config/ThymeleafConfig.java b/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/config/ThymeleafConfig.java new file mode 100644 index 0000000..1420bc3 --- /dev/null +++ b/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/config/ThymeleafConfig.java @@ -0,0 +1,37 @@ +package com.sxpcwlkj.framework.config; + + +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ModelAttribute; + +/** + * @author shanpengnian + */ +@ControllerAdvice +@RequiredArgsConstructor +public class ThymeleafConfig { + + @Value("${spring.thymeleaf.static.resource.version:/}") + private String staticResourceVersion; + + @Value("${spring.thymeleaf.static.resource.cdn:/}") + private String staticResourceCdn; + + // 注入上下文路径(如 /myapp) + @ModelAttribute("ctx") + public String contextPath(HttpServletRequest request) { + return request.getContextPath(); + } + + @ModelAttribute("cdn") + public String staticCdn() { + return staticResourceCdn; + } + @ModelAttribute("version") + public String staticVersion() { + return staticResourceVersion; + } +} diff --git a/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/controller/GlobalModelAttributes.java b/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/controller/GlobalModelAttributes.java deleted file mode 100644 index 3c4a484..0000000 --- a/mms-modules/mms-framework/src/main/java/com/sxpcwlkj/framework/controller/GlobalModelAttributes.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sxpcwlkj.framework.controller; - -import jakarta.servlet.ServletContext; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ModelAttribute; - -@ControllerAdvice -@RequiredArgsConstructor -public class GlobalModelAttributes { - - - private final ServletContext servletContext; - - // 注入上下文路径(如 /myapp) - @ModelAttribute("ctx") - public String contextPath() { - return servletContext.getContextPath(); - } - - // 可选:注入静态资源 CDN 前缀(需在配置文件中定义) - @Value("${spring.thymeleaf.static-resource-url:}") - private String staticResourceUrl; - - @ModelAttribute("staticCdn") - public String staticCdn() { - return staticResourceUrl; - } -}