feat: 语音交互接口

This commit is contained in:
stream 2025-08-26 10:45:39 +08:00
parent ba20ac1416
commit 3b036d983e
3 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,28 @@
package com.cmvr.web.controller.test;
import com.cmvr.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "语音唤醒服务")
@RestController
@RequestMapping("/kws")
@RequiredArgsConstructor
public class TekKeywordsSpotController {
@ApiOperation("唤醒")
@GetMapping("/wake")
public AjaxResult wake() {
return AjaxResult.ok("ok");
}
@ApiOperation("执行")
@GetMapping("/execute")
public AjaxResult execute() {
return AjaxResult.ok();
}
}

View File

@ -102,6 +102,27 @@ public class AjaxResult extends HashMap<String, Object>
return new AjaxResult(HttpStatus.SUCCESS, msg, data); return new AjaxResult(HttpStatus.SUCCESS, msg, data);
} }
/**
* 返回成功消息
*
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult ok(Object data)
{
return new AjaxResult(HttpStatus.SUCCESS, "操作成功", data);
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public static AjaxResult ok()
{
return new AjaxResult(HttpStatus.SUCCESS, "操作成功", null);
}
/** /**
* 返回警告消息 * 返回警告消息
* *

View File

@ -114,7 +114,7 @@ public class SecurityConfig
requests.antMatchers("/login", "/register", "/captchaImage").permitAll() requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/ws/**","/api/grpc/**","/show/**","/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/kws/**","/ws/**","/api/grpc/**","/show/**","/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated(); .anyRequest().authenticated();
}) })