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.gpt.ChatGPTClient;
import com.vetti.common.ai.whisper.WhisperClient;
import com.vetti.common.core.controller.BaseController;
import com.vetti.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
@@ -28,6 +29,9 @@ public class AiCommonController extends BaseController
@Autowired
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:
apiUrl: https://api.openai.com/v1/audio/transcriptions
model: whisper-1
apiKey: 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
apiKey: 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
language: zh
# AI 聊天
chatGpt:
apiKey:
apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions
model: gpt-3.5-turbo
role: user

View File

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

View File

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

View File

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

View File

@@ -111,7 +111,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录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("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()