Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
robot-trans-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
robot-trans-platform
Commits
9f18dc7a
Commit
9f18dc7a
authored
Jul 02, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改音频识别结果
parent
e246480e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
382 additions
and
11 deletions
+382
-11
robot-trans-manager/src/main/java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
.../java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
+6
-3
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatATWSUtil.java
...c/main/java/com/mortals/xhx/common/utils/IatATWSUtil.java
+374
-0
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
...in/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
+0
-6
robot-trans-manager/src/test/java/httpclient/recording.pcm
robot-trans-manager/src/test/java/httpclient/recording.pcm
+0
-0
robot-trans-manager/src/test/java/httpclient/system.http
robot-trans-manager/src/test/java/httpclient/system.http
+2
-2
No files found.
robot-trans-manager/src/main/java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
View file @
9f18dc7a
...
@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
...
@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.utils.IatATWSUtil
;
import
com.mortals.xhx.common.utils.IatModelMulMain
;
import
com.mortals.xhx.common.utils.IatModelMulMain
;
import
com.mortals.xhx.common.utils.IatModelMulUtil
;
import
com.mortals.xhx.common.utils.IatModelMulUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -43,7 +44,8 @@ public class ApiSendMsgController {
...
@@ -43,7 +44,8 @@ public class ApiSendMsgController {
@Autowired
@Autowired
private
UploadService
uploadService
;
private
UploadService
uploadService
;
private
String
hostUrl
=
"https://iat.cn-huabei-1.xf-yun.com/v1"
;
// 注意多语种识别,也支持中文音频
//private String hostUrl = "https://iat.cn-huabei-1.xf-yun.com/v1"; // 注意多语种识别,也支持中文音频
private
String
hostUrl
=
"https://iat-api.xfyun.cn/v2/iat"
;
// 注意多语种识别,也支持中文音频
private
String
appid
=
"3cc52607"
;
//在控制台-我的应用获取
private
String
appid
=
"3cc52607"
;
//在控制台-我的应用获取
private
String
apiSecret
=
"ZTdmMjFjMGYxYmJhN2VmYjFlMTg3N2Rk"
;
// 在控制台-我的应用获取
private
String
apiSecret
=
"ZTdmMjFjMGYxYmJhN2VmYjFlMTg3N2Rk"
;
// 在控制台-我的应用获取
private
String
apiKey
=
"d0f73d44e996c2da9924c4476c578a30"
;
// 在控制台-我的应用获取
private
String
apiKey
=
"d0f73d44e996c2da9924c4476c578a30"
;
// 在控制台-我的应用获取
...
@@ -108,9 +110,10 @@ public class ApiSendMsgController {
...
@@ -108,9 +110,10 @@ public class ApiSendMsgController {
byte
[]
bytes
=
file
.
getBytes
();
byte
[]
bytes
=
file
.
getBytes
();
// IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(filePath, appid);
// IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(filePath, appid);
IatModelMulUtil
iatModelMulUtil
=
new
IatModelMulUtil
(
bytes
,
appid
);
// IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(bytes, appid);
IatATWSUtil
iatModelMulUtil
=
new
IatATWSUtil
(
bytes
,
appid
);
String
authUrl
=
Iat
ModelMul
Util
.
getAuthUrl
(
hostUrl
,
apiKey
,
apiSecret
);
String
authUrl
=
Iat
ATWS
Util
.
getAuthUrl
(
hostUrl
,
apiKey
,
apiSecret
);
//log.info("authUrl==>" + authUrl);
//log.info("authUrl==>" + authUrl);
OkHttpClient
client
=
new
OkHttpClient
.
Builder
().
build
();
OkHttpClient
client
=
new
OkHttpClient
.
Builder
().
build
();
...
...
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatATWSUtil.java
0 → 100644
View file @
9f18dc7a
This diff is collapsed.
Click to expand it.
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
View file @
9f18dc7a
...
@@ -30,11 +30,6 @@ import java.util.concurrent.CompletableFuture;
...
@@ -30,11 +30,6 @@ import java.util.concurrent.CompletableFuture;
@Slf4j
@Slf4j
public
class
IatModelMulUtil
extends
WebSocketListener
{
public
class
IatModelMulUtil
extends
WebSocketListener
{
private
final
CompletableFuture
<
String
>
future
=
new
CompletableFuture
<>();
private
final
CompletableFuture
<
String
>
future
=
new
CompletableFuture
<>();
/* private static final String hostUrl = "https://iat.cn-huabei-1.xf-yun.com/v1"; // 注意多语种识别,也支持中文音频
private static final String appid = "3cc52607"; //在控制台-我的应用获取
private static final String apiSecret = "ZTdmMjFjMGYxYmJhN2VmYjFlMTg3N2Rk"; // 在控制台-我的应用获取
private static final String apiKey = "d0f73d44e996c2da9924c4476c578a30"; // 在控制台-我的应用获取
private static final String file = "E://test1.mp3"; // 识别音频位置*/
public
static
final
int
StatusFirstFrame
=
0
;
public
static
final
int
StatusFirstFrame
=
0
;
public
static
final
int
StatusContinueFrame
=
1
;
public
static
final
int
StatusContinueFrame
=
1
;
public
static
final
int
StatusLastFrame
=
2
;
public
static
final
int
StatusLastFrame
=
2
;
...
@@ -74,7 +69,6 @@ public class IatModelMulUtil extends WebSocketListener {
...
@@ -74,7 +69,6 @@ public class IatModelMulUtil extends WebSocketListener {
super
.
onOpen
(
webSocket
,
response
);
super
.
onOpen
(
webSocket
,
response
);
new
Thread
(()
->
{
new
Thread
(()
->
{
//连接成功,开始发送数据
//连接成功,开始发送数据
//int frameSize = 1280; //每一帧音频的大小,建议每 40ms 发送 122B
int
frameSize
=
8092
;
//每一帧音频的大小,建议每 40ms 发送 122B
int
frameSize
=
8092
;
//每一帧音频的大小,建议每 40ms 发送 122B
int
intervel
=
40
;
int
intervel
=
40
;
int
status
=
0
;
// 音频的状态
int
status
=
0
;
// 音频的状态
...
...
robot-trans-manager/src/test/java/httpclient/recording.pcm
View file @
9f18dc7a
No preview for this file type
robot-trans-manager/src/test/java/httpclient/system.http
View file @
9f18dc7a
...
@@ -40,9 +40,9 @@ POST {{baseUrl}}/audio/upload
...
@@ -40,9 +40,9 @@ POST {{baseUrl}}/audio/upload
Content-Type: multipart/form-data; boundary=WebAppBoundary
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="
recording
.pcm"
Content-Disposition: form-data; name="file"; filename="
test
.pcm"
< ./
recording
.pcm
< ./
test
.pcm
--WebAppBoundary--
--WebAppBoundary--
###测试链接数据库
###测试链接数据库
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment