|
|
@@ -791,10 +791,12 @@ public class RobotChat extends RobotBase {
|
|
|
|
|
|
|
|
|
logger.info("{} send question to chatRobot: {}", getTraceId(), question);
|
|
|
+ chatRobot.resetRoundTtsPlaybackState();
|
|
|
aiphoneRes = chatRobot.talkWithAiAgent(question, kbQueryExecuted);
|
|
|
while ((aiphoneRes == null || aiphoneRes.getStatus_code() == 0)
|
|
|
&& Llm_max_try_counter.get() < LLM_MAX_TRY) {
|
|
|
logger.error("{} llm api error, retry to send question to chatRobot: {}", getTraceId(), question);
|
|
|
+ chatRobot.resetRoundTtsPlaybackState();
|
|
|
aiphoneRes = chatRobot.talkWithAiAgent(question, kbQueryExecuted);
|
|
|
Llm_max_try_counter.incrementAndGet();
|
|
|
if (checkCallSession()) {
|
|
|
@@ -859,6 +861,7 @@ public class RobotChat extends RobotBase {
|
|
|
interactWithRobot();
|
|
|
return;
|
|
|
}
|
|
|
+ aiphoneRes.setBody(body);
|
|
|
}
|
|
|
|
|
|
if (checkCallSession()) {
|
|
|
@@ -866,11 +869,19 @@ public class RobotChat extends RobotBase {
|
|
|
}
|
|
|
|
|
|
if (aiphoneRes.getTransferToAgent() == 1) {
|
|
|
+ if (shouldKeepAiConversationDuringTransferWait() && transferToAgentExecuted) {
|
|
|
+ logger.info("{} duplicate transfer-to-agent instruction detected during manual-wait, keep current transfer task and continue reply body={}.",
|
|
|
+ getTraceId(),
|
|
|
+ aiphoneRes.getBody()
|
|
|
+ );
|
|
|
+ aiphoneRes.setTransferToAgent(0);
|
|
|
+ } else {
|
|
|
if(!setTransferState()){
|
|
|
return;
|
|
|
}
|
|
|
doTransferToManualAgent(aiphoneRes);
|
|
|
return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (aiphoneRes.getClose_phone() == 1) {
|
|
|
@@ -941,11 +952,8 @@ public class RobotChat extends RobotBase {
|
|
|
|
|
|
private void playResponse(LlmAiphoneRes aiphoneRes){
|
|
|
String ttsFilePathList = aiphoneRes.getTtsFilePathList();
|
|
|
- if (useXfyunCloneFilePlayback()
|
|
|
- && talkRound.longValue() == 1
|
|
|
- && StringUtils.isEmpty(ttsFilePathList)
|
|
|
- && StringUtils.isNotEmpty(aiphoneRes.getBody())) {
|
|
|
- logger.info("{} skip duplicate first-round xfyun clone playback, text={}.",
|
|
|
+ if (useXfyunCloneFilePlayback() && chatRobot.consumeDirectTtsPlaybackFlag()) {
|
|
|
+ logger.info("{} skip xfyun clone file playback because response already streamed directly, text={}.",
|
|
|
getTraceId(),
|
|
|
aiphoneRes.getBody()
|
|
|
);
|