socket 逻辑初始化

This commit is contained in:
wangxiangshun
2025-10-04 19:20:01 +08:00
parent 8afa39777f
commit 16d6f611f2
6 changed files with 24 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package com.vetti.web.controller.ai;
import com.vetti.common.ai.elevenLabs.ElevenLabsClient; import com.vetti.common.ai.elevenLabs.ElevenLabsClient;
import com.vetti.common.ai.gpt.ChatGPTClient; import com.vetti.common.ai.gpt.ChatGPTClient;
import com.vetti.common.ai.whisper.WhisperClient;
import com.vetti.common.core.controller.BaseController; import com.vetti.common.core.controller.BaseController;
import com.vetti.common.core.domain.AjaxResult; import com.vetti.common.core.domain.AjaxResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -28,6 +29,9 @@ public class AiCommonController extends BaseController
@Autowired @Autowired
private ChatGPTClient chatGPTClient; private ChatGPTClient chatGPTClient;
@Autowired
private WhisperClient whisperClient;
/** /**
* 进行文本转语音处理 * 进行文本转语音处理
*/ */
@@ -52,5 +56,15 @@ public class AiCommonController extends BaseController
/**
* 进行语音转文本处理
*/
@ApiOperation("进行语音转文本处理")
@GetMapping("/handleViceToText")
public AjaxResult handleViceToText()
{
whisperClient.handleVoiceToText("/Users/wangxiangshun/Desktop/临时文件/output.mp3");
return success();
}
} }

View File

@@ -153,12 +153,12 @@ elevenLabs:
whisper: whisper:
apiUrl: https://api.openai.com/v1/audio/transcriptions apiUrl: https://api.openai.com/v1/audio/transcriptions
model: whisper-1 model: whisper-1
apiKey: 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 apiKey: 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
language: zh language: zh
# AI 聊天 # AI 聊天
chatGpt: chatGpt:
apiKey: apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions apiUrl: https://api.openai.com/v1/chat/completions
model: gpt-3.5-turbo model: gpt-3.5-turbo
role: user role: user

View File

@@ -151,12 +151,12 @@ elevenLabs:
whisper: whisper:
apiUrl: https://api.openai.com/v1/audio/transcriptions apiUrl: https://api.openai.com/v1/audio/transcriptions
model: whisper-1 model: whisper-1
apiKey: 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 apiKey: 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
language: zh language: zh
# AI 聊天 # AI 聊天
chatGpt: chatGpt:
apiKey: apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions apiUrl: https://api.openai.com/v1/chat/completions
model: gpt-3.5-turbo model: gpt-3.5-turbo
role: user role: user

View File

@@ -151,12 +151,12 @@ elevenLabs:
whisper: whisper:
apiUrl: https://api.openai.com/v1/audio/transcriptions apiUrl: https://api.openai.com/v1/audio/transcriptions
model: whisper-1 model: whisper-1
apiKey: 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 apiKey: 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
language: zh language: zh
# AI 聊天 # AI 聊天
chatGpt: chatGpt:
apiKey: apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions apiUrl: https://api.openai.com/v1/chat/completions
model: gpt-3.5-turbo model: gpt-3.5-turbo
role: user role: user

View File

@@ -21,6 +21,7 @@ public class ChatCommonServiceImpl implements ChatCommonService {
@Override @Override
public void handleChatVoiceData() { public void handleChatVoiceData() {
//1、获取面试传输的语音文件 //1、获取面试传输的语音文件
//2、语音文件转换成文本字符串 //2、语音文件转换成文本字符串
@@ -31,5 +32,7 @@ public class ChatCommonServiceImpl implements ChatCommonService {
//5、返回最终的语音文件 //5、返回最终的语音文件
} }
} }

View File

@@ -111,7 +111,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> { .authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage","/aiCommon/**").permitAll() requests.antMatchers("/login", "/register", "/captchaImage","/aiCommon/**","/voice-websocket").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()