Skip to content

Commit a28f5c2

Browse files
committed
fix: 修复静态资源引用问题
1 parent 7ba6724 commit a28f5c2

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/main/java/com/xiaozhi/controller/DeviceController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public ResponseEntity<byte[]> ota(@RequestHeader("Device-Id") String deviceIdAut
206206
logger.debug("JSON解析失败: {}", e.getMessage());
207207
}
208208

209-
if (deviceIdAuth == null || !CmsUtils.isMacAddressValid(deviceIdAuth)) {
209+
if (deviceIdAuth == null || !cmsUtils.isMacAddressValid(deviceIdAuth)) {
210210
Map<String, Object> errorResponse = new HashMap<>();
211211
errorResponse.put("error", "设备ID不正确");
212212
byte[] responseBytes = JsonUtil.OBJECT_MAPPER.writeValueAsBytes(errorResponse);
@@ -312,7 +312,7 @@ public ResponseEntity<byte[]> ota(@RequestHeader("Device-Id") String deviceIdAut
312312
public ResponseEntity<String> otaActivate(@Parameter(name = "Device-Id", description = "设备唯一标识", required = true, in = ParameterIn.HEADER)
313313
@RequestHeader("Device-Id") String deviceId) {
314314
try {
315-
if(!CmsUtils.isMacAddressValid(deviceId)){
315+
if(!cmsUtils.isMacAddressValid(deviceId)){
316316
return ResponseEntity.status(202).build();
317317
}
318318
// 解析请求体

src/main/java/com/xiaozhi/dialogue/llm/tool/mcp/device/DeviceMcpService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private DeviceMcpInitialize deviceMcpInitialize(ChatSession chatSession) {
9494
DeviceMcpVision vision = new DeviceMcpVision();
9595

9696
//VLChatController
97-
String url = CmsUtils.getServerAddress() + "/vl/chat";
97+
String url = cmsUtils.getServerAddress() + "/vl/chat";
9898
vision.setUrl(url);
9999
vision.setToken(chatSession.getSessionId());
100100

src/main/java/com/xiaozhi/utils/CmsUtils.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public class CmsUtils {
2727
public static final String USER_ATTRIBUTE_KEY = "user";
2828

2929
// 缓存服务器IP地址 - 只在第一次调用getServerIp时初始化
30-
private static String serverIp = null;
31-
private static boolean initializing = false;
30+
private String serverIp = null;
31+
private boolean initializing = false;
3232

3333
// 新增的全局变量
34-
private static String websocketAddress = null;
35-
private static String otaAddress = null;
36-
private static String serverAddress = null;
34+
private String websocketAddress = null;
35+
private String otaAddress = null;
36+
private String serverAddress = null;
3737

3838
@Value("${server.port:8091}")
3939
private int port;
@@ -88,17 +88,17 @@ public static String getName() {
8888
}
8989

9090
// WebSocket地址
91-
public static String getWebsocketAddress() {
91+
public String getWebsocketAddress() {
9292
return websocketAddress;
9393
}
9494

9595
// OTA地址
96-
public static String getOtaAddress() {
96+
public String getOtaAddress() {
9797
return otaAddress;
9898
}
9999

100100
// Server地址
101-
public static String getServerAddress() {
101+
public String getServerAddress() {
102102
return serverAddress;
103103
}
104104

@@ -211,7 +211,7 @@ public static String getServerAddress() {
211211
/**
212212
* 判断MAC地址是否合法
213213
*/
214-
public static boolean isMacAddressValid(String mac) {
214+
public boolean isMacAddressValid(String mac) {
215215
// 正则校验格式
216216
if (!macPattern.matcher(mac).matches()) {
217217
return false;
@@ -273,7 +273,7 @@ public static String getClientIp(HttpServletRequest request) {
273273
*
274274
* @return 合适的IP地址
275275
*/
276-
public static String getServerIp() {
276+
public String getServerIp() {
277277
// 如果IP已经初始化,直接返回
278278
if (serverIp != null) {
279279
return serverIp;
@@ -1066,7 +1066,7 @@ private static boolean isRunningInDocker() {
10661066
/**
10671067
* 获取环境类型的详细信息,用于调试
10681068
*/
1069-
public static Map<String, Object> getEnvironmentDetails() {
1069+
public Map<String, Object> getEnvironmentDetails() {
10701070
Map<String, Object> details = new HashMap<>();
10711071

10721072
// 获取IP信息

0 commit comments

Comments
 (0)