Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SmartBox
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
苗权威
SmartBox
Commits
88f9664f
Commit
88f9664f
authored
May 20, 2020
by
苗权威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5.19
parent
218866d8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
106 additions
and
61 deletions
+106
-61
workspace.xml
.idea/workspace.xml
+0
-0
TTSUtils.java
...rc/main/java/ai/qiwu/com/tts_service/common/TTSUtils.java
+6
-1
TTSController.java
...ava/ai/qiwu/com/tts_service/controller/TTSController.java
+1
-6
TTService.java
.../main/java/ai/qiwu/com/tts_service/service/TTService.java
+12
-7
OkHttp3Utils.java
...main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
+2
-2
SpiritController.java
...a/ai/qiwu/com/xiaoduhome/controller/SpiritController.java
+4
-2
XiaoDuHomeController.java
.../qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
+1
-1
DplBotServiceBoth.java
...ava/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java
+6
-6
ScheduleServiceNew.java
...va/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java
+6
-3
SpiritRedisService.java
...ava/ai/qiwu/com/xiaoduhome/spirit/SpiritRedisService.java
+0
-0
Utils.java
...main/java/ai/qiwu/com/xiaoduhome/xiaoai/common/Utils.java
+4
-1
XiaoAiServiceRedis.java
...iwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java
+7
-7
linPicture.html
xiaoduhome/src/main/resources/templates/linPicture.html
+46
-25
HomePage.html
xiaoduhome/src/main/resources/templates/xiaoai/HomePage.html
+11
-0
No files found.
.idea/workspace.xml
View file @
88f9664f
This diff is collapsed.
Click to expand it.
tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSUtils.java
View file @
88f9664f
...
@@ -662,6 +662,11 @@ public class TTSUtils {
...
@@ -662,6 +662,11 @@ public class TTSUtils {
public
static
void
main
(
String
[]
args
)
throws
IOException
,
UnsupportedAudioFileException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
,
UnsupportedAudioFileException
{
// UploadCallbackUnzip("/home/yf01/下载/tts/testzip","/home/yf01/下载/testUnzip.zip");
// UploadCallbackUnzip("/home/yf01/下载/tts/testzip","/home/yf01/下载/testUnzip.zip");
Files
.
copy
(
Paths
.
get
(
"/home/yf01/下载/d46f2708a6a79f5bcc4623b1030b8aca.mp3"
),
Paths
.
get
(
"/home/yf01/下载/d46Test.mp3"
));
// Files.copy(Paths.get("/home/yf01/下载/d46f2708a6a79f5bcc4623b1030b8aca.mp3"), Paths.get("/home/yf01/下载/d46Test.mp3"));
// System.out.println(buildMP3Filename("你是八星团的杜磊吧!我等你很久了,我叫周笑笑"));
System
.
out
.
println
(
buildMP3Filename
(
"先进来坐坐吧"
));
System
.
out
.
println
(
buildMP3Filename
(
" 先进来坐坐吧"
));
// System.out.println(buildMP3Filename("周笑笑把门打开,露出了女性特有的粉色公主房,坐在软绵绵的坐垫上,12岁的小女孩有点手足无措"));
// System.out.println(buildMP3Filename("你要喝些什么吗?我这里有果汁和可乐"));
}
}
}
}
tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java
View file @
88f9664f
...
@@ -280,11 +280,6 @@ public class TTSController {
...
@@ -280,11 +280,6 @@ public class TTSController {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"你想好了吗?先去比萨斜塔还是伽利略的大学玩呀?"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"你可以陪我去吗"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"好的,没问题。你闭上眼睛,我们很快就到啦。"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"没关系,那我来告诉你吧。"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"你这个答案可真是让我吃惊呢。那我们就来看看实验吧。"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"不过还有一些无法验证的理论,只能等待未来有人发现验证的新方法来时再来验证,希望你能成为那个人哦。"
));
System
.
out
.
println
(
TTSUtils
.
buildMP3Filename
(
"你好呀,小朋友,我在创造望远镜呢。你想不想知道我做这个望远镜做什么用啊?"
));
}
}
}
}
tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java
View file @
88f9664f
...
@@ -495,7 +495,7 @@ public class TTService {
...
@@ -495,7 +495,7 @@ public class TTService {
if
(
"xiaoai"
.
equals
(
platform
))
{
if
(
"xiaoai"
.
equals
(
platform
))
{
String
tmp_name
=
TTSUtils
.
pythonlistToStr
(
file_ls
);
String
tmp_name
=
TTSUtils
.
pythonlistToStr
(
file_ls
);
String
[]
parents
=
new
String
[]{
Initialize
.
getAudioDir
(),
botName
,
"xiaoai"
};
String
[]
parents
=
new
String
[]{
Initialize
.
getAudioDir
(),
botName
,
"xiaoai"
};
String
dirs
=
String
.
format
(
"[%s,xiaoai]"
,
botName
);
//
String dirs = String.format("[%s,xiaoai]", botName);
String
folder
=
StringUtils
.
join
(
parents
,
File
.
separator
);
String
folder
=
StringUtils
.
join
(
parents
,
File
.
separator
);
//String tmp_audio_name = String.format("%s/%s", folder, tmp_name);
//String tmp_audio_name = String.format("%s/%s", folder, tmp_name);
String
tmp_audio_name
=
new
StringBuilder
(
folder
).
append
(
File
.
separator
).
append
(
tmp_name
).
toString
();
String
tmp_audio_name
=
new
StringBuilder
(
folder
).
append
(
File
.
separator
).
append
(
tmp_name
).
toString
();
...
@@ -515,15 +515,20 @@ public class TTService {
...
@@ -515,15 +515,20 @@ public class TTService {
log
.
error
(
"小爱平台的请求,聚合mp3文件失败"
);
log
.
error
(
"小爱平台的请求,聚合mp3文件失败"
);
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
555
,
"小爱平台的请求,聚合mp3文件失败"
),
null
,
555
);
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
555
,
"小爱平台的请求,聚合mp3文件失败"
),
null
,
555
);
}
else
{
}
else
{
String
audio
=
Initialize
.
getServerUrl
()+
"/api/tts/get_audio?dirs=%s&filename=%s"
;
// String audio = Initialize.getServerUrl()+"/api/tts/get_audio?dirs=%s&filename=%s";
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
String
.
format
(
audio
,
URLEncoder
.
encode
(
dirs
,
"UTF-8"
),
// TTServiceUtil.buildTTS_lsResponse(response, new TTSResponse(String.format(audio, URLEncoder.encode(dirs, "UTF-8"),
tmp_name
),
200
),
null
,
200
);
// tmp_name),200), null, 200);
String
audio
=
Initialize
.
getServerUrlCdn
()+
"/api/audio/cache/"
+
botName
+
"/?filename="
+
tmp_audio_name
;
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
audio
,
200
),
null
,
200
);
}
}
}
else
{
}
else
{
log
.
warn
(
"tts_ls xiaoai 合成竞争->"
+
tmp_audio_name
+
",时间:"
+
new
Date
(
System
.
currentTimeMillis
()));
log
.
warn
(
"tts_ls xiaoai 合成竞争->"
+
tmp_audio_name
+
",时间:"
+
new
Date
(
System
.
currentTimeMillis
()));
String
audio
=
Initialize
.
getServerUrl
()+
"/api/tts/get_audio?dirs=%s&filename=%s"
;
// String audio = Initialize.getServerUrl()+"/api/tts/get_audio?dirs=%s&filename=%s";
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
String
.
format
(
audio
,
URLEncoder
.
encode
(
dirs
,
"UTF-8"
),
// TTServiceUtil.buildTTS_lsResponse(response, new TTSResponse( String.format(audio, URLEncoder.encode(dirs, "UTF-8"),
tmp_name
),
200
),
null
,
200
);
// tmp_name),200), null, 200);
String
audio
=
Initialize
.
getServerUrlCdn
()+
"/api/audio/cache/"
+
botName
+
"/?filename="
+
tmp_audio_name
+
"&exist=1"
;
TTServiceUtil
.
buildTTS_lsResponse
(
response
,
new
TTSResponse
(
audio
,
200
),
null
,
200
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"合成多个音频文件出错:{}"
,
e
.
toString
());
log
.
error
(
"合成多个音频文件出错:{}"
,
e
.
toString
());
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
View file @
88f9664f
...
@@ -264,8 +264,8 @@ public class OkHttp3Utils {
...
@@ -264,8 +264,8 @@ public class OkHttp3Utils {
@Override
@Override
public
void
onResponse
(
@NotNull
Call
call
,
@NotNull
Response
response
)
throws
IOException
{
public
void
onResponse
(
@NotNull
Call
call
,
@NotNull
Response
response
)
throws
IOException
{
try
(
ResponseBody
body
=
response
.
body
()){
try
(
ResponseBody
body
=
response
.
body
()){
//
body.string();
body
.
string
();
log
.
info
(
"退出成功:{}"
,
body
.
string
());
//
log.info("退出成功:{}", body.string());
}
catch
(
SocketTimeoutException
e
)
{
}
catch
(
SocketTimeoutException
e
)
{
log
.
error
(
"捕获到SocketTimeoutException:{}"
,
e
.
toString
());
log
.
error
(
"捕获到SocketTimeoutException:{}"
,
e
.
toString
());
client
.
dispatcher
().
cancelAll
();
client
.
dispatcher
().
cancelAll
();
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/SpiritController.java
View file @
88f9664f
...
@@ -57,9 +57,10 @@ public class SpiritController {
...
@@ -57,9 +57,10 @@ public class SpiritController {
// build response
// build response
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
TaskResult
taskResult
=
spiritRedisService
.
getResponse
(
query
,
5
);
TaskResult
taskResult
=
spiritRedisService
.
getResponse
(
query
,
5
);
// log
ger
.info("taskResult:"+taskResult);
// log.info("taskResult:"+taskResult);
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnValue
(
taskResult
);
resultModel
.
setReturnValue
(
taskResult
);
// log.info("天猫响应信息:"+ JSON.toJSONString(resultModel));
return
resultModel
;
return
resultModel
;
}
}
...
@@ -72,9 +73,10 @@ public class SpiritController {
...
@@ -72,9 +73,10 @@ public class SpiritController {
// build response
// build response
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
ResultModel
<
TaskResult
>
resultModel
=
new
ResultModel
<>();
TaskResult
taskResult
=
spiritRedisService
.
getResponse
(
query
,
4
);
TaskResult
taskResult
=
spiritRedisService
.
getResponse
(
query
,
4
);
// log
ger
.info("taskResult:"+taskResult);
// log.info("taskResult:"+taskResult);
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnCode
(
"0"
);
resultModel
.
setReturnValue
(
taskResult
);
resultModel
.
setReturnValue
(
taskResult
);
// log.info("天猫响应信息:"+ JSON.toJSONString(resultModel));
return
resultModel
;
return
resultModel
;
}
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
View file @
88f9664f
...
@@ -149,7 +149,7 @@ public class XiaoDuHomeController {
...
@@ -149,7 +149,7 @@ public class XiaoDuHomeController {
@PostMapping
(
"/novel"
)
// 智能小说
@PostMapping
(
"/novel"
)
// 智能小说
public
String
novel
()
{
public
String
novel
()
{
try
{
try
{
//
log.info("--------------分界线-------------------");
//
log.info("--------------分界线-------------------");
// DplBotService service = new DplBotService(Utils.getHttpServletRequest(), 2);
// DplBotService service = new DplBotService(Utils.getHttpServletRequest(), 2);
DplBotServiceBoth
service
=
new
DplBotServiceBoth
(
Utils
.
getHttpServletRequest
(),
2
,
stringRedisTemplate
);
DplBotServiceBoth
service
=
new
DplBotServiceBoth
(
Utils
.
getHttpServletRequest
(),
2
,
stringRedisTemplate
);
// log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes());
// log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes());
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java
View file @
88f9664f
...
@@ -266,8 +266,8 @@ public class DplBotServiceBoth extends BaseBot {
...
@@ -266,8 +266,8 @@ public class DplBotServiceBoth extends BaseBot {
stringRedisTemplate
.
delete
(
redisIdleId
);
stringRedisTemplate
.
delete
(
redisIdleId
);
String
botAccount
=
getBotAccountFromPath
(
data
);
String
botAccount
=
getBotAccountFromPath
(
data
);
if
(
StringUtils
.
isNotBlank
(
botAccount
))
{
if
(
StringUtils
.
isNotBlank
(
botAccount
))
{
//
Directive play = buildNoScreenPlayDirec(dealAudioUrlTemp(data, getBotAccountFromPath(data)), AudioPlayerDirective.PlayBehaviorType.REPLACE_ALL);
Directive
play
=
buildNoScreenPlayDirec
(
dealAudioUrlTemp
(
data
,
getBotAccountFromPath
(
data
)),
AudioPlayerDirective
.
PlayBehaviorType
.
REPLACE_ALL
);
Directive
play
=
buildNoScreenPlayDirec
(
dealAudioUrl
(
data
),
AudioPlayerDirective
.
PlayBehaviorType
.
REPLACE_ALL
);
//
Directive play = buildNoScreenPlayDirec(dealAudioUrl(data), AudioPlayerDirective.PlayBehaviorType.REPLACE_ALL);
addDirective
(
play
);
addDirective
(
play
);
return
new
Response
();
return
new
Response
();
}
}
...
@@ -406,7 +406,7 @@ public class DplBotServiceBoth extends BaseBot {
...
@@ -406,7 +406,7 @@ public class DplBotServiceBoth extends BaseBot {
log
.
error
(
"小度没有传来任何话语"
);
log
.
error
(
"小度没有传来任何话语"
);
return
buildErrorResponse
(
ErrorMsg
.
SORRY_UNCATCH
);
return
buildErrorResponse
(
ErrorMsg
.
SORRY_UNCATCH
);
}
}
log
.
info
(
"小度.用户说的话:{}"
,
userWord
);
// log.info("小度.用户说的话:{},requestId:{}",userWord, intentRequest.getRequestId()
);
String
channel
;
String
channel
;
switch
(
type
)
{
switch
(
type
)
{
...
@@ -417,7 +417,7 @@ public class DplBotServiceBoth extends BaseBot {
...
@@ -417,7 +417,7 @@ public class DplBotServiceBoth extends BaseBot {
default
:
channel
=
"jiaoyou-audio-test"
;
break
;
default
:
channel
=
"jiaoyou-audio-test"
;
break
;
}
}
String
response
=
RequestTerminal
.
requestTerminateTemp
(
userWord
,
userId
,
channel
);
String
response
=
RequestTerminal
.
requestTerminateTemp
(
userWord
,
userId
,
channel
);
log
.
info
(
"小度,小悟返回:{},"
,
response
);
//
log.info("小度,小悟返回:{},",response);
if
(
StringUtils
.
isBlank
(
response
))
{
if
(
StringUtils
.
isBlank
(
response
))
{
return
buildErrorResponse
(
ErrorMsg
.
SORRY_UNCATCH
);
return
buildErrorResponse
(
ErrorMsg
.
SORRY_UNCATCH
);
}
}
...
@@ -499,8 +499,8 @@ public class DplBotServiceBoth extends BaseBot {
...
@@ -499,8 +499,8 @@ public class DplBotServiceBoth extends BaseBot {
log
.
warn
(
"没有获取到aipioneerUsername"
);
log
.
warn
(
"没有获取到aipioneerUsername"
);
botAccount
=
"empty"
;
botAccount
=
"empty"
;
}
}
//
Directive play = buildNoScreenPlayDirec(dealAudioUrlTemp(path, botAccount), AudioPlayerDirective.PlayBehaviorType.REPLACE_ALL);
Directive
play
=
buildNoScreenPlayDirec
(
dealAudioUrlTemp
(
path
,
botAccount
),
AudioPlayerDirective
.
PlayBehaviorType
.
REPLACE_ALL
);
Directive
play
=
buildNoScreenPlayDirec
(
dealAudioUrl
(
path
),
AudioPlayerDirective
.
PlayBehaviorType
.
REPLACE_ALL
);
//
Directive play = buildNoScreenPlayDirec(dealAudioUrl(path), AudioPlayerDirective.PlayBehaviorType.REPLACE_ALL);
addDirective
(
play
);
addDirective
(
play
);
// if (userId.equals(DU_DEVICE_ID)) {
// if (userId.equals(DU_DEVICE_ID)) {
// DplbotServiceUtil.getPOOL().submit(() -> {
// DplbotServiceUtil.getPOOL().submit(() -> {
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java
View file @
88f9664f
...
@@ -51,7 +51,9 @@ public class ScheduleServiceNew implements InitializingBean {
...
@@ -51,7 +51,9 @@ public class ScheduleServiceNew implements InitializingBean {
public
static
volatile
String
BASE_HOST_URL
=
"http://didi-gz3.jiaoyou365.com:"
;
public
static
volatile
String
BASE_HOST_URL
=
"http://didi-gz3.jiaoyou365.com:"
;
public
static
volatile
String
CDN_HOST_URL
=
"http://didi-gz2-cdn.jiaoyou365.com:"
;
public
static
volatile
String
CDN_HOST_URL
=
"http://didi-gz2-cdn.jiaoyou365.com"
;
public
static
volatile
String
XIAO_AI_ENCRY_HOST
=
"didi-gz4.jiaoyou365.com"
;
@Override
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
public
void
afterPropertiesSet
()
throws
Exception
{
...
@@ -59,8 +61,9 @@ public class ScheduleServiceNew implements InitializingBean {
...
@@ -59,8 +61,9 @@ public class ScheduleServiceNew implements InitializingBean {
getOtherServerAddress
();
getOtherServerAddress
();
getJiaoYouChannelRecordBots
();
getJiaoYouChannelRecordBots
();
BASE_HOST_URL
=
Config
.
getProperty
(
"baseHostUrl"
,
"http://didi-gz3.jiaoyou365.com:"
);
BASE_HOST_URL
=
Config
.
getProperty
(
"baseHostUrl"
,
"http://didi-gz3.jiaoyou365.com:"
);
CDN_HOST_URL
=
Config
.
getProperty
(
"cdnHostUrl"
,
"http://didi-gz2-cdn.jiaoyou365.com:"
);
CDN_HOST_URL
=
Config
.
getProperty
(
"cdnHostUrl"
,
"http://didi-gz2-cdn.jiaoyou365.com"
);
log
.
info
(
"BASE_HOST_URL:{},{}"
,
BASE_HOST_URL
,
CDN_HOST_URL
);
XIAO_AI_ENCRY_HOST
=
Config
.
getProperty
(
"host"
,
"didi-gz3.jiaoyou365.com"
);
log
.
info
(
"BASE_HOST_URL:{},CDN_HOST_URL:{}, xiaoai encry host:{}"
,
BASE_HOST_URL
,
CDN_HOST_URL
,
XIAO_AI_ENCRY_HOST
);
// buildLunchNewDocument
// buildLunchNewDocument
}
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/spirit/SpiritRedisService.java
View file @
88f9664f
This diff is collapsed.
Click to expand it.
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/common/Utils.java
View file @
88f9664f
...
@@ -15,6 +15,8 @@ import java.net.URLEncoder;
...
@@ -15,6 +15,8 @@ import java.net.URLEncoder;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Objects
;
import
java.util.Objects
;
import
static
ai
.
qiwu
.
com
.
xiaoduhome
.
service
.
ScheduleServiceNew
.
XIAO_AI_ENCRY_HOST
;
/**
/**
* 工具类
* 工具类
* @author 苗权威
* @author 苗权威
...
@@ -74,7 +76,8 @@ public class Utils {
...
@@ -74,7 +76,8 @@ public class Utils {
}
}
public
static
boolean
encry
(
Integer
type
,
HttpServletRequest
request
)
{
public
static
boolean
encry
(
Integer
type
,
HttpServletRequest
request
)
{
String
host
=
"didi-gz4.jiaoyou365.com"
;
// String host = "didi-gz4.jiaoyou365.com";
String
host
=
XIAO_AI_ENCRY_HOST
;
String
xiaomiDate
=
request
.
getHeader
(
"x-xiaomi-date"
);
String
xiaomiDate
=
request
.
getHeader
(
"x-xiaomi-date"
);
String
md5
=
request
.
getHeader
(
"content-md5"
);
String
md5
=
request
.
getHeader
(
"content-md5"
);
if
(
StringUtils
.
isBlank
(
md5
))
md5
=
""
;
if
(
StringUtils
.
isBlank
(
md5
))
md5
=
""
;
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java
View file @
88f9664f
...
@@ -262,9 +262,9 @@ public class XiaoAiServiceRedis {
...
@@ -262,9 +262,9 @@ public class XiaoAiServiceRedis {
}
else
{
}
else
{
if
(
Boolean
.
TRUE
.
equals
(
stringRedisTemplate
.
hasKey
(
redisIdleId
)))
stringRedisTemplate
.
delete
(
redisIdleId
);
if
(
Boolean
.
TRUE
.
equals
(
stringRedisTemplate
.
hasKey
(
redisIdleId
)))
stringRedisTemplate
.
delete
(
redisIdleId
);
stringRedisTemplate
.
delete
(
redisId
);
stringRedisTemplate
.
delete
(
redisId
);
return
buildAudioResponse
(
changeAudioUrl
(
data
,
userId
));
//
return buildAudioResponse(changeAudioUrl(data, userId));
//
String botAccount = getBotAccountFromPath(data);
String
botAccount
=
getBotAccountFromPath
(
data
);
//
if (StringUtils.isNotBlank(botAccount)) return buildAudioResponse(changeAudioUrlTemp(data, botAccount));
if
(
StringUtils
.
isNotBlank
(
botAccount
))
return
buildAudioResponse
(
changeAudioUrlTemp
(
data
,
botAccount
));
}
}
}
}
}
}
...
@@ -363,9 +363,9 @@ public class XiaoAiServiceRedis {
...
@@ -363,9 +363,9 @@ public class XiaoAiServiceRedis {
}
}
String
response
;
String
response
;
try
{
try
{
log
.
info
(
"小爱,用户话:{}"
,
userWord
);
//
log.info("小爱,用户话:{}", userWord);
response
=
RequestTerminal
.
requestTerminate
(
userId
,
userWord
,
type
);
response
=
RequestTerminal
.
requestTerminate
(
userId
,
userWord
,
type
);
log
.
info
(
"小爱,小悟返回:{}"
,
response
);
//
log.info("小爱,小悟返回:{}", response);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"向终端发出的请求信息失败:{}"
,
e
.
toString
());
log
.
error
(
"向终端发出的请求信息失败:{}"
,
e
.
toString
());
return
buildTextResponse
(
SORRY_REPEAT
);
return
buildTextResponse
(
SORRY_REPEAT
);
...
@@ -439,8 +439,8 @@ public class XiaoAiServiceRedis {
...
@@ -439,8 +439,8 @@ public class XiaoAiServiceRedis {
log
.
warn
(
"没有获取到aipioneerUsername"
);
log
.
warn
(
"没有获取到aipioneerUsername"
);
botAccount
=
"empty"
;
botAccount
=
"empty"
;
}
}
//
xiaoAiResponse = buildAudioResponse(changeAudioUrlTemp(path, botAccount));
xiaoAiResponse
=
buildAudioResponse
(
changeAudioUrlTemp
(
path
,
botAccount
));
xiaoAiResponse
=
buildAudioResponse
(
changeAudioUrl
(
path
,
userId
));
//
xiaoAiResponse = buildAudioResponse(changeAudioUrl(path, userId));
if
(
Boolean
.
TRUE
.
equals
(
stringRedisTemplate
.
opsForValue
()
if
(
Boolean
.
TRUE
.
equals
(
stringRedisTemplate
.
opsForValue
()
.
setIfPresent
(
SpiritRedisService
.
PREFIX_REDIS
+
userId
,
path
,
15
,
TimeUnit
.
SECONDS
)))
{
.
setIfPresent
(
SpiritRedisService
.
PREFIX_REDIS
+
userId
,
path
,
15
,
TimeUnit
.
SECONDS
)))
{
log
.
info
(
"xiaoai 超时redis存储成功"
);
log
.
info
(
"xiaoai 超时redis存储成功"
);
...
...
xiaoduhome/src/main/resources/templates/linPicture.html
View file @
88f9664f
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<html
lang=
"en"
>
<head>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
图片上传
</title>
<title>
文件下载
</title>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
function
uploadImage
()
{
function
uploadImage
()
{
var
imageExtend
=
document
.
getElementById
(
"imageExtend"
).
value
;
//
var imageExtend = document.getElementById("imageExtend").value;
var
storyName
=
document
.
getElementById
(
"storyName"
).
value
;
//
var storyName = document.getElementById("storyName").value;
var
fileObj
=
document
.
querySelector
(
"#smallFile"
).
files
[
0
];
//
var fileObj = document.querySelector("#smallFile").files[0];
var
formData
=
new
FormData
();
//
var formData = new FormData();
formData
.
append
(
"file"
,
fileObj
);
// formData.append("npcId", 15284
);
formData
.
append
(
"storyName"
,
storyName
);
// formData.append("projectId", 823
);
formData
.
append
(
"imageType"
,
imageExtend
);
// formData.append("mood", "正常"
);
var
ajaxObj
=
new
XMLHttpRequest
();
var
ajaxObj
=
new
XMLHttpRequest
();
ajaxObj
.
open
(
'POST'
,
'/xiaoduhome/img/up'
,
true
);
ajaxObj
.
open
(
'POST'
,
'http://didi-gz5.jiaoyou365.com:19082/text/offline/csv'
,
true
);
ajaxObj
.
send
(
formData
);
ajaxObj
.
setRequestHeader
(
'Content-type'
,
'application/json'
);
ajaxObj
.
onreadystatechange
=
function
()
{
ajaxObj
.
setRequestHeader
(
'mul'
,
true
);
if
(
ajaxObj
.
readyState
===
4
)
{
ajaxObj
.
setRequestHeader
(
'projectId'
,
1358
);
var
status
=
ajaxObj
.
status
;
ajaxObj
.
setRequestHeader
(
'groupId'
,
1
);
if
(
status
>=
200
&&
status
<
300
||
status
===
304
)
{
ajaxObj
.
setRequestHeader
(
'Authorization'
,
'Basic ZXlKaGJHY2lPaUpJVXpJMU5pSjkuZXlKcFlYUWlPakUxT0RZMU1ETTFOVEVzSW1WNGNDSTZNVFU0TmpVek1qTTFNU3dpWVhWMGFHOXlhWFI1SWpveExDSnBaQ0k2TXpaOS5OQzVaV0l5UHlhTDVrSjFvQUNMWkJMUWxtZU80bUVhRFFQUDdZRVJYTk5zOnMwMHBlcnMzY3JldA=='
);
alert
(
"上传图片成功"
);
ajaxObj
.
responseType
=
"blob"
;
var
data
=
JSON
.
stringify
({
"npcId"
:
15985
,
"projectId"
:
1358
});
ajaxObj
.
onload
=
function
(
oEvent
)
{
if
((
ajaxObj
.
status
>=
200
&&
ajaxObj
.
status
<
300
)
||
ajaxObj
.
status
===
304
)
{
var
filename
=
ajaxObj
.
getResponseHeader
(
"Content-Disposition"
).
split
(
";"
)[
1
].
split
(
"filename="
)[
1
];
filename
=
decodeURI
(
filename
,
"utf-8"
);
if
(
!
filename
||
filename
===
'null'
)
{
filename
=
"temp.csv"
;
}
else
{
}
else
{
alert
(
"上传图片出错"
);
filename
=
filename
.
substring
(
1
,
filename
.
length
-
1
);
}
}
console
.
log
(
filename
);
var
content
=
ajaxObj
.
response
;
var
elink
=
document
.
createElement
(
'a'
);
elink
.
download
=
filename
;
elink
.
style
.
display
=
'none'
;
var
blob
=
new
Blob
([
content
]);
elink
.
href
=
URL
.
createObjectURL
(
blob
);
document
.
body
.
appendChild
(
elink
);
elink
.
click
();
document
.
body
.
removeChild
(
elink
);
}
else
{
console
.
assert
(
"下载失败"
);
}
}
}
};
ajaxObj
.
send
(
data
);
}
}
</script>
</script>
</head>
</head>
<body>
<body>
<
p
class=
"introl"
>
图片,填写图片名,选择图片类型.注:图片名要唯一
</p
>
<
!--<p class="introl">图片,填写图片名,选择图片类型.注:图片名要唯一</p>--
>
<
input
type=
"text"
id=
"storyName"
th:placeholder=
"请填写作品名-拼音"
th:value=
"${storyName}"
>
<
!--<input type="text" id="storyName" th:placeholder="请填写作品名-拼音" th:value="${storyName}">--
>
<
select
id=
"imageExtend"
th:value=
"${imageExtend}"
>
<
!--<select id="imageExtend" th:value="${imageExtend}">--
>
<
option
value=
"jpg"
>
jpg
</option
>
<
!--<option value="jpg">jpg</option>--
>
<
option
value=
"png"
>
png
</option
>
<
!--<option value="png">png</option>--
>
<
/select><br
>
<
!--</select><br>--
>
<
input
type=
"file"
id=
"smallFile"
accept=
"image/gif,image/jpeg,image/jpg,image/png"
><br
>
<
!--<input type="file" id="smallFile" accept="image/gif,image/jpeg,image/jpg,image/png"><br>--
>
<input
type=
"button"
onclick=
"uploadImage()"
value=
"上传图"
/>
<input
type=
"button"
onclick=
"uploadImage()"
value=
"上传图"
/>
</body>
</body>
</html>
</html>
\ No newline at end of file
xiaoduhome/src/main/resources/templates/xiaoai/HomePage.html
0 → 100644
View file @
88f9664f
<!DOCTYPE html>
<html
lang=
"zh-CN"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
首页
</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
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