Commit 0fcd792a by hxw

解决智能助手切换的bug

parent 5d581c32
...@@ -84,7 +84,7 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -84,7 +84,7 @@ public class CharacterConstructor extends ElementConstructor {
for (String conditionName : relateConditions) { for (String conditionName : relateConditions) {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + keywords, " ", conditionName + "::match-Include=" + keywords, " ",
"match,return-0", "【{智能助手-2}】{NPC_query-2}", "yaobuyao", "NPC_query:queryAttrByNPCName:" + conditionName "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{NPC_query-2}", "yaobuyao", "NPC_query:queryAttrByNPCName:" + conditionName
); );
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
jConfigList.add(jConfig); jConfigList.add(jConfig);
...@@ -98,7 +98,7 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -98,7 +98,7 @@ public class CharacterConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + classKeywords, " ", conditionName + "::match-Include=" + classKeywords, " ",
"match,return-0", "【{智能助手-2}】{NPC_query-2}", "yaobuyao", "NPC_query:queryAroundNpcByClassName:" + conditionName "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{NPC_query-2}", "yaobuyao", "NPC_query:queryAroundNpcByClassName:" + conditionName
); );
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
jConfigList.add(jConfig); jConfigList.add(jConfig);
......
...@@ -37,11 +37,13 @@ public class GlobalVariableConstructor extends ElementConstructor { ...@@ -37,11 +37,13 @@ public class GlobalVariableConstructor extends ElementConstructor {
while (attrIter.hasNext()) { while (attrIter.hasNext()) {
attrName = attrIter.next(); attrName = attrIter.next();
attrValue = attribute.get(attrName); attrValue = attribute.get(attrName);
varInitialMap.put(attrName, attrValue); varInitialMap.put("globalVariable_" + category + "_" + attrName, attrValue);
} }
} }
varInitialMap.put("botType", "game"); varInitialMap.put("botType", "game");
varInitialMap.put("unknownTextList", (String)gameElements.get("unknownTextList"));
varInitialMap.put("finalUnknownText", (String)gameElements.get("finalUnknownText"));
JSONObject script = gameElements.getJSONObject("speechcraft"); JSONObject script = gameElements.getJSONObject("speechcraft");
......
...@@ -82,7 +82,7 @@ public class ItemConstructor extends ElementConstructor { ...@@ -82,7 +82,7 @@ public class ItemConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + keywords, " ", conditionName + "::match-Include=" + keywords, " ",
"match,return-0", "match,return-0",
"【{智能助手-2}】{goods_query-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】" +"{goods_query-2}",
" ", " ",
"goods_query:queryAttrByGoodsName:" + conditionName "goods_query:queryAttrByGoodsName:" + conditionName
); );
...@@ -95,7 +95,7 @@ public class ItemConstructor extends ElementConstructor { ...@@ -95,7 +95,7 @@ public class ItemConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + classKeywords, " ", conditionName + "::match-Include=" + classKeywords, " ",
"match,return-0", "match,return-0",
"【{智能助手-2}】{goods_query-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】" +"{goods_query-2}",
" ", " ",
"goods_query:queryAroundGoodsByClassName:" + conditionName "goods_query:queryAroundGoodsByClassName:" + conditionName
); );
......
...@@ -169,7 +169,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -169,7 +169,7 @@ public class MapConstructor extends ElementConstructor {
String conditionKeywords = nickname + ":哪里+" + nickname + ":哪+现在:哪里+现在:哪"; String conditionKeywords = nickname + ":哪里+" + nickname + ":哪+现在:哪里+现在:哪";
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match", "【{智能助手-2}】" + String.format(script.get("WHERE_I_AM"), "{site-2}"), "yaobuyao", "" "match", "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("WHERE_I_AM"), "{site-2}"), "yaobuyao", ""
); );
jConfig.setNextStepStatus("return-0"); jConfig.setNextStepStatus("return-0");
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
...@@ -211,7 +211,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -211,7 +211,7 @@ public class MapConstructor extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=0", + ",isNeighbour:"+ conditionName + "::match-Include=0",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_AT"), "{site-2}"), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_AT"), "{site-2}"),
" ", " ",
"" ""
); );
...@@ -228,7 +228,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -228,7 +228,7 @@ public class MapConstructor extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=1", + ",isNeighbour:"+ conditionName + "::match-Include=1",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_ADJOINT"), "{site-2}"), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_ADJOINT"), "{site-2}"),
" ", " ",
"" ""
); );
...@@ -244,7 +244,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -244,7 +244,7 @@ public class MapConstructor extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=2", + ",isNeighbour:"+ conditionName + "::match-Include=2",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】{map_reply-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】"+"{map_reply-2}",
" ", " ",
"map_reply:queryHowToPathBySite:" + conditionName "map_reply:queryHowToPathBySite:" + conditionName
); );
...@@ -279,7 +279,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -279,7 +279,7 @@ public class MapConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, "site::match-Include=" + placeA, conditionName + "::match-Include=" + conditionKeywords, "site::match-Include=" + placeA,
"match,return-0", "【{智能助手-2}】{map_reply-2}", " ", "map_reply:queryCanGoBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】"+"{map_reply-2}", " ", "map_reply:queryCanGoBySite:"
); );
jConfig.setNextStepStatus("return-0"); jConfig.setNextStepStatus("return-0");
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
...@@ -328,7 +328,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -328,7 +328,7 @@ public class MapConstructor extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=0", + ",isNeighbour:"+ conditionName + "::match-Include=0",
"site::match-Include=" + placeA , "site::match-Include=" + placeA ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_AT"), placeBMain), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_AT"), placeBMain),
" ", " ",
"" ""
); );
...@@ -353,7 +353,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -353,7 +353,7 @@ public class MapConstructor extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=2", + ",isNeighbour:"+ conditionName + "::match-Include=2",
"site::match-Include=" + placeA , "site::match-Include=" + placeA ,
"match,return-0", "match,return-0",
"【{智能助手-2}】{map_reply-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】"+"{map_reply-2}",
" ", " ",
"map_reply:queryToDoPathBySite:" + conditionName "map_reply:queryToDoPathBySite:" + conditionName
); );
...@@ -371,7 +371,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -371,7 +371,7 @@ public class MapConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundNpcBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundNpcBySite:"
); );
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
jConfigList.add(jConfig); jConfigList.add(jConfig);
...@@ -384,7 +384,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -384,7 +384,7 @@ public class MapConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundGoodsBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundGoodsBySite:"
); );
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
jConfigList.add(jConfig); jConfigList.add(jConfig);
...@@ -398,7 +398,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -398,7 +398,7 @@ public class MapConstructor extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundAllBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundAllBySite:"
); );
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
jConfigList.add(jConfig); jConfigList.add(jConfig);
......
...@@ -172,7 +172,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -172,7 +172,7 @@ public class MapConstructor2 extends ElementConstructor {
String conditionKeywords = nickname + ":哪里+" + nickname + ":哪+现在:哪里+现在:哪"; String conditionKeywords = nickname + ":哪里+" + nickname + ":哪+现在:哪里+现在:哪";
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match", "【{智能助手-2}】" + String.format(script.get("WHERE_I_AM"), "{site-2}") , "yaobuyao", "" "match", "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("WHERE_I_AM"), "{site-2}") , "yaobuyao", ""
); );
jConfig.setNextStepStatus("return-0"); jConfig.setNextStepStatus("return-0");
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
...@@ -213,7 +213,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -213,7 +213,7 @@ public class MapConstructor2 extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=0", + ",isNeighbour:"+ conditionName + "::match-Include=0",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_AT"), "{site-2}"), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_AT"), "{site-2}"),
" ", " ",
"" ""
); );
...@@ -230,7 +230,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -230,7 +230,7 @@ public class MapConstructor2 extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=1", + ",isNeighbour:"+ conditionName + "::match-Include=1",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_ADJOINT"), "{site-2}"), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_ADJOINT"), "{site-2}"),
" ", " ",
"" ""
); );
...@@ -246,7 +246,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -246,7 +246,7 @@ public class MapConstructor2 extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=2", + ",isNeighbour:"+ conditionName + "::match-Include=2",
"site::match-Include=" + placeB , "site::match-Include=" + placeB ,
"match,return-0", "match,return-0",
"【{智能助手-2}】{map_reply-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_reply-2}",
" ", " ",
"map_reply:queryHowToPathBySite:" + conditionName "map_reply:queryHowToPathBySite:" + conditionName
); );
...@@ -281,7 +281,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -281,7 +281,7 @@ public class MapConstructor2 extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, "site::match-Include=" + placeA, conditionName + "::match-Include=" + conditionKeywords, "site::match-Include=" + placeA,
"match,return-0", "【{智能助手-2}】{map_reply-2}", " ", "map_reply:queryCanGoBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_reply-2}", " ", "map_reply:queryCanGoBySite:"
); );
jConfig.setNextStepStatus("return-0"); jConfig.setNextStepStatus("return-0");
jConfig.setAuxiliaryPriority("1"); jConfig.setAuxiliaryPriority("1");
...@@ -330,7 +330,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -330,7 +330,7 @@ public class MapConstructor2 extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=0", + ",isNeighbour:"+ conditionName + "::match-Include=0",
"site::match-Include=" + placeA , "site::match-Include=" + placeA ,
"match,return-0", "match,return-0",
"【{智能助手-2}】" + String.format(script.get("PATH_AT"), placeBMain), "【{" + PlotConstructor.ASSISTANT + "-2}】" + String.format(script.get("PATH_AT"), placeBMain),
" ", " ",
"" ""
); );
...@@ -352,6 +352,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -352,6 +352,7 @@ public class MapConstructor2 extends ElementConstructor {
//上一个配置文件激活时的默认选项 //上一个配置文件激活时的默认选项
jConfig = new JConfig( jConfig = new JConfig(
" ", " ", "", "{" + lastTaskReply + "-2}" ," ", "process-nextStep:var={" + lastTaskCondition +"-2}-<-site:" + placeBMain " ", " ", "", "{" + lastTaskReply + "-2}" ," ", "process-nextStep:var={" + lastTaskCondition +"-2}-<-site:" + placeBMain
+ "-<-npc_update:updateFollowerLocation:"+ placeBMain
); );
jConfig.setStatus("sleeping"); jConfig.setStatus("sleeping");
jConfig.setConfigName("plot_"+placeBMain + "_doudi",false); jConfig.setConfigName("plot_"+placeBMain + "_doudi",false);
...@@ -365,7 +366,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -365,7 +366,7 @@ public class MapConstructor2 extends ElementConstructor {
+ ",isNeighbour:"+ conditionName + "::match-Include=2", + ",isNeighbour:"+ conditionName + "::match-Include=2",
"site::match-Include=" + placeA , "site::match-Include=" + placeA ,
"match,return-0", "match,return-0",
"【{智能助手-2}】{map_reply-2}", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_reply-2}",
" ", " ",
"map_reply:queryToDoPathBySite:" + conditionName "map_reply:queryToDoPathBySite:" + conditionName
); );
...@@ -383,7 +384,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -383,7 +384,7 @@ public class MapConstructor2 extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundNpcBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundNpcBySite:"
); );
JConfig.activateCopy(jConfig, jConfigList); JConfig.activateCopy(jConfig, jConfigList);
...@@ -395,7 +396,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -395,7 +396,7 @@ public class MapConstructor2 extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundGoodsBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundGoodsBySite:"
); );
JConfig.activateCopy(jConfig, jConfigList); JConfig.activateCopy(jConfig, jConfigList);
...@@ -408,7 +409,7 @@ public class MapConstructor2 extends ElementConstructor { ...@@ -408,7 +409,7 @@ public class MapConstructor2 extends ElementConstructor {
jConfig = new JConfig( jConfig = new JConfig(
conditionName + "::match-Include=" + conditionKeywords, " ", conditionName + "::match-Include=" + conditionKeywords, " ",
"match,return-0", "【{智能助手-2}】{map_query-2}。", "yaobuyao", "map_query:queryAroundAllBySite:" "match,return-0", "【{" + PlotConstructor.ASSISTANT + "-2}】" + "{map_query-2}。", "yaobuyao", "map_query:queryAroundAllBySite:"
); );
JConfig.activateCopy(jConfig, jConfigList); JConfig.activateCopy(jConfig, jConfigList);
......
...@@ -5,15 +5,19 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,15 +5,19 @@ import com.alibaba.fastjson.JSONObject;
import com.qiwu.chatbotbackend.db.SqlHelper; import com.qiwu.chatbotbackend.db.SqlHelper;
import com.qiwu.chatbotbackend.entity.JConfig; import com.qiwu.chatbotbackend.entity.JConfig;
import com.qiwu.chatbotbackend.entity.UserInfo; import com.qiwu.chatbotbackend.entity.UserInfo;
import com.qiwu.chatbotbackend.processing.FormsPoster;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import com.qiwu.chatbotbackend.processing.MyFunc; import com.qiwu.chatbotbackend.processing.MyFunc;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.*; import java.util.*;
import static com.qiwu.chatbotbackend.processing.FormsPoster.QA_URL;
public class PlotConstructor extends ElementConstructor { public class PlotConstructor extends ElementConstructor {
public static String ASSISTANT = "globalVariable_默认_智能助手";
String GAME_STEP_FORMAT = "%s_plot_%s"; String GAME_STEP_FORMAT = "%s_plot_%s";
JSONArray plots = null; JSONArray plots = null;
...@@ -304,7 +308,7 @@ public class PlotConstructor extends ElementConstructor { ...@@ -304,7 +308,7 @@ public class PlotConstructor extends ElementConstructor {
+ "," + nextId + "::number-BiggerOrEqual=" + 1, + "," + nextId + "::number-BiggerOrEqual=" + 1,
"match", (String)branchNode.get("reply"), (String) nextCondition, "match", (String)branchNode.get("reply"), (String) nextCondition,
"-<-game_step:" + String.format(GAME_STEP_FORMAT, botAccount, nextId) "-<-game_step:" + String.format(GAME_STEP_FORMAT, botAccount, nextId)
+ "-<-unknownText:" + nextUnknownText + "-<-site:" + nextLocation + "-<-unknownText:" + nextUnknownText + "-<-site:" + nextLocation + "-<-npc_update:updateFollowerLocation:"+ nextLocation
); );
jConfig.setStatus("sleeping"); jConfig.setStatus("sleeping");
jConfig.setConfigName("plot_" + nextLocation + "_" + id,false); jConfig.setConfigName("plot_" + nextLocation + "_" + id,false);
...@@ -312,6 +316,11 @@ public class PlotConstructor extends ElementConstructor { ...@@ -312,6 +316,11 @@ public class PlotConstructor extends ElementConstructor {
jConfigList.add(jConfig); jConfigList.add(jConfig);
//如果当前剧情所在地喝下一步剧情所在地不一样,那么unknown文本
//只有到达下一步剧情所在地时才会更新
updateKnowledge.remove("unknownText");
//必须在上一个jConfig添加完之后 //必须在上一个jConfig添加完之后
//extraUK = extraUK.replace("-<-" + nextId + ":" + "+1", ""); //extraUK = extraUK.replace("-<-" + nextId + ":" + "+1", "");
...@@ -332,7 +341,7 @@ public class PlotConstructor extends ElementConstructor { ...@@ -332,7 +341,7 @@ public class PlotConstructor extends ElementConstructor {
//没有当前条件的限制, //没有当前条件的限制,
if (curPremiseList.size() == 0){ if (curPremiseList.size() == 0){
jConfig.setFeature(jConfig.getFeature() + ",activate,post::gameQA(http://simqa.sz.chewrobot.com:28081/game)"); jConfig.setFeature(jConfig.getFeature() + ",activate,post::gameQA(" + QA_URL + ")");
jConfig.setNextStep("queryskip*,map*"); jConfig.setNextStep("queryskip*,map*");
jConfig.setUpdateKnowledge(jConfig.getUpdateKnowledge() + "-<-临时变量condition:"+ nextCondition +"-<-临时变量reply:var={reply-3}"); jConfig.setUpdateKnowledge(jConfig.getUpdateKnowledge() + "-<-临时变量condition:"+ nextCondition +"-<-临时变量reply:var={reply-3}");
jConfig.setNextStepStatus("active"); jConfig.setNextStepStatus("active");
...@@ -368,17 +377,17 @@ public class PlotConstructor extends ElementConstructor { ...@@ -368,17 +377,17 @@ public class PlotConstructor extends ElementConstructor {
//对于unknown的特殊处理 //对于unknown的特殊处理
//对于unknown的特殊处理 //对于unknown的特殊处理
if (curUnknownText.equals("")) { // if (curUnknownText.equals("")) {
jConfig = new JConfig( // jConfig = new JConfig(
conditionName + "::match-Include=unknown", // conditionName + "::match-Include=unknown",
"任务线_" + location + "进度::match-Include=" + parentId, // "任务线_" + location + "进度::match-Include=" + parentId,
"match,return-0,post::gameQA(" + CHITCHAT_URL + ")", // "match,return-0,post::gameQA(" + CHITCHAT_URL + ")",
" ", // " ",
" ", // " ",
"" // ""
); // );
jConfigList.add(jConfig); // jConfigList.add(jConfig);
} // }
} }
...@@ -497,7 +506,7 @@ public class PlotConstructor extends ElementConstructor { ...@@ -497,7 +506,7 @@ public class PlotConstructor extends ElementConstructor {
@Override @Override
public void postProcessing(List<Integer> idList, int categoryId){ public void postProcessing(List<Integer> idList, int categoryId){
if (idList.size() != 0) { if (idList.size() != 0) {
jConfig = new JConfig(" ", " ", "activate,post::gameQA(http://simqa.sz.chewrobot.com:28081/game)", "", "unknown4,unknown3,unknown2,unknown1,common_answer", ""); jConfig = new JConfig(" ", " ", "activate,post::gameQA(" + QA_URL+ ")", "", "unknown4,unknown3,unknown2,unknown1,common_answer", "");
jConfig.setNextStepStatus("active"); jConfig.setNextStepStatus("active");
JSONObject json = jConfig.toJson(this.getConditionDescription()); JSONObject json = jConfig.toJson(this.getConditionDescription());
helper.insertConfigByBotId(botId, json, idList, categoryId); helper.insertConfigByBotId(botId, json, idList, categoryId);
......
...@@ -17,6 +17,7 @@ public class FormsPoster { ...@@ -17,6 +17,7 @@ public class FormsPoster {
LogWriter logWriter = null; LogWriter logWriter = null;
public static String QA_URL = "http://qcloud-gz1.chewrobot.com:58000/game";
public FormsPoster(LogWriter logWriter) { public FormsPoster(LogWriter logWriter) {
this.logWriter = logWriter; this.logWriter = logWriter;
...@@ -88,7 +89,8 @@ public class FormsPoster { ...@@ -88,7 +89,8 @@ public class FormsPoster {
} }
} }
}else { }else {
if(URL.equals("http://simqa.sz.chewrobot.com:28081/game")) if(URL.equals(QA_URL
))
ans.setAnswer("qa_threshold, game_step, query_text 看看少了哪个"); ans.setAnswer("qa_threshold, game_step, query_text 看看少了哪个");
else else
ans.setAnswer("提交表单出现异常"); ans.setAnswer("提交表单出现异常");
...@@ -188,10 +190,12 @@ public class FormsPoster { ...@@ -188,10 +190,12 @@ public class FormsPoster {
logWriter.record("提交表单接收到的数据:<br>" + jobj.toJSONString(), 2); logWriter.record("提交表单接收到的数据:<br>" + jobj.toJSONString(), 2);
String text,score, site = historyInfoPoint.get("site"), npc; String text,score, site = historyInfoPoint.get("site"), npc;
System.out.println(jobj.toJSONString());
if((Integer)jobj.get("post_status") == 1){ if((Integer)jobj.get("post_status") == 1){
if(jobj.getJSONArray("qa_candidates") != null && jobj.get("qa_status").equals("OK")){ if(jobj.getJSONArray("qa_candidates") != null && jobj.get("qa_status").equals("OK")){
historyInfoPoint.put("common_answer", "未找到匹配"); historyInfoPoint.put("common_answer", "未找到匹配");
historyInfoPoint.put("qa_score", "0"); historyInfoPoint.put("qa_score", "0");
historyInfoPoint.put("qa_status", "OK");
List<JSONArray> candidates = JSON.toJavaObject(jobj.getJSONArray("qa_candidates"), List.class); List<JSONArray> candidates = JSON.toJavaObject(jobj.getJSONArray("qa_candidates"), List.class);
for(JSONArray pair:candidates){ for(JSONArray pair:candidates){
...@@ -204,9 +208,11 @@ public class FormsPoster { ...@@ -204,9 +208,11 @@ public class FormsPoster {
npc = m.group(1); npc = m.group(1);
if (worldController.worldOperation(gameEnv, "NPC_query", "queryLocationByNPCName:" + npc, curInfoPoint, historyInfoPoint).equals(site)){ if (worldController.worldOperation(gameEnv, "NPC_query", "queryLocationByNPCName:" + npc, curInfoPoint, historyInfoPoint).equals(site)){
historyInfoPoint.put("common_answer", textscore.get(0)); historyInfoPoint.put("common_answer", textscore.get(0));
historyInfoPoint.put("qa_score", textscore.get(1)); historyInfoPoint.put("qa_score", String.valueOf(textscore.get(1)));
break; break;
} }
}else{
logWriter.record(textscore + "没找到npc名字",1 );
} }
......
...@@ -4,6 +4,7 @@ import com.qiwu.chatbotbackend.GameEnvironment.GameEnv; ...@@ -4,6 +4,7 @@ import com.qiwu.chatbotbackend.GameEnvironment.GameEnv;
import com.qiwu.chatbotbackend.entity.Condition; import com.qiwu.chatbotbackend.entity.Condition;
import com.qiwu.chatbotbackend.entity.Solution; import com.qiwu.chatbotbackend.entity.Solution;
import com.qiwu.chatbotbackend.entity.UserInfo; import com.qiwu.chatbotbackend.entity.UserInfo;
import com.qiwu.chatbotbackend.gameDesign.PlotConstructor;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -19,8 +20,7 @@ public class ResponseFilter { ...@@ -19,8 +20,7 @@ public class ResponseFilter {
if(botType == null){ if(botType == null){
int randNum = (int) (Math.random() * ansCondition.answer.length); return reply;
return ansCondition.answer[randNum];
}else if (botType.equals("game")){ }else if (botType.equals("game")){
...@@ -30,7 +30,7 @@ public class ResponseFilter { ...@@ -30,7 +30,7 @@ public class ResponseFilter {
String answer[] = reply.split("~"); String answer[] = reply.split("~");
int randNum = (int) (Math.random() * answer.length); int randNum = (int) (Math.random() * answer.length);
reply = answer[randNum]; reply = answer[randNum];
if(reply.startsWith("【" + historyInfoPoint.get("智能助手"))){ if(reply.startsWith("【" + historyInfoPoint.get(PlotConstructor.ASSISTANT))){
return reply; return reply;
}else if (sameLocation(reply, curInfoPoint, historyInfoPoint, gameEnv, worldController, site, logWriter)){ }else if (sameLocation(reply, curInfoPoint, historyInfoPoint, gameEnv, worldController, site, logWriter)){
return reply; return reply;
...@@ -39,6 +39,8 @@ public class ResponseFilter { ...@@ -39,6 +39,8 @@ public class ResponseFilter {
if(userInfo.varInitialMap.get("unknownTextList") != null){ if(userInfo.varInitialMap.get("unknownTextList") != null){
for(String ans:userInfo.varInitialMap.get("unknownTextList").split("~")){ for(String ans:userInfo.varInitialMap.get("unknownTextList").split("~")){
if(ans.equals(""))
continue;
if (sameLocation(ans, curInfoPoint, historyInfoPoint, gameEnv, worldController, site, logWriter)){ if (sameLocation(ans, curInfoPoint, historyInfoPoint, gameEnv, worldController, site, logWriter)){
return ans; return ans;
} }
......
...@@ -247,7 +247,20 @@ public class WorldController { ...@@ -247,7 +247,20 @@ public class WorldController {
} }
} }
}else { //增删改统一使用 }else if(valuePair[0].startsWith("update")){
Boolean flag = true;
switch (valuePair[0]) {
case "updateFollowerLocation":
flag = gameEnv.updateFollowerLocation(valuePair[1]);
}
if(flag){
returnStr = "更新成功";
}else
returnStr = "更新失败";
}else{ //增删改统一使用
gameEnv.CUD(varName, valuePair[0], valuePair[1]); gameEnv.CUD(varName, valuePair[0], valuePair[1]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment