From ca041e9653520c58ab4776fd79cfe38377bed4f4 Mon Sep 17 00:00:00 2001 From: 苗权威 <1160292058@qq.com> Date: Fri, 30 Oct 2020 22:09:37 +0800 Subject: [PATCH] 10.30 --- .idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml | 13 +++++++++++++ .idea/libraries/Maven__com_squareup_okhttp_logging_interceptor_2_7_5.xml | 13 +++++++++++++ .idea/libraries/Maven__com_squareup_okhttp_okhttp_2_5_0.xml | 13 +++++++++++++ .idea/libraries/Maven__com_tencentcloudapi_tencentcloud_sdk_java_3_1_156.xml | 13 +++++++++++++ .idea/libraries/Maven__commons_logging_commons_logging_1_2.xml | 13 +++++++++++++ .idea/uiDesigner.xml | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .idea/workspace.xml | 891 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tts_service/pom.xml | 8 ++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/common/CallPython.java | 13 +++++++------ tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java | 11 +++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java | 30 ++++++++++++++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempPersonInfo.java | 21 +++++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempSpeakersApi.java | 19 +++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/SpeakersApiRes.java | 2 ++ tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponse.java | 18 ++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponseData.java | 19 +++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSData.java | 18 ++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSResponse.java | 20 ++++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/repository/SpeakerInfoRepository.java | 8 ++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java | 19 ++++++++++++++++--- tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTServiceEdition2.java | 22 +++++++++++----------- tts_service/src/main/java/ai/qiwu/com/tts_service/service/baidu/ThirdPartyService.java | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------- xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java | 24 ++++++++++++------------ xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java | 2 +- xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java | 10 ++++++++-- xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java | 6 +++--- 27 files changed, 1199 insertions(+), 393 deletions(-) create mode 100644 .idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml create mode 100644 .idea/libraries/Maven__com_squareup_okhttp_logging_interceptor_2_7_5.xml create mode 100644 .idea/libraries/Maven__com_squareup_okhttp_okhttp_2_5_0.xml create mode 100644 .idea/libraries/Maven__com_tencentcloudapi_tencentcloud_sdk_java_3_1_156.xml create mode 100644 .idea/libraries/Maven__commons_logging_commons_logging_1_2.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempPersonInfo.java create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempSpeakersApi.java create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponse.java create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponseData.java create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSData.java create mode 100644 tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSResponse.java diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml new file mode 100644 index 0000000..9558f04 --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_squareup_okhttp_logging_interceptor_2_7_5.xml b/.idea/libraries/Maven__com_squareup_okhttp_logging_interceptor_2_7_5.xml new file mode 100644 index 0000000..32d48e9 --- /dev/null +++ b/.idea/libraries/Maven__com_squareup_okhttp_logging_interceptor_2_7_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_squareup_okhttp_okhttp_2_5_0.xml b/.idea/libraries/Maven__com_squareup_okhttp_okhttp_2_5_0.xml new file mode 100644 index 0000000..a221d32 --- /dev/null +++ b/.idea/libraries/Maven__com_squareup_okhttp_okhttp_2_5_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_tencentcloudapi_tencentcloud_sdk_java_3_1_156.xml b/.idea/libraries/Maven__com_tencentcloudapi_tencentcloud_sdk_java_3_1_156.xml new file mode 100644 index 0000000..555bd4b --- /dev/null +++ b/.idea/libraries/Maven__com_tencentcloudapi_tencentcloud_sdk_java_3_1_156.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml new file mode 100644 index 0000000..615260c --- /dev/null +++ b/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d8cf933..d3bb975 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,13 +6,20 @@ - - - + + + - + + + + + + + + @@ -52,57 +59,57 @@ - - + + - - - - + + - + - - + + + + + - + - - + + + + + - + - - + + - - - - - + - - + + @@ -110,44 +117,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -164,36 +135,36 @@ - dealDefaultIntent - /api/upload/record/one_sen - usFile - indexOf - getOneSenAudioConfig - backTrigger - ExecuteCommands - generalMP3 - data - botAccount - BEARER - SendEvent - categoryName - "category" - productName - userId - 47250 - 32k - bitRate - record - 48000 - synSysImgTargetServerDownInThread - SERVER_NAME - targetDir - sourceServer - delRecordCallbackUrl - size + splitList ttsRequest - getOnline - ONLINE_CACHE_URL + buildMp + buildMP3Filename + successUpLoadFileIds + log + WELCOME_FORMAT + XIAO_AI_ENCRY_HOST + jiaoyouChannel2Bots + channelId + dealThirdParty + THIRD_PARTY_WITH_ITS_PER + tts_ls + THIRD_PARTY_TTS + commons + httpcore + TtsSynSender + customizedParams + strResp + TextToVoiceResponse + jsonPayload + requestPayload + url + TTS_CLIENT + hashedRequestPayload + request + TextToVoiceRequest + respbody + tencentProEnglishPerson + speakerInfoRepository !CollectionUtils.isEmpty @@ -212,38 +183,15 @@ @@ -276,7 +247,26 @@ - + + + + + + + + + + + + + + + + + + + + - @@ -365,18 +394,26 @@ - - + + + + + + + + + + @@ -393,9 +430,9 @@ - - - - - + - + - - + + - - + + @@ -765,8 +814,8 @@ - - + + @@ -777,7 +826,7 @@ - + @@ -787,401 +836,565 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + - + - - + + - + - - + + - + + - + - - + + + + + + + + + + - + - - + + + + + - + - - + + + + + + + - + - - + + + + + + - + - - + + - + + - + - - + + - + - - + + + + + - + - - + + - + - - + + + + + - + - + - + - - + + + + + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - + + - + - - + + - - - + + - + - - + + - + - - - - - - + + - + - - + + - + - - + + + + + - + - - + + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - - - - + + - + - - + + - + - - + + - - - - - + - - + + + + + - + - - + + - + - - + + + + + - + - - + + + + + + - + - - + + - + - - + + + + + - + - - + + + + + + + + + + + dingdong:war + + + + + + + + Spring + + + + + + + + + + + + + + + 1.8 + + + + + + + + tts_service + + + + + + + + Maven: antlr:antlr:2.7.7 + + + + + + + \ No newline at end of file diff --git a/tts_service/pom.xml b/tts_service/pom.xml index 4aaa298..ef30c76 100755 --- a/tts_service/pom.xml +++ b/tts_service/pom.xml @@ -59,6 +59,7 @@ httpclient 4.5.12 + org.apache.httpcomponents @@ -92,6 +93,13 @@ commons-fileupload 1.4 + + + com.tencentcloudapi + tencentcloud-sdk-java + 3.1.156 + + net.sourceforge.javacsv diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/CallPython.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/CallPython.java index 759c163..59fdf65 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/CallPython.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/CallPython.java @@ -204,7 +204,7 @@ public class CallPython { return null; } - static String ffmpegExecute(String arg) { + public static String ffmpegExecute(String arg) { // log.warn("ffmpegExecute: "+arg); ProcessBuilder processBuilder = new ProcessBuilder(arg.split(" ")); processBuilder.redirectErrorStream(true); //错误输出流合并到标准输出流中 @@ -224,17 +224,18 @@ public class CallPython { log.error("ffmpeg执行出错:{}",builder.toString()); return "0"; } - } else { - while ((line = reader.readLine()) != null) { + } +// else { +// while ((line = reader.readLine()) != null) { // builder.append(line); - } +// } // if (builder.length() != 0){ // log.info("ffmpeg返回信息:{}", builder.toString()); // } - } +// } //log.info(Thread.currentThread().getName()+"耗时:"+(System.currentTimeMillis()-startTime)); } catch (IOException | InterruptedException e) { - log.info("Error while running ffmpeg. {}",e.getMessage()); + log.error("Error while running ffmpeg. {}",e.getMessage()); return "0"; } finally { if (process != null) process.destroy(); diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java index 9e6b4b7..3bb2e4f 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java @@ -41,6 +41,17 @@ public interface TTSConstants { String AUTHORIZATION = "Bearer "; } + interface TENCENT_AUDIO_ID { + String APP_ID = "2159149523"; + String App_Key_WITH_PREFIX = "&app_key=lqpqxEo6p2xQSILQ"; + } + + interface TENCENT_PROFESSION_TTS_ID { + String APP_ID = "1304075838"; + String SECRET_ID = "AKIDjfMnytjxiFXa9UEs61hcIn4Zs0tc5ui0"; + String SECRET_KEY = "DqQkqcBWbU8oEPay96OSTEi1OVOegU0p"; + } + interface Audio { String XIAOAI = "XIAOAI"; String XIAODU = "XIAODU"; diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java index 4556a0b..981ba58 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java @@ -3,6 +3,7 @@ package ai.qiwu.com.tts_service.controller; import ai.qiwu.com.tts_service.common.*; import ai.qiwu.com.tts_service.pojo.*; import ai.qiwu.com.tts_service.pojo.upload.UploadOneSenData; +import ai.qiwu.com.tts_service.repository.SpeakerInfoRepository; import ai.qiwu.com.tts_service.service.*; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; @@ -61,6 +62,9 @@ public class TTSController { private final LieHuSchedule lieHuSchedule; + @Autowired + public SpeakerInfoRepository speakerInfoRepository; + // private final CdnService cdnService; @Autowired @@ -93,6 +97,32 @@ public class TTSController { return new SpeakersApiRes(Initialize.getPersonInfoOnline(), Initialize.getPersonInfoOffline()); } +// @GetMapping("/api/speakers/back") +// public Integer speakers_api_back() { +// String response = ApachHttpUtils.get("http://localhost:9664/api/speakers", null, null); +// TempSpeakersApi speakersApiRes = JSON.parseObject(response, TempSpeakersApi.class); +// TempPersonInfo personInfo; +// int count = 0; +//// for (Map.Entry entry: speakersApiRes.getOnline().entrySet()) { +//// personInfo = entry.getValue(); +//// for (String mood: personInfo.getMood()) { +//// speakerInfoRepository.updateName(personInfo.getName(), entry.getKey(), mood, personInfo.getSex()); +//// count++; +//// } +//// } +// String offline; +// for (Map.Entry entry: speakersApiRes.getOffline().entrySet()) { +// personInfo = entry.getValue(); +// offline = entry.getKey(); +// offline = offline.substring(0, offline.lastIndexOf("_")); +// for (String mood: personInfo.getMood()) { +// speakerInfoRepository.updateName(personInfo.getName(), offline, mood, personInfo.getSex()); +// count++; +// } +// } +// return count; +// } + /** * /api/tts 接口的get请求,根据信息返回文件或该文件的请求链接 * @param person 对应的人物代号 diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempPersonInfo.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempPersonInfo.java new file mode 100644 index 0000000..97a30f7 --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempPersonInfo.java @@ -0,0 +1,21 @@ +package ai.qiwu.com.tts_service.controller; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.List; + +/** + * painter + * 20-10-30 下午9:30 + */ +@Getter +@Setter +@ToString +public class TempPersonInfo { + private String name; + private String sex; + private List mood; + private Boolean third_party; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempSpeakersApi.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempSpeakersApi.java new file mode 100644 index 0000000..9592c52 --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TempSpeakersApi.java @@ -0,0 +1,19 @@ +package ai.qiwu.com.tts_service.controller; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.Map; + +/** + * painter + * 20-10-30 下午9:29 + */ +@Getter +@Setter +@ToString +public class TempSpeakersApi { + private Map online; + private Map offline; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/SpeakersApiRes.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/SpeakersApiRes.java index 5c01836..c574ff1 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/SpeakersApiRes.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/SpeakersApiRes.java @@ -21,4 +21,6 @@ public class SpeakersApiRes { this.online = online; this.offline = offline; } + + public SpeakersApiRes(){} } diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponse.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponse.java new file mode 100644 index 0000000..1a55f27 --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponse.java @@ -0,0 +1,18 @@ +package ai.qiwu.com.tts_service.pojo.third; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + +/** + * painter + * 20-10-30 下午2:37 + */ +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class TecentTTSResponse { + private Integer ret; + private String msg; + private TecentTTSResponseData data; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponseData.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponseData.java new file mode 100644 index 0000000..a03740f --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TecentTTSResponseData.java @@ -0,0 +1,19 @@ +package ai.qiwu.com.tts_service.pojo.third; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + +/** + * painter + * 20-10-30 下午2:38 + */ +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class TecentTTSResponseData { + private Integer format; + private String speech; + private String md5sum; + private String voice; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSData.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSData.java new file mode 100644 index 0000000..79d3457 --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSData.java @@ -0,0 +1,18 @@ +package ai.qiwu.com.tts_service.pojo.third; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * painter + * 20-10-30 下午7:29 + */ +@Getter +@Setter +@ToString +@JsonIgnoreProperties(ignoreUnknown = true) +public class TencentProTTSData { + private TencentProTTSResponse Response; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSResponse.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSResponse.java new file mode 100644 index 0000000..d862453 --- /dev/null +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/third/TencentProTTSResponse.java @@ -0,0 +1,20 @@ +package ai.qiwu.com.tts_service.pojo.third; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * painter + * 20-10-30 下午6:23 + */ +@Getter +@Setter +@ToString +@JsonIgnoreProperties(ignoreUnknown = true) +public class TencentProTTSResponse { + private String Audio; + private String RequestId; + private String SessionId; +} diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/repository/SpeakerInfoRepository.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/repository/SpeakerInfoRepository.java index e9f75aa..4a9c785 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/repository/SpeakerInfoRepository.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/repository/SpeakerInfoRepository.java @@ -2,7 +2,10 @@ package ai.qiwu.com.tts_service.repository; import ai.qiwu.com.tts_service.entity.SpeakersInfo; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import javax.transaction.Transactional; import java.util.List; /** @@ -12,4 +15,9 @@ import java.util.List; */ public interface SpeakerInfoRepository extends JpaRepository { List findByIsDelete(String isDelete); + + @Modifying + @Transactional + @Query(value = "UPDATE speakers_info SET name=?1 where person=?2 and mood=?3 and sex=?4", nativeQuery = true) + void updateName(String name, String person, String mood, String sex); } diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java index 5478560..352400a 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java @@ -148,6 +148,8 @@ public class Initialize implements InitializingBean { public static final String ZUUL_HOST; + public static Set tencentProEnglishPerson; + // private static final int XIAODU_TEXT_SIZE_LIMIT; // private static final int LIEHU_TEXT_SIZE_LIMIT; @@ -158,6 +160,7 @@ public class Initialize implements InitializingBean { * 静态代码块 */ static { + tencentProEnglishPerson = new HashSet<>(); URL_LS = new ArrayList<>(); THIRD_PARTY_TTS = new HashSet<>(); ONLINE_ID_2_URL = new HashMap<>(); @@ -207,6 +210,49 @@ public class Initialize implements InitializingBean { THIRD_PARTY_WITH_ITS_PER.put("Baidu6", "103"); //度米朵(童声) THIRD_PARTY_WITH_ITS_PER.put("Baidu7", "5"); //度小娇(情感女) THIRD_PARTY_WITH_ITS_PER.put("Liehu1", "1"); //猎户采采 + + THIRD_PARTY_WITH_ITS_PER.put("TencentAI1", "1"); //腾讯AI 中文男普通 + THIRD_PARTY_WITH_ITS_PER.put("TencentAI5", "5"); //腾讯AI 静琪 女 + THIRD_PARTY_WITH_ITS_PER.put("TencentAI6", "6"); //腾讯AI 欢馨 女 + THIRD_PARTY_WITH_ITS_PER.put("TencentAI7", "7"); //腾讯AI 碧萱 女 + + THIRD_PARTY_WITH_ITS_PER.put("ProTencent0", "0"); //云小宁 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent1", "1"); //云小奇 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent2", "2"); //云小晚 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent4", "4"); //云小叶 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent5", "5"); //云小欣 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent6", "6"); //云小龙 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent7", "7"); //云小曼 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent8", "1000"); //智侠 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent9", "1001"); //智瑜 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent10", "1002"); //智聆 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent11", "1003"); //智美 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent12", "1050"); //WeJack + THIRD_PARTY_WITH_ITS_PER.put("ProTencent13", "1051"); //WeRose + + THIRD_PARTY_WITH_ITS_PER.put("ProTencent14", "101000"); //智侠 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent15", "101001"); //智瑜 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent16", "101002"); //智聆 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent17", "101003"); //智美 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent18", "101004"); //智云 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent19", "101005"); //智莉 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent20", "101006"); //智言 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent21", "101007"); //智娜 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent22", "101008"); //智琪 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent23", "101009"); //智芸 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent24", "101010"); //智华 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent25", "101050"); //WeJack 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent26", "101051"); //WeRose 精品 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent27", "102000"); //贝蕾 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent28", "102001"); //贝果 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent29", "102002"); //贝紫 + THIRD_PARTY_WITH_ITS_PER.put("ProTencent30", "102003"); //贝雪 + + + tencentProEnglishPerson.add("101050"); + tencentProEnglishPerson.add("101051"); + tencentProEnglishPerson.add("1050"); + tencentProEnglishPerson.add("1051"); // THIRD_PARTY_WITH_ITS_PER.put("Liehu0", "0"); //猎户小雅 // THIRD_PARTY_WITH_ITS_PER.put("Liehu20", "20"); //猎户童音 } diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java index 03660dc..742b2a4 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTService.java @@ -25,6 +25,7 @@ import java.io.*; import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -33,7 +34,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; - +import java.util.stream.Collectors; /** @@ -2682,7 +2683,19 @@ public class TTService { public static void main(String[] args) throws UnsupportedEncodingException { // String command = "soxi /home/yf01/下载/audioCut/1.mp3"; // String response = CallPython.soxiGetAudioConfig(command); - String response = "Input File : '/home/yf01/下载/audioCut/1.mp3'Channels : 1Sample Rate : 16000Precision : 16-bitDuration : 00:00:01.12 = 17856 samples ~ 83.7 CDDA sectorsFile Size : 4.46kBit Rate : 32.0kSample Encoding: MPEG audio (layer I, II or III)"; - System.out.println(response); +// String response = "Input File : '/home/yf01/下载/audioCut/1.mp3'Channels : 1Sample Rate : 16000Precision : 16-bitDuration : 00:00:01.12 = 17856 samples ~ 83.7 CDDA sectorsFile Size : 4.46kBit Rate : 32.0kSample Encoding: MPEG audio (layer I, II or III)"; +// System.out.println(response); +// String text = "a^d\uD83C\uDD70ccc^\uD83C\uDD71^ \uD83C\uDD70b^bb\uD83C\uDD71weg^"; +// List splitList = new ArrayList<>(); +// String[] arr = text.split("\uD83C\uDD70"); +// for (String item: arr) { +// splitList.addAll(Arrays.asList(item.split("\uD83C\uDD71"))); +// } +// splitList = splitList.stream().filter(s -> StringUtils.isNotBlank(s.replaceAll("\\p{P}", ""))).collect(Collectors.toList()); +// System.out.println(splitList); +// System.out.println(TTSUtils.buildMP3Filename("厉害啊!这一般人还不一定知道呢。请问,忽如一夜{/ye4/}春风来,千树万树梨花开,这一句诗写的是哪个季节的景象呢")); + + System.out.println("厉害啊!".getBytes(StandardCharsets.UTF_8).length); + System.out.println("厉害啊".getBytes(StandardCharsets.UTF_8).length); } } diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTServiceEdition2.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTServiceEdition2.java index 8e51988..1eca577 100644 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTServiceEdition2.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/TTServiceEdition2.java @@ -1341,18 +1341,18 @@ public class TTServiceEdition2 { } public static void main(String[] args) { - final String text = "\uD83C\uDD70今天\uD83C\uDD71是第\uD83C\uDD706\uD83C\uDD71,\uD83C\uDD70文件\uD83C\uDD71天,音频\uD83C\uDD70出错\uD83C\uDD71@#"; - List splitList = new ArrayList<>(); - String[] arr = text.split("\uD83C\uDD70"); - for (String item: arr) { - splitList.addAll(Arrays.asList(item.split("\uD83C\uDD71"))); - } - System.out.println(splitList); - splitList = splitList.stream().filter(s -> StringUtils.isNotBlank(s.replaceAll("\\p{P}", ""))).collect(Collectors.toList()); - - System.out.println(splitList); +// final String text = "\uD83C\uDD70今天\uD83C\uDD71是第\uD83C\uDD706\uD83C\uDD71,\uD83C\uDD70文件\uD83C\uDD71天,音频\uD83C\uDD70出错\uD83C\uDD71@#"; +// List splitList = new ArrayList<>(); +// String[] arr = text.split("\uD83C\uDD70"); +// for (String item: arr) { +// splitList.addAll(Arrays.asList(item.split("\uD83C\uDD71"))); +// } +// System.out.println(splitList); +// splitList = splitList.stream().filter(s -> StringUtils.isNotBlank(s.replaceAll("\\p{P}", ""))).collect(Collectors.toList()); +// +// System.out.println(splitList); // System.out.println(TTSUtils.buildMP3Filename("今天是第")); // System.out.println(TTSUtils.buildMP3Filename("天")); -// System.out.println(TTSUtils.buildMP3Filename("6")); + System.out.println(TTSUtils.buildMP3Filename("{晴天}还是{阴天}")); } } diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/baidu/ThirdPartyService.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/baidu/ThirdPartyService.java index 80a0789..15b1fbd 100755 --- a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/baidu/ThirdPartyService.java +++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/baidu/ThirdPartyService.java @@ -1,24 +1,36 @@ package ai.qiwu.com.tts_service.service.baidu; -import ai.qiwu.com.tts_service.common.ErrorMsgEnum; -import ai.qiwu.com.tts_service.common.OkHttp3Utils; -import ai.qiwu.com.tts_service.common.TTSUtils; +import ai.qiwu.com.tts_service.common.*; import ai.qiwu.com.tts_service.common.pcm.Pcm2Wav; -import ai.qiwu.com.tts_service.common.TTSConstants; import ai.qiwu.com.tts_service.common.TTSConstants.BAI_DU; +import ai.qiwu.com.tts_service.pojo.third.TecentTTSResponse; +import ai.qiwu.com.tts_service.pojo.third.TencentProTTSData; import ai.qiwu.com.tts_service.service.Initialize; import ai.qiwu.com.tts_service.service.LieHuSchedule; import ai.qiwu.com.tts_service.service.TTService; import com.alibaba.fastjson.JSON; import com.baidu.aip.speech.AipSpeech; import com.baidu.aip.speech.TtsResponse; +import com.tencentcloudapi.aai.v20180522.models.TextToVoiceResponse; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import com.tencentcloudapi.tts.v20190823.TtsClient; +import com.tencentcloudapi.tts.v20190823.models.TextToVoiceRequest; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.util.DigestUtils; import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.Instant; import java.util.*; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * 第三方请求实现 @@ -32,6 +44,19 @@ public class ThirdPartyService { */ private static final AipSpeech CLIENT = new AipSpeech(BAI_DU.APP_ID, BAI_DU.API_KEY, BAI_DU.SECRET_KEY); + + private static final TtsClient TTS_CLIENT; + static { + Credential CREDENTIAL = new Credential(TTSConstants.TENCENT_PROFESSION_TTS_ID.SECRET_ID, TTSConstants.TENCENT_PROFESSION_TTS_ID.SECRET_KEY); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("tts.tencentcloudapi.com"); + + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + + TTS_CLIENT = new TtsClient(CREDENTIAL, "ap-guangzhou", clientProfile); + } + /** * 区分是百度的还是小雅的 * @param text 文本 @@ -41,17 +66,154 @@ public class ThirdPartyService { * @return 结果 */ public static boolean thirdPartyCall(String text, String per, String filepath, String person) { - person = getThirdPartyName(person); - if ("Baidu".equals(person)) { -// if (text.length() > Initialize.XIAODU_TEXT_SIZE_LIMIT) { -// ArrayDeque deque = TTSUtils.splitLongText(Initialize.XIAODU_TEXT_SIZE_LIMIT, text); -// -// } - return synthesis(text, Integer.parseInt(per), filepath); - }else if ("Liehu".equals(person)) { - return lieHuTTS(text, per, filepath); +// person = getThirdPartyName(person); + person = person.substring(0, 5); + switch (person) { + case "Baidu" : { + return synthesis(text, Integer.parseInt(per), filepath); + } + case "Liehu" : { + return lieHuTTS(text, per, filepath); + } + case "ProTe": { + return tecentTTS(per, text, filepath); + } + case "Tence" : { + return tecentAITTS(per, text, filepath); + } + case "TencentYOU" : { + return tecentYouTTS(per, text, filepath); + } + default : { + log.error("不支持该第三方平台:{}", person); + return false; + } + } +// if ("Baidu".equals(person)) { +//// if (text.length() > Initialize.XIAODU_TEXT_SIZE_LIMIT) { +//// ArrayDeque deque = TTSUtils.splitLongText(Initialize.XIAODU_TEXT_SIZE_LIMIT, text); +//// +//// } +// return synthesis(text, Integer.parseInt(per), filepath); +// }else if ("Liehu".equals(person)) { +// return lieHuTTS(text, per, filepath); +// } else { +// log.info("不支持该第三方平台:{}", person); +// } +// return false; + } + + private static boolean tecentTTS(String per, String text, String filepath) { + try{ + TextToVoiceRequest req = new TextToVoiceRequest(); + req.setModelType(1L); + req.setSessionId(UUID.randomUUID().toString()); + req.setText(text); + req.setVoiceType(Long.parseLong(per)); + req.setPrimaryLanguage(Initialize.tencentProEnglishPerson.contains(per)?2L:1L); + String res = TTS_CLIENT.call("TextToVoice", TextToVoiceResponse.toJsonString(req)); + TencentProTTSData response = JSON.parseObject(res, TencentProTTSData.class); + try (FileOutputStream output = new FileOutputStream(new File(filepath))){ + output.write(Base64.getDecoder().decode(response.getResponse().getAudio().getBytes(StandardCharsets.UTF_8))); + return true; + } catch (Exception e) { + log.error("写入腾讯tts wav数据信息失败:{}, text:{}, res:{}", e, text, res); + } + } catch (Exception e) { + System.out.println(e.toString()); + } + return false; + } + + private static boolean tecentAITTS(String per, String text, String filepath) { + TreeMap params = new TreeMap<>(); + params.put("app_id", TTSConstants.TENCENT_AUDIO_ID.APP_ID); + long secondStamp; + params.put("time_stamp", String.valueOf((secondStamp=Instant.now().getEpochSecond()))); + params.put("nonce_str", secondStamp+RandomStringUtils.random(7, true, true)); + params.put("speaker", per); + params.put("format", "2"); + params.put("volume", "0"); + params.put("speed", "100"); + params.put("aht", "0"); + params.put("apc", "58"); + params.put("text", text); + String sign = params.entrySet().stream().map(entry -> { + try { + return entry.getKey()+"="+ URLEncoder.encode(entry.getValue(), "UTF-8"); + } catch (Exception e) { + return null; + } + }).collect(Collectors.joining("&")); + sign += TTSConstants.TENCENT_AUDIO_ID.App_Key_WITH_PREFIX; + params.put("sign", StringUtils.upperCase(DigestUtils.md5DigestAsHex(sign.getBytes(StandardCharsets.UTF_8)))); + String result = ApachHttpUtils.get("https://api.ai.qq.com/fcgi-bin/aai/aai_tts", null, params); + if (StringUtils.isBlank(result)) { + log.error("请求腾讯AI tts出错,结果为空:"+text); + } else { + TecentTTSResponse response = JSON.parseObject(result, TecentTTSResponse.class); + if (NumberUtils.INTEGER_ZERO.equals(response.getRet())) { + try (FileOutputStream output = new FileOutputStream(new File(filepath))){ + output.write(Base64.getDecoder().decode(response.getData().getSpeech().getBytes(StandardCharsets.UTF_8))); + return true; + } catch (Exception e) { + log.error("写入腾讯AI tts wav数据信息失败:{}, text:{}", e, text); + } + } else { + // https://ai.qq.com/doc/returncode.shtml + log.error("请求腾讯AI tts 不成功:"+result); + } + } + return false; + } + + private static boolean tecentYouTTS(String per, String text, String filepath) { + TreeMap params = new TreeMap<>(); + params.put("app_id", TTSConstants.TENCENT_AUDIO_ID.APP_ID); + long secondStamp; + params.put("time_stamp", String.valueOf((secondStamp=Instant.now().getEpochSecond()))); + params.put("nonce_str", secondStamp+RandomStringUtils.random(7, true, true)); + params.put("model_type", per); + params.put("speed", "0"); + params.put("text", text); + + String sign = params.entrySet().stream().map(entry -> { + try { + return entry.getKey()+"="+ URLEncoder.encode(entry.getValue(), "UTF-8"); + } catch (Exception e) { + return null; + } + }).collect(Collectors.joining("&")); + sign += TTSConstants.TENCENT_AUDIO_ID.App_Key_WITH_PREFIX; + params.put("sign", StringUtils.upperCase(DigestUtils.md5DigestAsHex(sign.getBytes(StandardCharsets.UTF_8)))); + String result = ApachHttpUtils.get("https://api.ai.qq.com/fcgi-bin/aai/aai_tta", null, params); + if (StringUtils.isBlank(result)) { + log.error("请求腾讯优图出错,结果为空:"+text); } else { - log.info("不支持该第三方平台:{}", person); + TecentTTSResponse response = JSON.parseObject(result, TecentTTSResponse.class); + if (NumberUtils.INTEGER_ZERO.equals(response.getRet())) { + String tempMp3Path = filepath.substring(0, filepath.lastIndexOf(".")+1)+".mp3"; + try (FileOutputStream output = new FileOutputStream(new File(tempMp3Path))){ + output.write(Base64.getDecoder().decode(response.getData().getVoice().getBytes(StandardCharsets.UTF_8))); + output.flush(); + } catch (Exception e) { + log.error("写入腾讯优 mp3数据信息失败:{}, text:{}", e, text); + return false; + } + + try { + String changeResult = CallPython.ffmpegExecute("ffmpeg -i "+ tempMp3Path +" -f wav " + filepath); + if ("0".equals(changeResult)) { +// Files.deleteIfExists(Paths.get(tempMp3Path)); + } + } catch (Exception e) { + log.error("转换腾讯优图mp3文件失败:text:{}, error:{}", text, e); + } + return true; + } else { + // https://ai.qq.com/doc/returncode.shtml + log.error("请求腾讯优图 不成功:"+result); + } } return false; } @@ -139,7 +301,7 @@ public class ThirdPartyService { // headers.put("Content-Type", "application/json"); HashMap params = new HashMap<>(); params.put("tex", text); - params.put("sn", new StringBuilder(RandomStringUtils.randomAlphabetic(5)).append(System.currentTimeMillis()).toString()); + params.put("sn", RandomStringUtils.randomAlphabetic(5) + System.currentTimeMillis()); params.put("pdt", TTSConstants.LIE_HU.PDT); params.put("per", per); params.put("aue", "4"); @@ -191,6 +353,8 @@ public class ThirdPartyService { } public static void main(String[] args) { - synthesis("佳人微醺,现在的她充满活力,要夸夸她吗?", 106, "/home/yf01/testttt.wav"); +// synthesis("佳人微醺,现在的她充满活力,要夸夸她吗?", 106, "/home/yf01/testttt.wav");\ +// System.out.println(tecentYouTTS("2", "今天是个好天气", "/home/yf01/下载/audioCut/tecentYou01.wav")); +// System.out.println(tecentTTS("5", "今天天气", "/home/yf01/下载/audioCut/tecentPro01.wav")); } } diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java index 6999c4e..b904ff5 100755 --- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java +++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java @@ -37,12 +37,12 @@ import java.util.concurrent.TimeUnit; @Slf4j public class XiaoDuHomeController { - public static volatile String WELCOME_NOVEL = "欢迎来到晓悟智能小说。向您推荐新上线的野蛮女友,您可以说打开野蛮女友。或者说,推荐其它作品。"; + public static volatile String WELCOME_NOVEL = "欢迎来到晓悟智能小说。向您推荐新上线的妖刀异闻录,您可以说打开妖刀异闻录。或者说,推荐其它作品。"; - public static volatile String WELCOME_SMART = "欢迎来到晓悟智能故事。我们新上线了遇见伽利略,你可以说打开遇见伽利略。或者说,推荐其它作品。"; + public static volatile String WELCOME_SMART = "欢迎来到晓悟智能故事。我们新上线了魔法世界大冒险,你可以说打开魔法世界大冒险。或者说,推荐其它作品。"; -// public static volatile String WELCOME_FORMAT = "欢迎来到交游天下。与剧情人物自由对话,带您体验不同的人生和情怀。向您推荐新上线的%s,您可以说打开%s。或者说,推荐其它作品。"; - public static volatile String WELCOME_FORMAT = "欢迎来到交游天下。与剧情人物自由对话,带您体验不同的人生和情怀。向您推荐新上线的野蛮女友,您可以说打开野蛮女友。或者说,推荐其它作品。"; + public static volatile String WELCOME_FORMAT = "欢迎来到交游天下。与剧情人物自由对话,带您体验不同的人生和情怀。向您推荐新上线的%s,您可以说打开%s。或者说,推荐其它作品。"; +// public static volatile String WELCOME_FORMAT = "欢迎来到交游天下。与剧情人物自由对话,带您体验不同的人生和情怀。向您推荐新上线的野蛮女友,您可以说打开野蛮女友。或者说,推荐其它作品。"; private int test = 0; @@ -81,16 +81,16 @@ public class XiaoDuHomeController { HttpServletRequest request = null; try { //log.info("--------------分界线-------------------"); -// DplBotServiceBoth service = new DplBotServiceBoth((request=Utils.getHttpServletRequest()), 5, stringRedisTemplate); - Dpl2Service service = new Dpl2Service((request=Utils.getHttpServletRequest()), stringRedisTemplate); - log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes()); - log.info(service.getStrRequest()); + DplBotServiceBoth service = new DplBotServiceBoth((request=Utils.getHttpServletRequest()), 5, stringRedisTemplate); +// Dpl2Service service = new Dpl2Service((request=Utils.getHttpServletRequest()), stringRedisTemplate); +// log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes()); +// log.info(service.getStrRequest()); //service.disableVerify(); service.enableVerify(); - String str = service.run(); - log.info("响应信息:{}", str); - return str; -// return service.run(); +// String str = service.run(); +// log.info("响应信息:{}", str); +// return str; + return service.run(); } catch (MismatchedInputException ex) { log.info("交游探活:"+ ExceptionUtils.getStackTrace(ex)); if (test++ < 5) { diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java index 3cc7c3e..691c573 100644 --- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java +++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java @@ -117,7 +117,7 @@ public class DplBotServiceBoth extends BaseBot { //privateKey为私钥内容,0代表你的Bot在DBP平台debug环境,1或者其他整数代表online环境, // botMonitor对象已经在bot-sdk里初始化,可以直接调用 this.botMonitor.setEnvironmentInfo(PRIVATE_KEY, 1); -// this.botMonitor.setMonitorEnabled(true); + this.botMonitor.setMonitorEnabled(true); } @Override diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java index 0b42eec..a5c5cf5 100644 --- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java +++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java @@ -235,9 +235,15 @@ public class ScheduleServiceNew implements InitializingBean { Map> map = jsonObject.toJavaObject(Map.class); if (map != null && map.size() != 0) { List jiaoyouList = map.get("jiaoyou-audio-adult-test"); - if (!CollectionUtils.isEmpty(jiaoyouList)) map.get("jiaoyou-audio-adult-test").add("遇见伽利略"); + if (!CollectionUtils.isEmpty(jiaoyouList)) { + jiaoyouList.add("遇见伽利略"); + jiaoyouList.add("魔法世界大冒险"); + } List xiaoaiJiaoyouList = map.get("xiaoai-jiaoyou-audio-adult-test"); - if (!CollectionUtils.isEmpty(xiaoaiJiaoyouList)) map.get("xiaoai-jiaoyou-audio-adult-test").add("遇见伽利略"); + if (!CollectionUtils.isEmpty(xiaoaiJiaoyouList)) { + xiaoaiJiaoyouList.add("遇见伽利略"); + xiaoaiJiaoyouList.add("魔法世界大冒险"); + } jiaoyouChannel2Bots = map; success = true; } else { diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java index acfb846..0c5ce1b 100644 --- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java +++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiServiceRedis.java @@ -389,9 +389,9 @@ public class XiaoAiServiceRedis { } String response; try { - log.info("==================\n小爱,用户话:{}, userId:{}", userWord, userId); +// log.info("==================\n小爱,用户话:{}, userId:{}", userWord, userId); response = RequestTerminal.requestTerminate(userId, userWord, type, baseUrl); - log.info("小爱,小悟返回:{}", response); +// log.info("小爱,小悟返回:{}", response); } catch (Exception e) { log.error("向终端发出的请求信息失败:{}", e.toString()); return buildTextResponse(SORRY_REPEAT); @@ -464,7 +464,7 @@ public class XiaoAiServiceRedis { botAccount = "empty"; } xiaoAiResponse = buildAudioResponse((path = changeAudioUrlTemp(path, botAccount, cdnUrl))); - log.info("音频地址:"+path); +// log.info("音频地址:"+path); if (Boolean.TRUE.equals(stringRedisTemplate.opsForValue() .setIfPresent(SpiritRedisService.PREFIX_REDIS+userId, path, 15, TimeUnit.SECONDS))) { log.info("xiaoai 超时redis存储成功"); -- libgit2 0.27.1