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
4089b544
Commit
4089b544
authored
Jun 16, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加音频识别
parent
e401e397
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
robot-trans-manager/src/main/java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
.../java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
+12
-1
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
...in/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
+1
-6
No files found.
robot-trans-manager/src/main/java/com/mortals/xhx/busiz/web/ApiSendMsgController.java
View file @
4089b544
package
com.mortals.xhx.busiz.web
;
package
com.mortals.xhx.busiz.web
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
...
@@ -91,11 +93,20 @@ public class ApiSendMsgController {
...
@@ -91,11 +93,20 @@ public class ApiSendMsgController {
public
SseEmitter
doFileUpload
(
MultipartFile
file
,
@RequestParam
(
value
=
"prePath"
,
defaultValue
=
""
)
String
prePath
)
{
public
SseEmitter
doFileUpload
(
MultipartFile
file
,
@RequestParam
(
value
=
"prePath"
,
defaultValue
=
""
)
String
prePath
)
{
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
jsonStr
=
""
;
String
jsonStr
=
""
;
SseEmitter
emitter
=
new
SseEmitter
(
30
000L
);
SseEmitter
emitter
=
new
SseEmitter
(
10
*
60
*
1
000L
);
try
{
try
{
if
(
file
==
null
||
file
.
getSize
()==
0L
)
throw
new
AppException
(
"文件为空!"
);
if
(!
"pcm"
.
equalsIgnoreCase
(
FileUtil
.
getSuffix
(
file
.
getOriginalFilename
())))
throw
new
AppException
(
"只支持pcm文件!"
);
//if (file.getOriginalFilename())
String
filePath
=
uploadService
.
saveFileUpload
(
file
,
prePath
,
null
);
String
filePath
=
uploadService
.
saveFileUpload
(
file
,
prePath
,
null
);
filePath
=
uploadService
.
getFilePath
(
filePath
);
filePath
=
uploadService
.
getFilePath
(
filePath
);
log
.
info
(
"filePath==>"
+
filePath
);
IatModelMulUtil
iatModelMulUtil
=
new
IatModelMulUtil
(
filePath
,
appid
,
emitter
);
IatModelMulUtil
iatModelMulUtil
=
new
IatModelMulUtil
(
filePath
,
appid
,
emitter
);
...
...
robot-trans-manager/src/main/java/com/mortals/xhx/common/utils/IatModelMulUtil.java
View file @
4089b544
...
@@ -182,12 +182,6 @@ public class IatModelMulUtil extends WebSocketListener {
...
@@ -182,12 +182,6 @@ public class IatModelMulUtil extends WebSocketListener {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"发送异常==》{}"
,
e
.
getMessage
());
log
.
error
(
"发送异常==》{}"
,
e
.
getMessage
());
}
}
//emitter.n
// emitter.next(rsp);
// System.out.print(cw.w);
}
}
}
}
}
}
...
@@ -201,6 +195,7 @@ public class IatModelMulUtil extends WebSocketListener {
...
@@ -201,6 +195,7 @@ public class IatModelMulUtil extends WebSocketListener {
// System.out.println("最终识别结果 ==》" + decodeRes); // 按照规则替换与追加出最终识别结果
// System.out.println("最终识别结果 ==》" + decodeRes); // 按照规则替换与追加出最终识别结果
log
.
info
(
"本次识别sid ==》"
+
jsonParse
.
header
.
sid
);
log
.
info
(
"本次识别sid ==》"
+
jsonParse
.
header
.
sid
);
emitter
.
complete
();
emitter
.
complete
();
log
.
info
(
"emitter 关闭"
);
webSocket
.
close
(
1000
,
""
);
webSocket
.
close
(
1000
,
""
);
}
}
...
...
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