Commit 3202bf7e by hxw2303632

Merge branch 'master' of 192.168.1.81:hxw2303632/webapp

parents 29ff00fc 3e9933cf
# #
<<<<<<< HEAD
## qa问答地址
qa_url=http://aliyun-hz1.chewrobot.com:59000/game
#
## 中控url
=======
# qa问答地址 # qa问答地址
qa_url=http://aliyun-hz1.chewrobot.com:59100/game qa_url=http://aliyun-hz1.chewrobot.com:59100/game
# 中控url # 中控url
>>>>>>> 4a34a593d3e29f91322fa9ba188fd49d5db9359d
cc_url=http://localhost:8070/api/update/data cc_url=http://localhost:8070/api/update/data
# condition后台url # condition后台url
condition_backend_url=http://192.168.1.82:6636/api condition_backend_url=http://192.168.1.82:6636/api
<<<<<<< HEAD
#
## action生成指定的后台地址
service_url=http://192.168.1.113:8081/bot/dialog
=======
# 引擎会把表单数据提交到这个地址 # 引擎会把表单数据提交到这个地址
service_url=http://192.168.1.178:8081/bot/dialog service_url=http://192.168.1.178:8081/bot/dialog
>>>>>>> 4a34a593d3e29f91322fa9ba188fd49d5db9359d
......
...@@ -1025,7 +1025,7 @@ public class ActionUtils { ...@@ -1025,7 +1025,7 @@ public class ActionUtils {
} }
} }
} }
if(extraKeywords != null && extraKeywords != "") { if(extraKeywords != null && !extraKeywords.equals("")) {
conditionJson.put("relationHead", extraKeywords); conditionJson.put("relationHead", extraKeywords);
} }
...@@ -1040,7 +1040,7 @@ public class ActionUtils { ...@@ -1040,7 +1040,7 @@ public class ActionUtils {
} }
} }
} }
if(extraKeywords != null && extraKeywords != "") { if(extraKeywords != null && !extraKeywords.equals("")) {
conditionJson.getJSONArray("repeatList").getJSONObject(0).put("repeatKeywords", extraKeywords); conditionJson.getJSONArray("repeatList").getJSONObject(0).put("repeatKeywords", extraKeywords);
} }
return true; return true;
......
...@@ -105,10 +105,6 @@ public class ElementConstructor { ...@@ -105,10 +105,6 @@ public class ElementConstructor {
relationKeywords.put(conditionName + "_tail", new HashSet<String>()); relationKeywords.put(conditionName + "_tail", new HashSet<String>());
} }
//visitorname和bot的替换
// premise.put("keywords", ((String)premise.get("keywords")).replace("qiwu", "#visitorname").replace(botName, "#botname"));
premise.put("keywords", replaceKeywords((String)premise.get("keywords")));
for (String keyword : ((String) premise.get("keywords")).split("\\+")) { for (String keyword : ((String) premise.get("keywords")).split("\\+")) {
if(keyword.equals("")){ if(keyword.equals("")){
...@@ -149,9 +145,7 @@ public class ElementConstructor { ...@@ -149,9 +145,7 @@ public class ElementConstructor {
relationKeywords.put(conditionName + "_tail", new HashSet<String>()); relationKeywords.put(conditionName + "_tail", new HashSet<String>());
} }
// premise.put("keywords", ((String)premise.get("keywords")).replace("qiwu", "#visitorname").replace(botName, "#botname"));
premise.put("keywords", replaceKeywords((String)premise.get("keywords")));
for (String keyword : ((String) premise.get("keywords")).split("\\+")) { for (String keyword : ((String) premise.get("keywords")).split("\\+")) {
if(keyword.equals("")){ if(keyword.equals("")){
...@@ -176,43 +170,6 @@ public class ElementConstructor { ...@@ -176,43 +170,6 @@ public class ElementConstructor {
} }
} }
public String replaceKeywords(String str) {
Boolean startChat = str.startsWith("+");
Map<String, String> keywords = new HashMap<>();
keywords.put("qiwu", "#visitorname");
keywords.put("我", "#visitorname");
keywords.put("botName", "#botname");
keywords.put("你", "#botname");
String[] split = str.split("\\+");
String _s;
int pos;
String sub1;
String sub2;
for(int i =0; i < split.length; ++i) {
_s = split[i];
pos = _s.indexOf(":");
if(pos == -1) {
if (keywords.get(_s) != null) {
_s = keywords.get(_s);
}
} else {
sub1 = _s.substring(0, pos);
sub2 = _s.substring(pos+1, _s.length());
if (keywords.get(sub1) != null) {
sub1 = keywords.get(sub1);
}
if (keywords.get(sub2) != null) {
sub2 = keywords.get(sub2);
}
_s = sub1 + ":" + sub2;
}
split[i] = _s;
}
str = String.join("+", split);
if(!str.equals("") && startChat && !str.startsWith("+"))
str = "+" + str;
return str;
}
/** /**
* 根据插入的数据做后处理 * 根据插入的数据做后处理
......
...@@ -895,7 +895,26 @@ public class ActionMatcher { ...@@ -895,7 +895,26 @@ public class ActionMatcher {
keyword = botUtil.getKeyword(historyInfoPoint, curInfoPoint, false, variableName); keyword = botUtil.getKeyword(historyInfoPoint, curInfoPoint, false, variableName);
updateValue = botUtil.knowledgeProcess(variableName, action.getUpdateKnowledge().get(variableName)); updateValue = botUtil.knowledgeProcess(variableName, action.getUpdateKnowledge().get(variableName));
int indexOf = variableName.indexOf("_");
if(indexOf != -1) {
String prefix = variableName.substring(0, indexOf);
if(prefix.equals("npc") || prefix.equals("goods") || prefix.equals("map") || prefix.equals("place")) {
String[] split = variableName.split("_");
if(split.length == 4) {
String _type = split[0];
switch(_type) {
case("npc"):
keyword = gameEnv.queryNpcAttrByNpcName(split[2], split[3]);
break;
case("goods"):
keyword = gameEnv.queryGoodsAttrByGoodsName(split[2], split[3]);
break;
default:
break;
}
}
}
}
try { try {
//做数字加法 //做数字加法
......
...@@ -42,7 +42,7 @@ public class ChatCacheTests { ...@@ -42,7 +42,7 @@ public class ChatCacheTests {
//先删除就数据 //先删除就数据
SqlHelper helper = new SqlHelper(); SqlHelper helper = new SqlHelper();
ChatCacheController.deleteChatCache(helper, "123456789"); // ChatCacheController.deleteChatCache(helper, "123456789");
Map<String, ChatCache> chatCacheMap = null; Map<String, ChatCache> chatCacheMap = null;
chatCacheMap = new HashMap<String, ChatCache>(); chatCacheMap = new HashMap<String, ChatCache>();
......
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