完成火山引擎适配

This commit is contained in:
Maxchen
2025-11-07 11:54:11 +08:00
parent e402330692
commit cb26e452bb
15 changed files with 568 additions and 18 deletions

View File

@@ -19,6 +19,7 @@
<properties>
<easyexcel.version>3.2.1</easyexcel.version>
<jna.version>5.13.0</jna.version>
<java-websocket.version>1.5.5</java-websocket.version>
</properties>
<!-- 按照用户要求,不添加任何依赖 -->
@@ -84,5 +85,11 @@
<version>${jna.version}</version>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>${java-websocket.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,4 +1,16 @@
package org.ruoyi.aihuman.config;
public class WebConfig {
}
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 映射/voice/**路径到classpath:/voice/目录
registry.addResourceHandler("/voice/**")
.addResourceLocations("classpath:/voice/")
.setCachePeriod(3600);
}
}

View File

@@ -1,4 +1,21 @@
package org.ruoyi.aihuman.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 语音请求参数实体类
*/
@Data
public class VoiceRequest {
}
@JsonProperty("ENDPOINT")
private String endpoint;
private String appId;
private String accessToken;
private String resourceId;
private String voice;
private String text;
private String encoding;
}

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.extern.slf4j.Slf4j;
import org.java_websocket.client.WebSocketClient;

View File

@@ -1,4 +1,4 @@
package com.speech.protocol;
package org.ruoyi.aihuman.protocol;
import lombok.Getter;

View File

@@ -1,10 +1,10 @@
package com.speech.volcengine;
package org.ruoyi.aihuman.volcengine;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.speech.protocol.EventType;
import com.speech.protocol.Message;
import com.speech.protocol.MsgType;
import com.speech.protocol.SpeechWebSocketClient;
import org.ruoyi.aihuman.protocol.EventType;
import org.ruoyi.aihuman.protocol.Message;
import org.ruoyi.aihuman.protocol.MsgType;
import org.ruoyi.aihuman.protocol.SpeechWebSocketClient;
import lombok.extern.slf4j.Slf4j;
import java.io.ByteArrayOutputStream;
@@ -40,7 +40,7 @@ public class Bidirection {
String accessToken = System.getProperty("accessToken", "fOHuq4R4dirMYiOruCU3Ek9q75zV0KVW");
String resourceId = System.getProperty("resourceId", "seed-tts-2.0");
String voice = System.getProperty("voice", "zh_female_vv_uranus_bigtts");
String text = System.getProperty("text", "你好呀!如果你有关于老婆相关的问题,比如怎么让她开心、怎么照顾她等,都可以跟我说哦,我会根据【马斯克·陈】提供的关爱老婆百事通里的信息给你分析和建议哒");
String text = System.getProperty("text", "你好呀!我是AI合成的语音很高兴认识你");
String encoding = System.getProperty("encoding", "mp3");
if (appId.isEmpty() || accessToken.isEmpty()) {

View File

@@ -0,0 +1,10 @@
# 代码生成
gen:
# 作者
author: ageerle
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: org.ruoyi.aihuman
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: aihuman_