Commit 03aaeb43 by hxw

添加 不包含 比较类型

parent 3cc3f5aa
...@@ -8,20 +8,25 @@ cc_url=http://localhost:8070/api/update/data ...@@ -8,20 +8,25 @@ 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
# 数据模型url
automatch_url=http://dev01.centaurstech.com:5700/mermaid/?model=auto-train
# action生成指定的后台地址 # action生成指定的后台地址
service_url=http://192.168.1.178:8081/bot/dialog service_url=http://192.168.1.178:8081/bot/dialog
#
#qa_url=http://localhost:59100/game #qa_url=http://localhost:59100/game
#cc_url=http://localhost:8070/api/update/data #cc_url=http://localhost:8070/api/update/data
#condition_backend_url=http://localhost:6636/api #condition_backend_url=http://localhost:6636/api
#automatch_url=http://dev01.centaurstech.com:5700/mermaid/?model=auto-train
#service_url=http://localhost:8081/bot/dialog #service_url=http://localhost:8081/bot/dialog
chatcache_time_out=300000
# 数据模型url
automatch_url=http://dev01.centaurstech.com:5700/mermaid/?model=auto-train
condition_backend_error=语义关系后台异常
keyword_dir=keywords.txt
bot_backup_dir=tmp/ bot_backup_dir=tmp/
config_dir=config/ config_dir=config/
...@@ -29,8 +34,10 @@ unknown_text=不好意思,我没听懂你刚才说的话,请换个别的问 ...@@ -29,8 +34,10 @@ unknown_text=不好意思,我没听懂你刚才说的话,请换个别的问
location_hint=请到%s location_hint=请到%s
game_start_hint=请说开始剧情或者继续剧情 no_one_can_reply_unknown=此地点没人可以回答unknown
game_welcome_text=欢迎来到%s,请说继续剧情或者重新开始
game_start_hint=【旁白@%正常】请说开始剧情或者继续剧情
game_welcome_text=【旁白@正常】欢迎来到%s,请说继续剧情或者重新开始
game_module_error=游戏模块出错 game_module_error=游戏模块出错
program_error=程序出现异常 program_error=程序出现异常
...@@ -56,6 +63,8 @@ star_plot_not_exist=开始剧情不存在,请到剧情列表设置 ...@@ -56,6 +63,8 @@ star_plot_not_exist=开始剧情不存在,请到剧情列表设置
助手对应的变量 助手对应的变量
assistant=globalVariable_智能助手 assistant=globalVariable_智能助手
unknown_counter_name=globalVariable_无匹配次数
# ------------------------助手情绪-------------- # ------------------------助手情绪--------------
assistant_emotion=正常 assistant_emotion=正常
talker_pattern=【%s@%s】 talker_pattern=【%s@%s】
...@@ -71,6 +80,7 @@ plot_status=剧情%s状态 ...@@ -71,6 +80,7 @@ plot_status=剧情%s状态
plot_generation_error=剧情接口处理出现异常 plot_generation_error=剧情接口处理出现异常
action_text_generate_error=action生成失败 action_text_generate_error=action生成失败
qa_fetch_error=QA处理中发生异常
默认condition 默认condition
default_condition=yaobuyao default_condition=yaobuyao
...@@ -165,3 +175,7 @@ variable_update_format=%s---%s ...@@ -165,3 +175,7 @@ variable_update_format=%s---%s
# ---------------------------数据库连接获取失败-------------------------------- # ---------------------------数据库连接获取失败--------------------------------
sql_connection_error=数据库连接获取失败 sql_connection_error=数据库连接获取失败
# -------------------------备份--------------------------------------
backup_error=备份失败
...@@ -6,96 +6,99 @@ ...@@ -6,96 +6,99 @@
# name表示可以替换的名字,如物品名、角色名 # name表示可以替换的名字,如物品名、角色名
# attrName是属性名 # attrName是属性名
# qiwu就是玩家“我” # qiwu就是玩家“我”
# botname是"你"
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# 我在哪里 # 我在哪里
WHERE_I_AM|zainali|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方 WHERE_I_AM|at_where|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方
WHERE_I_AM|wenzainali|+哪:qiwu+地方:qiwu+位置:qiwu+地点:qiwu+哪里:qiwu+哪儿:qiwu+哪:landey+地方:landey+位置:landey+地点:landey+哪里:landey+哪儿:landey WHERE_I_AM|something_where|+哪:qiwu+哪儿:qiwu+哪里:qiwu+地方:qiwu+位置:qiwu+地点:qiwu
# 我能去哪里 # 我能去哪里
WHERE_CAN_I_GO|choose_gowhere|+哪里:qiwu+哪:qiwu+哪儿:qiwu+地方:qiwu+哪里:去+哪:能去+哪里:能去+哪儿:能去+地方:能去+地方:去+地方:能去+哪里:能去+哪:去+哪:能去+哪儿:去+哪:qiwu+哪:到+哪儿:到+哪里:到 WHERE_CAN_I_GO|choose_gowhere_1|+能去:哪里+能去:哪+能去:哪儿+去:哪+去:哪里+去:哪儿+能到:哪里+能到:哪儿+能到:哪+到:哪+到:哪儿+到:哪里+能到:地方+能到:地点+能到:位置+能去:地方+能去:地点+能去:位置
WHERE_CAN_I_GO|choose_gowhere_33|+qiwu:哪+qiwu:哪儿+qiwu:哪里
# 周围有什么
AROUND_THINGS|havewhat_thing|+旁边:吗+旁边:呢+这里:呢+这里:吗+附近:吗+周围:吗+地方:啊+地点:啊+周围:呀
AROUND_THINGS|place_have_something|+这里:什么
# 周围有什么人 # 周围有什么人
AROUND_NPC|know_exist_what|+周围:人+旁边:人+附近:人+周围:谁+这里:谁+这里:人+有什么:人+里面:人+里面:谁+哪些:人+qiwu:人+qiwu:谁+有:谁+有:人+附近:谁+有:附近+旁边:谁 AROUND_NPC|place_have_something|+这里:谁+里面:人+里面:谁+附近:人+附近:谁+qiwu:附近+周围:谁+周围:人+旁边:人+旁边:谁+qiwu:周围+谁:那
AROUND_NPC|zhiwen|+这里:谁+这里:谁+谁:在
# 周围有什么npc类别
AROUND_NPC_CLASS|know_exist_what|+周围:name+附近:name
# 周围有什么
AROUND_THINGS|know_exist_what_mohu|+有什么:周围+有什么:附近+有什么:这里+有:哪些:这里+有谁:周围+有什么:里面+有什么:旁边+qiwu:旁边+有什么:这里+有:哪些
# 周围有什么物品 # 周围有什么物品
AROUND_ITEM|know_exist_what|+周围:物品+旁边:物品+旁边:东西+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+有什么:东西+有什么:物品+哪些:物品+哪些:东西+有:东西+里面:物品 AROUND_ITEM|place_have_something|+周围:物品+旁边:物品+旁边:东西+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+qiwu:物品+里面:物品+里面:东西+里面:什么
AROUND_ITEM|nums|+有:哪些 AROUND_ITEM|havewhat_thing|+周围:物品+旁边:物品+旁边:东西+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+qiwu:物品+里面:物品+里面:东西+里面:什么
# AROUND_ITEM|zhiwen|+附近:who+周围:who+旁边:who
# 周围有什么地方 # 周围有什么地方
AROUND_PLACE|know_exist_what|+周围:地点+周围:地方+哪些:地方+哪些:地点+旁边:地方+旁边:地点+附近:地方+附近:地点 AROUND_PLACE|havewhat_thing|+周围:地点+周围:地方+哪些:地方+哪些:地点+旁边:地方+旁边:地点+附近:地方+附近:地点
AROUND_PLACE|place_have_something|+周围:地点+周围:地方+哪些:地方+哪些:地点+旁边:地方+旁边:地点+附近:地方+附近:地点
# 周围有什么物品类别 # 周围有什么npc类别
AROUND_ITEM_CLASS|know_exist_what|+周围:name+附近:name AROUND_NPC_CLASS|havewhat_thing|+周围:name+附近:name+旁边:name
# 我有什么 # 周围有什么物品类别
WHAT_ITEM_I_HAVE|know_exist_what_mohu|+有什么:qiwu+什么:qiwu+qiwu:东西+qiwu:地方 AROUND_ITEM_CLASS|havewhat_thing|+周围:name+附近:name+旁边:name
WHAT_ITEM_I_HAVE|know_exist_what|有什么:东西
WHAT_ITEM_I_HAVE|zhiwen|+qiwu:带
# 里面有谁
WHO_IN_THERE|shishui|+谁:里面+里面:人
# 去xx
GO_TO|yaobuyao|+去:name+到:name
# 怎么找到NPC # 我有什么
HOW_TO_FIND_NPC|xxx|+找到:name WHAT_ITEM_I_HAVE|place_have_something|+qiwu:什么+qiwu:东西+qiwu:物品+qiwu:装备+qiwu:补给
# 你是谁 # 去xx
WHO_YOU_ARE|zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是+人:是 GO_TO|do_what_vn|+去:name+到:name
# 任务是什么
TASK_IS_WHAT|shishenme|+是什么:任务+qiwu:任务
TASK_IS_WHAT|zhiwen|+qiwu:要去
# npc在哪里 # npc在哪里
NPC_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name NPC_LOCATION|something_where|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name+位置:name
# 物品在哪里 # 物品在哪里
ITEM_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name+位置:name ITEM_LOCATION|something_where|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name+位置:name
# 怎么找到npc # 怎么找到npc
HOW_FIND_NPC|want_know_zenmezuo|+找到:name HOW_FIND_NPC|want_known_zenmezuo_vn|+找到:name
#怎么找到物品 #怎么找到物品
HOW_FIND_ITEM|want_know_zenmezuo|+找到:name HOW_FIND_ITEM|want_known_zenmezuo_vn|+找到:name
# 怎么去XXX
HOW_TO_THERE|want_known_zenmezuo_vn|默认
# 沙滩上有什么人 # 沙滩上有什么人
WHAT_NPC_IN_LOCATION|xxx|地点 WHAT_NPC_IN_LOCATION|havewhat_thing|+name:人
WHAT_NPC_IN_LOCATION|place_have_something|+name:谁+name:人
# xx上有什么东西 # xx上有什么东西
WAHT_ITEM_IN_LOCATION|xxx|地点 WAHT_ITEM_IN_LOCATION|havewhat_thing|+name:物品+name:东西+name:地方+name:位置
# 地点上有什么 # 地点上有什么
WHAT_THINGS_IN_LOCATION|xxx|地点 WHAT_THINGS_IN_LOCATION|have_what_thing|地点
# 你是谁
WHO_YOU_ARE|zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是+人:是
# 任务是什么
TASK_IS_WHAT|something_iswhat|+什么:任务
TASK_IS_WHAT|shenme_shi_shenme|+qiwu:任务
# npc的属性是多少 # npc的属性是多少
NPC_ATTR|nums|+name:attrName NPC_ATTR|shuliang_1|+name:attrName
NPC_ATTR|shishenme|+name:attrName
# 物品的属性是多少 # 物品的属性是多少
ITEM_ATTR|nums|+name:attrName ITEM_ATTR|shuliang_1|+name:attrName
ITEM_ATTR|shishenme|+name:attrName
# 周围有什么物品类别
AOURND_NPC_CLASS|know_exist_what|+周围:name+附近:name
# 怎么去XXX
HOW_TO_THERE|want_know_zenmezuo|+去:name
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# 第一块,意图|相关的语义关系名
意图语义关系名
# 第二块, 意图|语义关系名|关键词
# ------------------------------------------------------------------------------
WHERE_I_AM|zainali|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方
WHERE_I_AM|wenzainali|+哪:qiwu+地方:qiwu+位置:qiwu+地点:qiwu+哪里:qiwu+哪儿:qiwu
WHERE_CAN_I_GO|choose_gowhere|+哪里:qiwu+哪:qiwu+哪儿:qiwu+地方:qiwu+哪里:去+哪:能去+哪里:能去+哪儿:能去+地方:能去+地方:去+地方:能去+哪里:能去+哪:去+哪:能去+哪儿:去+哪:qiwu
SURROUNDING_NPC|know_exist_what|+周围:人+附近:人+周围:谁+这里:谁+这里:人+有什么:人+里面:人+里面:谁+哪些:人+qiwu:人+qiwu:谁+有:谁+有:人
SURROUNDING_THINGS|know_exist_what_mohu|+有什么:周围+有什么:附近+有什么:这里+有:哪些:这里+有谁:周围+有什么:里面
SURROUNDING_NPC_CLASS|know_exist_what|+周围:name+附近:name
SURROUNDING_ITEM|know_exist_what|+周围:name+附近:name
SURROUNDING_PLACE|know_exist_what|+周围:地点+周围:地方+哪些:地方+哪些:地点
SURROUNDING_ITEM_CLASS|know_exist_what|+周围:name+附近:name
WHAT_ITEM_I_HAVE|know_exist_what_mohu|+有什么:qiwu+什么:qiwu+qiwu:东西+qiwu:地方
WHO_IN_THERE|shishui|+谁:里面+里面:人
GO_TO|yaobuyao|+去:name+到:name
WHO_TO_FIND_NPC|xxx|+找到:name
WHO_ARE_YOU|zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是+人:是
TASK_IS_WHAT|shishenme|+是什么:任务+qiwu:任务
FIND_NPC_LOCATION|xxx|+哪里:name+哪:name+地方:name+地点:name
FIND_ITEM_LOCATION|xxx|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name
WHAT_NPC_IN_LOCATION|xxx|地点
WAHT_ITEM_IN_LOCATION|xxx|地点
WHAT_THINGS_IN_LOCATION|xxx|地点
# --------------------------------------------------------------------------
# 地图在哪里
map_zainali|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方
map_wenzainali|+哪:qiwu+地方:qiwu+位置:qiwu+地点:qiwu+哪里:qiwu+哪儿:qiwu
# 能去哪里
map_choose_gowhere|+哪里:qiwu+哪:qiwu+哪儿:qiwu+地方:qiwu+哪里:去+哪:能去+哪里:能去+哪儿:能去+地方:能去+地方:去+地方:能去+哪里:能去+哪:去+哪:能去+哪儿:去+哪:qiwu
# 周围有什么人
people_know_exist_what|+周围:人+附近:人+周围:谁+这里:谁+这里:人+有什么:人+里面:人+里面:谁+哪些:人+qiwu:人+qiwu:谁+有:谁+有:人
# 周围有什么物品
item_know_exist_what|+周围:物品+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+有什么:东西+有什么:物品+哪些:物品+哪些:东西
# 我有什么东西
item_rencheng|+qiwu:东西
# 我有什么
we_have_know_exist_what_mohu|+有什么:qiwu+什么:qiwu+qiwu:东西+qiwu:地方
# 里面的是谁
inner_shishui|+谁:里面+里面:人
# 去某个地方
map_yaobuyao|+去:name+到:name
# 你是谁
talker_zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是+人:是
# 任务是什么
task_shishenme|+是什么:任务+qiwu:任务
# 周围有什么
things|know_exist_what_mohu|+有什么:周围+有什么:附近+有什么:这里+有:哪些:这里+有谁:周围+有什么:里面
# 周围有什么地方
place_know_exist_what|+周围:地点+周围:地方+哪些:地方+哪些:地点
# 周围有什么npc类名
npc_class_pattern|+周围:name+附近:name
# 周围有什么item类名
item_class_pattern|+周围:name+附近:name
# 怎么找到xxx
find_pattern|+找到:name
# npc在哪里
npc_location_pattern|+哪里:name+哪:name+地方:name+地点:name
# 物品在哪里
item_location_pattern|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name
# 某地点有什么
things_in_place_xxxx|+地点:什么
# 地点有什么人
NPC_in_place_xxx|+地点:什么
# 地点有什么物品
items_in_place_xxx|+地点:什么
# =====================================new add============================================
people_rencheng|+机器人:谁+那个人:谁+人:谁+机器人:干嘛
# ------------------------------------------------------------------------------
# 格式 # 格式
# 意图|语义关系名字|关键词 # 意图|语义关系名字|关键词
# name表示可以替换的名字,如物品名、角色名 # name表示可以替换的名字,如物品名、角色名
...@@ -124,31 +12,39 @@ people_rencheng|+机器人:谁+那个人:谁+人:谁+机器人:干嘛 ...@@ -124,31 +12,39 @@ people_rencheng|+机器人:谁+那个人:谁+人:谁+机器人:干嘛
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# 我在哪里 # 我在哪里
WHERE_I_AM|zainali|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方 WHERE_I_AM|zainali|+在:哪里+在:哪儿+在:哪+在:位置+在:地点+在:地方+到:哪里+到:地点+到:地方
WHERE_I_AM|wenzainali|+哪:qiwu+地方:qiwu+位置:qiwu+地点:qiwu+哪里:qiwu+哪儿:qiwu WHERE_I_AM|wenzainali|+哪:qiwu+地方:qiwu+位置:qiwu+地点:qiwu+哪里:qiwu+哪儿:qiwu+哪:landey+地方:landey+位置:landey+地点:landey+哪里:landey+哪儿:landey
# 我能去哪里 # 我能去哪里
WHERE_CAN_I_GO|choose_gowhere|+哪里:qiwu+哪:qiwu+哪儿:qiwu+地方:qiwu+哪里:去+哪:能去+哪里:能去+哪儿:能去+地方:能去+地方:去+地方:能去+哪里:能去+哪:去+哪:能去+哪儿:去+哪:qiwu WHERE_CAN_I_GO|choose_gowhere|+哪里:qiwu+哪:qiwu+哪儿:qiwu+地方:qiwu+哪里:去+哪:能去+哪里:能去+哪儿:能去+地方:能去+地方:去+地方:能去+哪里:能去+哪:去+哪:能去+哪儿:去+哪:qiwu+哪:到+哪儿:到+哪里:到
# 周围有什么人 # 周围有什么人
AROUND_NPC|know_exist_what|+周围:人+附近:人+周围:谁+这里:谁+这里:人+有什么:人+里面:人+里面:谁+哪些:人+qiwu:人+qiwu:谁+有:谁+有:人 AROUND_NPC|know_exist_what|+周围:人+旁边:人+附近:人+周围:谁+这里:谁+这里:人+有什么:人+里面:人+里面:谁+哪些:人+qiwu:人+qiwu:谁+有:谁+有:人+附近:谁+有:附近+旁边:谁
AROUND_NPC|zhiwen|+这里:谁+这里:谁+谁:在
# 周围有什么npc类别 # 周围有什么npc类别
AROUND_NPC_CLASS|know_exist_what|+周围:name+附近:name AROUND_NPC_CLASS|know_exist_what|+周围:name+附近:name
# 周围有什么 # 周围有什么
AROUND_THINGS|know_exist_what_mohu|+有什么:周围+有什么:附近+有什么:这里+有:哪些:这里+有谁:周围+有什么:里面 AROUND_THINGS|know_exist_what_mohu|+有什么:周围+有什么:附近+有什么:这里+有:哪些:这里+有谁:周围+有什么:里面+有什么:旁边+qiwu:旁边+有什么:这里+有:哪些
# 周围有什么物品 # 周围有什么物品
AROUND_ITEM|know_exist_what|+周围:物品+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+有什么:东西+有什么:物品+哪些:物品+哪些:东西 AROUND_ITEM|know_exist_what|+周围:物品+旁边:物品+旁边:东西+周围:东西+附近:物品+附近:东西+这里:物品+这里:东西+有什么:东西+有什么:物品+哪些:物品+哪些:东西+有:东西+里面:物品
AROUND_ITEM|nums|+有:哪些
# AROUND_ITEM|zhiwen|+附近:who+周围:who+旁边:who
# 周围有什么地方 # 周围有什么地方
AROUND_PLACE|know_exist_what|+周围:地点+周围:地方+哪些:地方+哪些:地点 AROUND_PLACE|know_exist_what|+周围:地点+周围:地方+哪些:地方+哪些:地点+旁边:地方+旁边:地点+附近:地方+附近:地点
# 周围有什么物品类别 # 周围有什么物品类别
AROUND_ITEM_CLASS|know_exist_what|+周围:name+附近:name AROUND_ITEM_CLASS|know_exist_what|+周围:name+附近:name
# 我有什么 # 我有什么
WHAT_ITEM_I_HAVE|know_exist_what_mohu|+有什么:qiwu+什么:qiwu+qiwu:东西+qiwu:地方 WHAT_ITEM_I_HAVE|know_exist_what_mohu|+有什么:qiwu+什么:qiwu+qiwu:东西+qiwu:地方
WHAT_ITEM_I_HAVE|know_exist_what|有什么:东西
WHAT_ITEM_I_HAVE|zhiwen|+qiwu:带
# 里面有谁 # 里面有谁
WHO_IN_THERE|shishui|+谁:里面+里面:人 WHO_IN_THERE|shishui|+谁:里面+里面:人
...@@ -165,12 +61,14 @@ WHO_YOU_ARE|zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是 ...@@ -165,12 +61,14 @@ WHO_YOU_ARE|zhiwen|+botname:谁+botname:干嘛+那个人:谁+人:谁+botname:是
# 任务是什么 # 任务是什么
TASK_IS_WHAT|shishenme|+是什么:任务+qiwu:任务 TASK_IS_WHAT|shishenme|+是什么:任务+qiwu:任务
TASK_IS_WHAT|zhiwen|+qiwu:要去
# npc在哪里 # npc在哪里
NPC_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name NPC_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name
# 物品在哪里 # 物品在哪里
ITEM_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name ITEM_LOCATION|wenzainali|+哪里:name+哪:name+地方:name+地点:name+位置:name+哪儿:name+位置:name
# 怎么找到npc # 怎么找到npc
HOW_FIND_NPC|want_know_zenmezuo|+找到:name HOW_FIND_NPC|want_know_zenmezuo|+找到:name
...@@ -198,5 +96,6 @@ ITEM_ATTR|shishenme|+name:attrName ...@@ -198,5 +96,6 @@ ITEM_ATTR|shishenme|+name:attrName
AOURND_NPC_CLASS|know_exist_what|+周围:name+附近:name AOURND_NPC_CLASS|know_exist_what|+周围:name+附近:name
# 怎么去XXX # 怎么去XXX
HOW_TO_THERE|want_know_zenmezuo|默认 HOW_TO_THERE|want_know_zenmezuo|+去:name
...@@ -10,6 +10,10 @@ public class Config { ...@@ -10,6 +10,10 @@ public class Config {
public static String QA_URL = null; public static String QA_URL = null;
public static String CC_URL = null; public static String CC_URL = null;
public static String NO_ONE_CAN_REPLY_UNKNOWN;
public static String KEYWORD_DIR = null;
//名字,地址 //名字,地址
public static String GAME_BOT_CATEGORY = null; public static String GAME_BOT_CATEGORY = null;
...@@ -167,6 +171,15 @@ public class Config { ...@@ -167,6 +171,15 @@ public class Config {
public static String BACKUP_PATH = null; public static String BACKUP_PATH = null;
public static String UNKNOWN_COUNTER_NAME = null;
public static String BACKUP_ERROR = null;
public static String QA_FETCH_ERROR = null;
public static long CHATCACHE_TIME_OUT;
} }
...@@ -32,12 +32,11 @@ public class PlatformUtils { ...@@ -32,12 +32,11 @@ public class PlatformUtils {
} }
public List<Integer> queryConditionIdByTypetreeId(List typetreeIdList){ public List<Integer> queryConditionIdByTypetreeId(List typetreeIdList){
String sql = "select conditionId from typetreeNcondition where typetreeId in (?)"; String sql = "select conditionId from typetreeNcondition where typetreeId in (" + Joiner.on(",").join(typetreeIdList) + ")";
String keywordText = ""; String keywordText = "";
List<Integer> idList = new ArrayList<Integer>(); List<Integer> idList = new ArrayList<Integer>();
try{ try{
PreparedStatement ps = conn.prepareStatement(sql); PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1,Joiner.on(",").join(typetreeIdList));
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
while(rs.next()){ while(rs.next()){
idList.add(rs.getInt("conditionId")); idList.add(rs.getInt("conditionId"));
......
package com.qiwu.chatbotbackend.actiongenerate.entity; package com.qiwu.chatbotbackend.actiongenerate.entity;
public class BotInfo { public class BotInfo {
Integer botId; Integer botId = 0;
String welcomeText; String welcomeText = "";
String goodbyeText; String goodbyeText = "";
String postURL; String postURL = "";
String defaultConfigCategory; String defaultConfigCategory = "";
String bothValue; String bothValue;
String queryTextTransfer; String queryTextTransfer;
......
...@@ -28,6 +28,8 @@ public class ActionServlet extends HttpServlet { ...@@ -28,6 +28,8 @@ public class ActionServlet extends HttpServlet {
JSONObject responseJSONObject = new JSONObject(); JSONObject responseJSONObject = new JSONObject();
Boolean flag = true; Boolean flag = true;
Integer botId; Integer botId;
EngineUtils engine = null;
SqlHelper helper = null;
...@@ -47,8 +49,8 @@ public class ActionServlet extends HttpServlet { ...@@ -47,8 +49,8 @@ public class ActionServlet extends HttpServlet {
try { try {
EngineUtils engine = new EngineUtils(); engine = new EngineUtils();
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
ActionUtils actionUtils = new ActionUtils(engine, helper); ActionUtils actionUtils = new ActionUtils(engine, helper);
...@@ -68,9 +70,6 @@ public class ActionServlet extends HttpServlet { ...@@ -68,9 +70,6 @@ public class ActionServlet extends HttpServlet {
case "update_condition_display_order": case "update_condition_display_order":
actionUtils.updateConditionDisplayOrder(receiveParameters); actionUtils.updateConditionDisplayOrder(receiveParameters);
break; break;
case "update_bot_info":
actionUtils.updateBotInfo(receiveParameters);
break;
case "update_goodbye": case "update_goodbye":
actionUtils.updateGoodbye(receiveParameters); actionUtils.updateGoodbye(receiveParameters);
break; break;
...@@ -98,6 +97,9 @@ public class ActionServlet extends HttpServlet { ...@@ -98,6 +97,9 @@ public class ActionServlet extends HttpServlet {
case "update_condition_name": case "update_condition_name":
actionUtils.updateConditionName(receiveParameters); actionUtils.updateConditionName(receiveParameters);
break; break;
case "update_bot_info":
actionUtils.updateBotInfo(receiveParameters);
break;
} }
if(actionUtils.intervalStatus.getStatus() == 1) if(actionUtils.intervalStatus.getStatus() == 1)
actionUtils.query4post(receiveParameters); actionUtils.query4post(receiveParameters);
...@@ -105,8 +107,7 @@ public class ActionServlet extends HttpServlet { ...@@ -105,8 +107,7 @@ public class ActionServlet extends HttpServlet {
} }
helper.destroy();
engine.destroy();
switch (actionUtils.intervalStatus.getStatus()){ switch (actionUtils.intervalStatus.getStatus()){
case 1: case 1:
...@@ -121,6 +122,9 @@ public class ActionServlet extends HttpServlet { ...@@ -121,6 +122,9 @@ public class ActionServlet extends HttpServlet {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} finally{
helper.destroy();
engine.destroy();
} }
}else{ }else{
......
...@@ -23,6 +23,7 @@ import java.sql.SQLException; ...@@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.qiwu.chatbotbackend.Config.Config.BACKUP_ERROR;
import static com.qiwu.chatbotbackend.Config.Config.BOT_BACKUP_DIR; import static com.qiwu.chatbotbackend.Config.Config.BOT_BACKUP_DIR;
import static com.qiwu.chatbotbackend.Config.Config.SQL_CONNECTION_ERROR; import static com.qiwu.chatbotbackend.Config.Config.SQL_CONNECTION_ERROR;
...@@ -40,6 +41,8 @@ public class BackupServlet extends HttpServlet { ...@@ -40,6 +41,8 @@ public class BackupServlet extends HttpServlet {
JSONObject responseJSONObject = new JSONObject(); JSONObject responseJSONObject = new JSONObject();
Boolean flag = true; Boolean flag = true;
Integer botId = 0, categoryIndex; Integer botId = 0, categoryIndex;
EngineUtils engine = null;
SqlHelper helper = null;
if (jsonStr != null && !jsonStr.equals("")) { if (jsonStr != null && !jsonStr.equals("")) {
...@@ -56,8 +59,8 @@ public class BackupServlet extends HttpServlet { ...@@ -56,8 +59,8 @@ public class BackupServlet extends HttpServlet {
botCategoryName = receiveParameters.getString("catName"); botCategoryName = receiveParameters.getString("catName");
EngineUtils engine = new EngineUtils(); engine = new EngineUtils();
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
BotInfo botInfo = null; BotInfo botInfo = null;
List<Condition> conditionList = new ArrayList<Condition>(); List<Condition> conditionList = new ArrayList<Condition>();
List<ConfigTerm> configTermList = new ArrayList<ConfigTerm>(); List<ConfigTerm> configTermList = new ArrayList<ConfigTerm>();
...@@ -71,12 +74,12 @@ public class BackupServlet extends HttpServlet { ...@@ -71,12 +74,12 @@ public class BackupServlet extends HttpServlet {
//actionUtils. //actionUtils.
//如果需要保存condition,查询所有condition //如果需要保存condition,查询所有condition
if (receiveParameters.containsKey("saveCondition") && receiveParameters.getBoolean("saveCondition")){ if (receiveParameters.containsKey("saveCondition") && receiveParameters.getBoolean("saveCondition")) {
conditionList = helper.queryConditionAll(botId); conditionList = helper.queryConditionAll(botId);
} }
//如果需要保存配置文件,则从根目录开始保存配置文件 //如果需要保存配置文件,则从根目录开始保存配置文件
if(receiveParameters.containsKey("saveConfig") && receiveParameters.getBoolean("saveConfig")){ if (receiveParameters.containsKey("saveConfig") && receiveParameters.getBoolean("saveConfig")) {
categoryIndex = receiveParameters.getInteger("indexCategory"); categoryIndex = receiveParameters.getInteger("indexCategory");
//查询某个类别下的所有类别 //查询某个类别下的所有类别
...@@ -86,7 +89,7 @@ public class BackupServlet extends HttpServlet { ...@@ -86,7 +89,7 @@ public class BackupServlet extends HttpServlet {
} }
if(!receiveParameters.containsKey("saveVariable") || receiveParameters.getBoolean("saveVariable")){ if (!receiveParameters.containsKey("saveVariable") || receiveParameters.getBoolean("saveVariable")) {
variablesList = helper.queryVariableAll(botId); variablesList = helper.queryVariableAll(botId);
} }
...@@ -98,21 +101,22 @@ public class BackupServlet extends HttpServlet { ...@@ -98,21 +101,22 @@ public class BackupServlet extends HttpServlet {
//backupFile.put("botId"); //backupFile.put("botId");
try { try {
writeFile(BOT_BACKUP_DIR + botId + ".backup",JSON.toJSONString(backup)); writeFile(BOT_BACKUP_DIR + botId + ".backup", JSON.toJSONString(backup));
// ReadFile("D:\\8.json"); // ReadFile("D:\\8.json");
System.out.println(); System.out.println();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
helper.destroy();
engine.destroy();
} catch(IOException e){
intervalStatus = new IntervalStatus(0, BACKUP_ERROR);
} catch (SQLException e) { } catch (SQLException e) {
intervalStatus = new IntervalStatus(0, SQL_CONNECTION_ERROR); intervalStatus = new IntervalStatus(0, SQL_CONNECTION_ERROR);
} finally{
helper.destroy();
engine.destroy();
} }
} }
......
...@@ -16,7 +16,6 @@ import javax.servlet.http.HttpServletRequest; ...@@ -16,7 +16,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.sql.SQLException;
import static com.qiwu.chatbotbackend.Config.Config.JSON_FORMAT_ERROR; import static com.qiwu.chatbotbackend.Config.Config.JSON_FORMAT_ERROR;
...@@ -42,12 +41,15 @@ public class ConfigTermServlet extends HttpServlet { ...@@ -42,12 +41,15 @@ public class ConfigTermServlet extends HttpServlet {
operationType = receiveParaneters.getString("type"); operationType = receiveParaneters.getString("type");
botId = receiveParaneters.getInteger("botId"); botId = receiveParaneters.getInteger("botId");
EngineUtils engine = null;
ConfigTermUtils configUtils = null;
SqlHelper helper = null;
try { try {
//EngineUtils engine = new EngineUtils(); //EngineUtils engine = new EngineUtils();
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
EngineUtils engine = null;
ConfigTermUtils configUtils = null;
IntervalStatus intervalStatus = null; IntervalStatus intervalStatus = null;
...@@ -67,23 +69,28 @@ public class ConfigTermServlet extends HttpServlet { ...@@ -67,23 +69,28 @@ public class ConfigTermServlet extends HttpServlet {
} }
else if(operationType.endsWith("config")){ else if(operationType.endsWith("config")){
engine = new EngineUtils(); try {
botAccount = engine.queryBotAccountByBotId(botId); engine = new EngineUtils();
System.out.println("botAccount" + botAccount); botAccount = engine.queryBotAccountByBotId(botId);
configUtils = new ConfigTermUtils(botAccount, helper, context); System.out.println("botAccount" + botAccount);
switch (operationType){ configUtils = new ConfigTermUtils(botAccount, helper, context);
case "insert_config": switch (operationType) {
configUtils.insertConfigTerm(receiveParaneters); case "insert_config":
break; configUtils.insertConfigTerm(receiveParaneters);
case "update_config": break;
configUtils.updateConfig(receiveParaneters); case "update_config":
break; configUtils.updateConfig(receiveParaneters);
case "delete_config": break;
configUtils.deleteConfig(receiveParaneters); case "delete_config":
break; configUtils.deleteConfig(receiveParaneters);
break;
}
intervalStatus = configUtils.intervalStatus;
engine.destroy();
}catch(Exception e ){
engine.destroy();
throw(new Exception());
} }
intervalStatus = configUtils.intervalStatus;
engine.destroy();
}else{ }else{
categoryUtils = new CategoryUtils(helper); categoryUtils = new CategoryUtils(helper);
switch(operationType) { switch(operationType) {
...@@ -103,7 +110,6 @@ public class ConfigTermServlet extends HttpServlet { ...@@ -103,7 +110,6 @@ public class ConfigTermServlet extends HttpServlet {
} }
intervalStatus = categoryUtils.intervalStatus; intervalStatus = categoryUtils.intervalStatus;
} }
helper.destroy();
...@@ -118,10 +124,13 @@ public class ConfigTermServlet extends HttpServlet { ...@@ -118,10 +124,13 @@ public class ConfigTermServlet extends HttpServlet {
break; break;
} }
} catch (Exception e){
} catch (SQLException e) { System.out.println(e.getMessage());
e.printStackTrace(); e.printStackTrace();
responseJSONObject.put("status", 0);
responseJSONObject.put("parameter", e.getMessage());
}finally {
helper.destroy();
} }
......
...@@ -43,10 +43,13 @@ public class MacroServlet extends HttpServlet { ...@@ -43,10 +43,13 @@ public class MacroServlet extends HttpServlet {
operationType = receiveParameters.getString("type"); operationType = receiveParameters.getString("type");
botId = receiveParameters.getInteger("botId"); botId = receiveParameters.getInteger("botId");
SqlHelper helper = null;
EngineUtils engine = null;
try { try {
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
EngineUtils engine = new EngineUtils(); engine = new EngineUtils();
botAccount = engine.queryBotAccountByBotId(botId); botAccount = engine.queryBotAccountByBotId(botId);
VariableUtils variableUtils = null; VariableUtils variableUtils = null;
...@@ -66,6 +69,9 @@ public class MacroServlet extends HttpServlet { ...@@ -66,6 +69,9 @@ public class MacroServlet extends HttpServlet {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} finally{
helper.destroy();
engine.destroy();
} }
......
...@@ -56,7 +56,8 @@ public class RecoveryServlet extends HttpServlet { ...@@ -56,7 +56,8 @@ public class RecoveryServlet extends HttpServlet {
botAccount = receiveParameters.getString("botName"); botAccount = receiveParameters.getString("botName");
botName = receiveParameters.getString("botName_yhm"); botName = receiveParameters.getString("botName_yhm");
SqlHelper helper = null;
EngineUtils engine = null;
...@@ -75,8 +76,8 @@ public class RecoveryServlet extends HttpServlet { ...@@ -75,8 +76,8 @@ public class RecoveryServlet extends HttpServlet {
List<Variable> originVariableList, variableList = data.getJSONArray("variablesList").toJavaList(Variable.class); List<Variable> originVariableList, variableList = data.getJSONArray("variablesList").toJavaList(Variable.class);
BotInfo botInfo = data.getJSONObject("botInfo").toJavaObject(BotInfo.class); BotInfo botInfo = data.getJSONObject("botInfo").toJavaObject(BotInfo.class);
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
EngineUtils engine = new EngineUtils(); engine = new EngineUtils();
ActionUtils actionUtils = new ActionUtils(engine, helper); ActionUtils actionUtils = new ActionUtils(engine, helper);
VariableUtils variableUtils = new VariableUtils(helper); VariableUtils variableUtils = new VariableUtils(helper);
...@@ -172,13 +173,13 @@ public class RecoveryServlet extends HttpServlet { ...@@ -172,13 +173,13 @@ public class RecoveryServlet extends HttpServlet {
intervalStatus = actionUtils.intervalStatus; intervalStatus = actionUtils.intervalStatus;
} }
engine.destroy();
helper.destroy();
}catch (SQLException e){ }catch (SQLException e){
intervalStatus = new IntervalStatus(0, SQL_CONNECTION_ERROR); intervalStatus = new IntervalStatus(0, SQL_CONNECTION_ERROR);
} finally{
engine.destroy();
helper.destroy();
} }
} }
......
...@@ -43,10 +43,14 @@ public class VariableServlet extends HttpServlet { ...@@ -43,10 +43,14 @@ public class VariableServlet extends HttpServlet {
operationType = receiveParameters.getString("type"); operationType = receiveParameters.getString("type");
botId = receiveParameters.getInteger("botId"); botId = receiveParameters.getInteger("botId");
SqlHelper helper = null;
EngineUtils engine = null;
try { try {
SqlHelper helper = new SqlHelper(); helper = new SqlHelper();
EngineUtils engine = new EngineUtils(); engine = new EngineUtils();
botAccount = engine.queryBotAccountByBotId(botId); botAccount = engine.queryBotAccountByBotId(botId);
VariableUtils variableUtils = null; VariableUtils variableUtils = null;
...@@ -90,12 +94,12 @@ public class VariableServlet extends HttpServlet { ...@@ -90,12 +94,12 @@ public class VariableServlet extends HttpServlet {
break; break;
} }
helper.destroy();
engine.destroy();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
helper.destroy();
engine.destroy();
} }
......
...@@ -390,9 +390,17 @@ public class ActionUtils { ...@@ -390,9 +390,17 @@ public class ActionUtils {
relationHead = condition.getString("relationHead"); relationHead = condition.getString("relationHead");
if(relationHead.equals("")) if(relationHead.equals(""))
relationHead = "#visitorname"; relationHead = "#visitorname";
//不是问号,没有加号,且不是星号,则添加问号
else if(!relationHead.equals("?") && !relationHead.startsWith("+") && !relationHead.equals("*"))
relationHead = "+" + relationHead;
relationTail = condition.getString("relationTail"); relationTail = condition.getString("relationTail");
if(relationTail.equals("")) if(relationTail.equals(""))
relationTail = "#visitorname"; relationTail = "#visitorname";
else if(!relationTail.equals("?") && !relationTail.startsWith("+") && !relationHead.equals("*"))
relationTail = "+" + relationTail;
relationName = condition.getString("relationName"); relationName = condition.getString("relationName");
//condition的属性 number、string、location //condition的属性 number、string、location
...@@ -429,7 +437,7 @@ public class ActionUtils { ...@@ -429,7 +437,7 @@ public class ActionUtils {
repeatElem = repeatList.getJSONObject(i); repeatElem = repeatList.getJSONObject(i);
if(!repeatElem.getString("repeatKeywords").startsWith("+")) if(!repeatElem.getString("repeatKeywords").startsWith("+") && !repeatElem.getString("repeatKeywords").equals(""))
repeatElem.put("repeatKeywords", "+" + repeatElem.getString("repeatKeywords")); repeatElem.put("repeatKeywords", "+" + repeatElem.getString("repeatKeywords"));
repeatText.append(repeatElem.getString("repeatString")).append("=").append(repeatElem.getString("repeatKeywords")); repeatText.append(repeatElem.getString("repeatString")).append("=").append(repeatElem.getString("repeatKeywords"));
...@@ -743,6 +751,8 @@ public class ActionUtils { ...@@ -743,6 +751,8 @@ public class ActionUtils {
case 401: case 401:
intervalStatus = new IntervalStatus(0, TOKEN_TIME_OUT); intervalStatus = new IntervalStatus(0, TOKEN_TIME_OUT);
break; break;
case 500:
intervalStatus = new IntervalStatus(0, CONDITION_BACKEND_ERROR);
default: default:
intervalStatus = new IntervalStatus(0, CONDITION_BACKEND_ERROR); intervalStatus = new IntervalStatus(0, CONDITION_BACKEND_ERROR);
} }
...@@ -765,7 +775,7 @@ public class ActionUtils { ...@@ -765,7 +775,7 @@ public class ActionUtils {
try{ try{
platformUtils = new PlatformUtils(); platformUtils = new PlatformUtils();
helper.deleteUserData(botId); //helper.deleteUserData(botId);
idList = platformUtils.queryConditionIdByTypetreeId(parameters.getJSONArray("conditionCategories")); idList = platformUtils.queryConditionIdByTypetreeId(parameters.getJSONArray("conditionCategories"));
...@@ -778,6 +788,8 @@ public class ActionUtils { ...@@ -778,6 +788,8 @@ public class ActionUtils {
patternConditionJson.put("active", false); patternConditionJson.put("active", false);
patternConditionJson.put("conditionCategory", "0:默认"); patternConditionJson.put("conditionCategory", "0:默认");
relationName = patternConditionJson.getString("relationName").replace("0", "a0").replace("-", "b0"); relationName = patternConditionJson.getString("relationName").replace("0", "a0").replace("-", "b0");
conditionExtraKeywords.putIfAbsent(DEFAULT_CONDITION + "_head", new HashSet<String>());
conditionExtraKeywords.putIfAbsent(DEFAULT_CONDITION + "_tail", new HashSet<String>());
for(int i = 1;i < 10;i++){ for(int i = 1;i < 10;i++){
//给condition的名字添加后缀,因为游戏中可能用到condition的复制,但值域和名字不一样 //给condition的名字添加后缀,因为游戏中可能用到condition的复制,但值域和名字不一样
...@@ -850,12 +862,12 @@ public class ActionUtils { ...@@ -850,12 +862,12 @@ public class ActionUtils {
} }
} }
platformUtils.destroy();
}catch (SQLException e){ }catch (SQLException e){
intervalStatus = new IntervalStatus(0, ACTION_TEXT_GENERATE_ERROR); intervalStatus = new IntervalStatus(0, ACTION_TEXT_GENERATE_ERROR);
System.out.println(e.getMessage()); System.out.println(e.getMessage());
}finally {
platformUtils.destroy();
} }
} }
......
...@@ -14,10 +14,7 @@ import com.qiwu.chatbotbackend.processing.UserInfoController; ...@@ -14,10 +14,7 @@ import com.qiwu.chatbotbackend.processing.UserInfoController;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.qiwu.chatbotbackend.Config.Config.CONFIG_INSERT_ERROR; import static com.qiwu.chatbotbackend.Config.Config.CONFIG_INSERT_ERROR;
...@@ -90,15 +87,12 @@ public class ConfigTermUtils { ...@@ -90,15 +87,12 @@ public class ConfigTermUtils {
List<Premise> curPremiseList = new ArrayList<Premise>(); List<Premise> curPremiseList = new ArrayList<Premise>();
List<Premise> hisPremiseList = new ArrayList<Premise>(); List<Premise> hisPremiseList = new ArrayList<Premise>();
Map<String, String> updateKnowledge = new HashMap<String, String>(); Map<String, String> updateKnowledge = new HashMap<String, String>();
Map<String, String> punctReplaceMap = new HashMap<String, String>(){ Map<String, String> punctReplaceMap = new LinkedHashMap<String, String>();
{ punctReplaceMap.put(",", ",");
put(",", ","); punctReplaceMap.put("|", "");
put("|", ""); punctReplaceMap.put("\r\n", "");
put("\r\n", ""); punctReplaceMap.put("\n", "");
put("\n", ""); punctReplaceMap.put("\t", "");
put("\t", "");
}
};
//解析当前信息的前置条件 //解析当前信息的前置条件
...@@ -307,7 +301,7 @@ public class ConfigTermUtils { ...@@ -307,7 +301,7 @@ public class ConfigTermUtils {
* @param replaceMap * @param replaceMap
* @return * @return
*/ */
public String textReplace(String text, Map<String, String> replaceMap){ public static String textReplace(String text, Map<String, String> replaceMap){
for(String key:replaceMap.keySet()){ for(String key:replaceMap.keySet()){
text = text.replace(key, replaceMap.get(key)); text = text.replace(key, replaceMap.get(key));
} }
......
...@@ -798,14 +798,15 @@ public class SqlHelper { ...@@ -798,14 +798,15 @@ public class SqlHelper {
boolean b; boolean b;
try { try {
String sql = "update chatbot_condition set conditionData = ?, actionText = ?, categoryInfo = ?, active = ? where botId = ? and conditionId=?"; String sql = "update chatbot_condition set conditionData = ?, actionText = ?, categoryInfo = ?, active = ?, displayOrder = ? where botId = ? and conditionId=?";
PreparedStatement ps1 = conn.prepareStatement(sql); PreparedStatement ps1 = conn.prepareStatement(sql);
ps1.setString(1, condition.getConditionJsonText()); ps1.setString(1, condition.getConditionJsonText());
ps1.setString(2, condition.getActionText()); ps1.setString(2, condition.getActionText());
ps1.setString(3, condition.getCategory()); ps1.setString(3, condition.getCategory());
ps1.setString(4, condition.getActive()); ps1.setString(4, condition.getActive());
ps1.setInt(5, condition.getBotId()); ps1.setInt(5, condition.getDisplayOrder());
ps1.setInt(6, condition.getConditionId()); ps1.setInt(6, condition.getBotId());
ps1.setInt(7, condition.getConditionId());
b = ps1.executeUpdate() == 1; b = ps1.executeUpdate() == 1;
ps1.close(); ps1.close();
...@@ -1085,6 +1086,29 @@ public class SqlHelper { ...@@ -1085,6 +1086,29 @@ public class SqlHelper {
} }
} }
public boolean deleteConditionByBotId(int botId) {
String sql = "delete from chatbot_condition where botId= ?";
boolean b;
try {
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, String.valueOf(botId));
b = ps.executeUpdate() == 1;
ps.close();
return b;
} catch (SQLException e) {
System.out.println(DELETE_OLD_CATEGORY_ERROR);
e.printStackTrace();
return false;
}
}
public boolean batchInsertVariableByBotId(int botId, ElementConstructor constructor) { public boolean batchInsertVariableByBotId(int botId, ElementConstructor constructor) {
int count[]; int count[];
...@@ -1103,6 +1127,10 @@ public class SqlHelper { ...@@ -1103,6 +1127,10 @@ public class SqlHelper {
while (iit.hasNext()) { while (iit.hasNext()) {
varName = iit.next(); varName = iit.next();
varValue = constructor.getVarInitialMap().get(varName); varValue = constructor.getVarInitialMap().get(varName);
//unknown文本可能特别长,就不插入数据库了
if(varValue.length() > 8000)
continue;
if (constructor.getConditionDescription().get(varName) == null) if (constructor.getConditionDescription().get(varName) == null)
description = ""; description = "";
else else
...@@ -1303,7 +1331,7 @@ public class SqlHelper { ...@@ -1303,7 +1331,7 @@ public class SqlHelper {
varName = iit.next(); varName = iit.next();
nameList.add(varName); nameList.add(varName);
ps.setString(1, String.valueOf(botId)); ps.setInt(1, botId);
ps.setString(2, varName); ps.setString(2, varName);
ps.addBatch(); ps.addBatch();
} }
...@@ -1348,7 +1376,7 @@ public class SqlHelper { ...@@ -1348,7 +1376,7 @@ public class SqlHelper {
} }
public JSONObject queryGameElementsByBotId(int id) { public JSONObject queryGameElementsByProjectId(int id) {
String sql = "select * from generate_json_tb where project_id = ?"; String sql = "select * from generate_json_tb where project_id = ?";
String userName = ""; String userName = "";
String result = "{}"; String result = "{}";
......
...@@ -93,6 +93,10 @@ public class ChatCache implements DisposableBean { ...@@ -93,6 +93,10 @@ public class ChatCache implements DisposableBean {
} }
public ChatCache(UserInfo userInfo, String userKey, String randKey, String botType) throws Exception { public ChatCache(UserInfo userInfo, String userKey, String randKey, String botType) throws Exception {
String k;
this.botAccount = userInfo.botAccount;
this.infoPoint = new HashMap<String, String>();
if(botType.equals("game")) { if(botType.equals("game")) {
try { try {
...@@ -100,15 +104,12 @@ public class ChatCache implements DisposableBean { ...@@ -100,15 +104,12 @@ public class ChatCache implements DisposableBean {
System.out.println("初始化时:" + this.gameEnv); System.out.println("初始化时:" + this.gameEnv);
} catch (Exception e) { } catch (Exception e) {
System.out.println(ENV_ERROR); System.out.println(ENV_ERROR);
this.infoPoint.put("error_message", ENV_ERROR); this.infoPoint.put("error_message", ENV_ERROR);
e.printStackTrace(); e.printStackTrace();
} }
} }
String k;
this.botAccount = userInfo.botAccount;
this.infoPoint = new HashMap<String, String>();
Iterator<String> iit = userInfo.varInitialMap.keySet().iterator(); Iterator<String> iit = userInfo.varInitialMap.keySet().iterator();
while (iit.hasNext()) { while (iit.hasNext()) {
k = iit.next(); k = iit.next();
......
...@@ -3,10 +3,12 @@ package com.qiwu.chatbotbackend.gameDesign; ...@@ -3,10 +3,12 @@ package com.qiwu.chatbotbackend.gameDesign;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.qiwu.chatbotbackend.db.SqlHelper; import com.qiwu.chatbotbackend.db.SqlHelper;
import com.qiwu.chatbotbackend.entity.ConfigTermText;
import com.qiwu.chatbotbackend.entity.UserInfo; import com.qiwu.chatbotbackend.entity.UserInfo;
import java.util.*; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
public class CharacterConstructor extends ElementConstructor { public class CharacterConstructor extends ElementConstructor {
...@@ -39,7 +41,7 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -39,7 +41,7 @@ public class CharacterConstructor extends ElementConstructor {
copyPattern("HOW_FIND_NPC"); copyPattern("HOW_FIND_NPC");
copyPattern("NPC_LOCATION"); copyPattern("NPC_LOCATION");
copyPattern("AOURND_NPC_CLASS"); copyPattern("AROUND_NPC_CLASS");
copyPattern("NPC_ATTR"); copyPattern("NPC_ATTR");
copyPattern("WHO_YOU_ARE"); copyPattern("WHO_YOU_ARE");
...@@ -94,7 +96,7 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -94,7 +96,7 @@ public class CharacterConstructor extends ElementConstructor {
classSet.add(className); classSet.add(className);
//替换后的名字改为类名 //替换后的名字改为类名
replaceList.get(0)[1] = className; replaceList.get(0)[1] = className;
appendReplacedKeyword("AOURND_NPC_CLASS", replaceList); appendReplacedKeyword("AROUND_NPC_CLASS", replaceList);
} }
...@@ -129,13 +131,13 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -129,13 +131,13 @@ public class CharacterConstructor extends ElementConstructor {
//同时识别zainali和wenzainali // //同时识别zainali和wenzainali
configTermText = new ConfigTermText( // configTermText = new ConfigTermText(
"zainali::match-Include=" + keywordMap.get("WHERE_I_AM_zainali") + "," + // "zainali::match-Include=" + keywordMap.get("WHERE_I_AM_zainali") + "," +
"wenzainali::match-Keyword=" + keywordMap.get("NPC_LOCATION_wenzainali").toString(), " ", // "wenzainali::match-Keyword=" + keywordMap.get("NPC_LOCATION_wenzainali").toString(), " ",
"match,return-0", "", "yaobuyao", "npc_query:queryLocationByConditionName:wenzainali" // "match,return-0", "", "yaobuyao", "npc_query:queryLocationByConditionName:wenzainali"
); // );
ConfigTermText.activateCopy(configTermText, configTermTextList, "npc"); // ConfigTermText.activateCopy(configTermText, configTermTextList, "npc");
//根据根据NPC的名字查询地点 //根据根据NPC的名字查询地点
queryTypeConfigTermGenerate(keywordMap, "NPC_LOCATION", "npc", "queryLocationByConditionName"); queryTypeConfigTermGenerate(keywordMap, "NPC_LOCATION", "npc", "queryLocationByConditionName");
...@@ -145,7 +147,7 @@ public class CharacterConstructor extends ElementConstructor { ...@@ -145,7 +147,7 @@ public class CharacterConstructor extends ElementConstructor {
//根据根据NPC类别和地点属性查询所有NPC实例 //根据根据NPC类别和地点属性查询所有NPC实例
queryTypeConfigTermGenerate(keywordMap, "AOURND_NPC_CLASS", "npc", "queryAroundNpcByClassName"); queryTypeConfigTermGenerate(keywordMap, "AROUND_NPC_CLASS", "npc", "queryAroundNpcByClassName");
//根据类名查询周围所有实例 //根据类名查询周围所有实例
......
...@@ -3,7 +3,6 @@ package com.qiwu.chatbotbackend.gameDesign; ...@@ -3,7 +3,6 @@ package com.qiwu.chatbotbackend.gameDesign;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.qiwu.chatbotbackend.db.SqlHelper; import com.qiwu.chatbotbackend.db.SqlHelper;
import com.qiwu.chatbotbackend.entity.ConfigTermText;
import com.qiwu.chatbotbackend.entity.UserInfo; import com.qiwu.chatbotbackend.entity.UserInfo;
import java.util.*; import java.util.*;
...@@ -100,12 +99,12 @@ public class ItemConstructor extends ElementConstructor { ...@@ -100,12 +99,12 @@ public class ItemConstructor extends ElementConstructor {
} }
configTermText = new ConfigTermText( // configTermText = new ConfigTermText(
"zainali::match-Include=" + keywordMap.get("WHERE_I_AM_zainali") + "," + // "zainali::match-Include=" + keywordMap.get("WHERE_I_AM_zainali") + "," +
"wenzainali::match-Keyword=" + keywordMap.get("ITEM_LOCATION_wenzainali").toString(), " ", // "wenzainali::match-Keyword=" + keywordMap.get("ITEM_LOCATION_wenzainali").toString(), " ",
"match,return-0", "", "yaobuyao", "goods_query:queryLocationByConditionName:wenzainali" // "match,return-0", "", "yaobuyao", "goods_query:queryLocationByConditionName:wenzainali"
); // );
ConfigTermText.activateCopy(configTermText, configTermTextList, "item"); // ConfigTermText.activateCopy(configTermText, configTermTextList, "item");
queryTypeConfigTermGenerate(keywordMap, "ITEM_LOCATION", "goods", "queryLocationByConditionName"); queryTypeConfigTermGenerate(keywordMap, "ITEM_LOCATION", "goods", "queryLocationByConditionName");
......
...@@ -141,7 +141,7 @@ public class MapConstructor extends ElementConstructor { ...@@ -141,7 +141,7 @@ public class MapConstructor extends ElementConstructor {
queryTypeConfigTermGenerate(keywordMap, "AROUND_THINGS", "map", "queryAroundAllBySite"); queryTypeConfigTermGenerate(keywordMap, "AROUND_THINGS", "map", "queryAroundAllBySite");
queryTypeConfigTermGenerate(keywordMap, "AROUND_PLACE", "map", "queryAroundPlace"); queryTypeConfigTermGenerate(keywordMap, "AROUND_PLACE", "map", "queryAroundPlace");
queryTypeConfigTermGenerate(keywordMap, "WHO_IN_THERE", "map", "queryInnerNpcBySite"); // queryTypeConfigTermGenerate(keywordMap, "WHO_IN_THERE", "map", "queryInnerNpcBySite");
queryTypeConfigTermGenerate(keywordMap, "TASK_IS_WHAT", "map", "queryTaskDescription"); queryTypeConfigTermGenerate(keywordMap, "TASK_IS_WHAT", "map", "queryTaskDescription");
queryTypeConfigTermGenerate(keywordMap, "WHAT_THINGS_IN_LOCATION", "map", "queryItemsInPlace"); queryTypeConfigTermGenerate(keywordMap, "WHAT_THINGS_IN_LOCATION", "map", "queryItemsInPlace");
......
...@@ -19,10 +19,6 @@ public class ActionMatcher { ...@@ -19,10 +19,6 @@ public class ActionMatcher {
Map<Integer, Action> activatedMap = new HashMap<Integer, Action>(); Map<Integer, Action> activatedMap = new HashMap<Integer, Action>();
static String POST_DATA_ERROR = "post数据有误";
static String POST_ERROR = "数据post时出错了";
static String API_ERROR = "api处理过程中出错了";
public LogWriter logWriter = null; public LogWriter logWriter = null;
public UserInfo userinfo = null; public UserInfo userinfo = null;
......
...@@ -17,9 +17,10 @@ import java.util.HashMap; ...@@ -17,9 +17,10 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import static com.qiwu.chatbotbackend.Config.Config.CHATCACHE_TIME_OUT;
public class ChatCacheController { public class ChatCacheController {
public static long TIME_OUT = 300000;
public static String CHAT_CACHE_DIR = "ChatCache/"; public static String CHAT_CACHE_DIR = "ChatCache/";
...@@ -198,7 +199,7 @@ public class ChatCacheController { ...@@ -198,7 +199,7 @@ public class ChatCacheController {
history = chatCacheMap.get(sessionKey).getInfoPoint(); history = chatCacheMap.get(sessionKey).getInfoPoint();
lastChatTime = Long.valueOf(history.get("lastUpdateTime")); lastChatTime = Long.valueOf(history.get("lastUpdateTime"));
now = System.currentTimeMillis(); now = System.currentTimeMillis();
if (now - lastChatTime > ChatCacheController.TIME_OUT) { if (now - lastChatTime > CHATCACHE_TIME_OUT) {
chatCache = chatCacheMap.get(sessionKey); chatCache = chatCacheMap.get(sessionKey);
if(chatCache != null && !chatCache.getRandKey().equals(chatCache.getUserKey()) && chatCache.isGameStart()) { if(chatCache != null && !chatCache.getRandKey().equals(chatCache.getUserKey()) && chatCache.isGameStart()) {
......
...@@ -16,6 +16,8 @@ import java.util.*; ...@@ -16,6 +16,8 @@ import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.qiwu.chatbotbackend.Config.Config.QA_FETCH_ERROR;
public class FormsPoster { public class FormsPoster {
...@@ -63,7 +65,6 @@ public class FormsPoster { ...@@ -63,7 +65,6 @@ public class FormsPoster {
while (k_iter.hasNext()) { while (k_iter.hasNext()) {
key = k_iter.next(); key = k_iter.next();
if (curInfoPoint.get(key) != null && !curInfoPoint.get(key).equals("")) if (curInfoPoint.get(key) != null && !curInfoPoint.get(key).equals(""))
//infoMap.put(key + "_cur", curInfoPoint.get(key)[0]);
pairList.add(new BasicNameValuePair(key, curInfoPoint.get(key))); pairList.add(new BasicNameValuePair(key, curInfoPoint.get(key)));
} }
...@@ -217,29 +218,34 @@ public class FormsPoster { ...@@ -217,29 +218,34 @@ public class FormsPoster {
String text,score, site = historyInfoPoint.get("site"), npc; String text,score, site = historyInfoPoint.get("site"), npc;
System.out.println(jobj.toJSONString()); 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")) {
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){ try {
List textscore = JSON.toJavaObject(pair, List.class); for (JSONArray pair : candidates) {
List textscore = JSON.toJavaObject(pair, List.class);
Pattern findTalker = Pattern.compile(TALKER); Pattern findTalker = Pattern.compile(TALKER);
if((Integer)textscore.get(1) > 90) { if ((Integer) textscore.get(1) > 90) {
Matcher m = findTalker.matcher((String)textscore.get(0)); Matcher m = findTalker.matcher((String) textscore.get(0));
if (m.find()) { if (m.find()) {
npc = m.group(1); npc = m.group(1);
if ((GameBotUtil.sameLocation((String)textscore.get(0), curInfoPoint, historyInfoPoint, gameEnv, historyInfoPoint.get("site"), logWriter) == 1)) { if ((GameBotUtil.sameLocation((String) textscore.get(0), curInfoPoint, historyInfoPoint, gameEnv, historyInfoPoint.get("site"), logWriter) == 1)) {
historyInfoPoint.put("common_answer", (String)textscore.get(0)); historyInfoPoint.put("common_answer", (String) textscore.get(0));
historyInfoPoint.put("qa_score", String.valueOf(textscore.get(1))); historyInfoPoint.put("qa_score", String.valueOf(textscore.get(1)));
break; break;
}
} }
} }
} }
}catch(Exception e){
historyInfoPoint.put("common_answer", QA_FETCH_ERROR);
historyInfoPoint.put("qa_score", "99");
} }
} }
}else { }else {
......
...@@ -28,6 +28,7 @@ public class FindCacheServlet extends HttpServlet { ...@@ -28,6 +28,7 @@ public class FindCacheServlet extends HttpServlet {
exist = ChatCacheController.findChatCache(userKey, context); exist = ChatCacheController.findChatCache(userKey, context);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
exist = false;
} }
JSONObject responseJSONObject = new JSONObject(); JSONObject responseJSONObject = new JSONObject();
......
...@@ -27,13 +27,12 @@ import java.util.*; ...@@ -27,13 +27,12 @@ import java.util.*;
import static com.qiwu.chatbotbackend.Config.Config.GAME_CONDITION_CATEGORY; import static com.qiwu.chatbotbackend.Config.Config.GAME_CONDITION_CATEGORY;
import static com.qiwu.chatbotbackend.Config.Config.GAME_WELCOME_TEXT; import static com.qiwu.chatbotbackend.Config.Config.GAME_WELCOME_TEXT;
import static com.qiwu.chatbotbackend.Config.Config.KEYWORD_DIR;
@WebServlet(name = "GameDesignServlet", urlPatterns = {"/gameDesign"}) @WebServlet(name = "GameDesignServlet", urlPatterns = {"/gameDesign"})
public class GameDesignServlet extends HttpServlet { public class GameDesignServlet extends HttpServlet {
String POST_URL = "http://localhost:1111/conditionProcess";
String KEYWORD_DIR = "keywords.txt";
//分组及其相应的id,id初始化为0, 新建分组成功后id会更新。 //分组及其相应的id,id初始化为0, 新建分组成功后id会更新。
HashMap<String, Integer> categoryMap = new HashMap<String, Integer>(){ HashMap<String, Integer> categoryMap = new HashMap<String, Integer>(){
{ {
...@@ -89,7 +88,7 @@ public class GameDesignServlet extends HttpServlet { ...@@ -89,7 +88,7 @@ public class GameDesignServlet extends HttpServlet {
JSONObject receiveParaneters = JSONObject.parseObject(jsonStr); JSONObject receiveParaneters = JSONObject.parseObject(jsonStr);
dataId = (Integer) receiveParaneters.get("id"); dataId = (Integer) receiveParaneters.get("id");
JSONObject gameElements = helper.queryGameElementsByBotId(dataId); JSONObject gameElements = helper.queryGameElementsByProjectId(dataId);
gameElements.put("auth", request.getHeader("authorization")); gameElements.put("auth", request.getHeader("authorization"));
//System.out.println(gameElements.toJSONString()); //System.out.println(gameElements.toJSONString());
...@@ -172,6 +171,8 @@ public class GameDesignServlet extends HttpServlet { ...@@ -172,6 +171,8 @@ public class GameDesignServlet extends HttpServlet {
} }
helper.batchInsertConfigByBotId(botId, jsonList, idList, categoryMap.get(moduleName2)); helper.batchInsertConfigByBotId(botId, jsonList, idList, categoryMap.get(moduleName2));
constructor.postProcessing(idList, categoryMap.get(moduleName2)); constructor.postProcessing(idList, categoryMap.get(moduleName2));
constructor.generateConfigText(idList); constructor.generateConfigText(idList);
...@@ -214,10 +215,6 @@ public class GameDesignServlet extends HttpServlet { ...@@ -214,10 +215,6 @@ public class GameDesignServlet extends HttpServlet {
} }
} }
helper.destroy();
}else { }else {
returnStatus = 0; returnStatus = 0;
...@@ -225,6 +222,8 @@ public class GameDesignServlet extends HttpServlet { ...@@ -225,6 +222,8 @@ public class GameDesignServlet extends HttpServlet {
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} finally{
helper.destroy();
} }
...@@ -261,8 +260,10 @@ public class GameDesignServlet extends HttpServlet { ...@@ -261,8 +260,10 @@ public class GameDesignServlet extends HttpServlet {
public boolean botInit(int botId, String botAccount, UserInfo userInfo, SqlHelper helper) throws SQLException, IOException { public boolean botInit(int botId, String botAccount, UserInfo userInfo, SqlHelper helper) throws SQLException, IOException {
boolean deleteConfigFlag = helper.deleteConfigByBotId(botId); boolean deleteConfigFlag = helper.deleteConfigByBotId(botId);
boolean deleteVariableFlag = helper.deleteVariableByBotId(botId); boolean deleteVariableFlag = helper.deleteVariableByBotId(botId);
boolean deleteCategoryFlag = helper.deleteCategoryByBotId(botId); boolean deleteCategoryFlag = helper.deleteCategoryByBotId(botId);
boolean batchInsertCategoryFlag = helper.batchInsertCategoryByBotId(botId, categoryMap); boolean insertCategoryFlag = helper.batchInsertCategoryByBotId(botId, categoryMap);
boolean deteteConditionFlag = helper.deleteConditionByBotId(botId);
boolean deleteArchiveFlag = ChatCacheController.deleteChatCache(helper, botAccount); boolean deleteArchiveFlag = ChatCacheController.deleteChatCache(helper, botAccount);
...@@ -295,8 +296,8 @@ public class GameDesignServlet extends HttpServlet { ...@@ -295,8 +296,8 @@ public class GameDesignServlet extends HttpServlet {
actionPostData.put("relationKeywords", additionalKeywords); actionPostData.put("relationKeywords", additionalKeywords);
actionPostData.put("botId", gameElements.getInteger("botId")); actionPostData.put("botId", gameElements.getInteger("botId"));
if(gameElements.getJSONArray("conditionCategoryIdList") != null){ if(gameElements.getJSONArray("conditionCategories") != null){
actionPostData.put("conditionCategories", gameElements.getJSONArray("conditionCategoryIdList")); actionPostData.put("conditionCategories", gameElements.getJSONArray("conditionCategories"));
}else{ }else{
actionPostData.put("conditionCategories", new JSONArray(){ actionPostData.put("conditionCategories", new JSONArray(){
{ {
......
...@@ -154,8 +154,6 @@ public class GetAnswerServlet extends HttpServlet { ...@@ -154,8 +154,6 @@ public class GetAnswerServlet extends HttpServlet {
matcher.appendDebugInfo(bestMatch, context); matcher.appendDebugInfo(bestMatch, context);
} }
//if(userinfo.varInitialMap.get("infoTransferTime") != null && userinfo.varInitialMap.get("infoTransferTime").equals("after"))
matcher.infoTransfer(bestMatch, context, debugFlag); matcher.infoTransfer(bestMatch, context, debugFlag);
...@@ -163,7 +161,7 @@ public class GetAnswerServlet extends HttpServlet { ...@@ -163,7 +161,7 @@ public class GetAnswerServlet extends HttpServlet {
//清理超时的用户数据 //清理超时的用户数据
if (context.getAttribute("cacheUpdateTime") == null) if (context.getAttribute("cacheUpdateTime") == null)
context.setAttribute("cacheUpdateTime", System.currentTimeMillis()); context.setAttribute("cacheUpdateTime", System.currentTimeMillis());
if (System.currentTimeMillis() - (long) context.getAttribute("cacheUpdateTime") > ChatCacheController.TIME_OUT) { if (System.currentTimeMillis() - (long) context.getAttribute("cacheUpdateTime") > CHATCACHE_TIME_OUT) {
ChatCacheController.updateChatCache4Delete(chatKey, context, userinfo); ChatCacheController.updateChatCache4Delete(chatKey, context, userinfo);
context.setAttribute("cacheUpdateTime", System.currentTimeMillis()); context.setAttribute("cacheUpdateTime", System.currentTimeMillis());
} }
......
...@@ -156,9 +156,10 @@ public class GameBotUtil extends BasicBotUtil{ ...@@ -156,9 +156,10 @@ public class GameBotUtil extends BasicBotUtil{
if(nameSeries.length == 4){ if(nameSeries.length == 4){
keyword = chatCache.getGameEnv().queryNpcAttrByNpcName(nameSeries[2], nameSeries[3]); keyword = chatCache.getGameEnv().queryNpcAttrByNpcName(nameSeries[2], nameSeries[3]);
}else if (nameSeries.length == 3){ }else if (nameSeries.length == 3){
if(nameSeries[1].equals("玩家") && nameSeries[2].equals("物品栏")) { if(nameSeries[2].equals("物品栏")) {
//如果是物品栏就调用专门的函数查询物品栏的所有数据
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
List<String> goods = chatCache.getGameEnv().queryGoodsByNpcName("玩家"); List<String> goods = chatCache.getGameEnv().queryGoodsByNpcName(nameSeries[1]);
for (String good : goods) { for (String good : goods) {
sb.append("+").append(good); sb.append("+").append(good);
} }
...@@ -415,6 +416,7 @@ public class GameBotUtil extends BasicBotUtil{ ...@@ -415,6 +416,7 @@ public class GameBotUtil extends BasicBotUtil{
public static Matcher findTalker(String reply){ public static Matcher findTalker(String reply){
System.out.println(reply);
Pattern findTalker = Pattern.compile(TALKER); Pattern findTalker = Pattern.compile(TALKER);
Matcher m = findTalker.matcher(reply); Matcher m = findTalker.matcher(reply);
...@@ -542,6 +544,7 @@ public class GameBotUtil extends BasicBotUtil{ ...@@ -542,6 +544,7 @@ public class GameBotUtil extends BasicBotUtil{
case "less_talker": case "less_talker":
return appendTalker(findRelateTalkers(false).get(0), reply, chatCache.getInfoPoint(), chatCache.getGameEnv()); return appendTalker(findRelateTalkers(false).get(0), reply, chatCache.getInfoPoint(), chatCache.getGameEnv());
case "to_unknown": case "to_unknown":
returnText = NO_ONE_CAN_REPLY_UNKNOWN;
Set<String> candidates = new HashSet<String>(); Set<String> candidates = new HashSet<String>();
Map<String, List<String>> npcTextMap = null; Map<String, List<String>> npcTextMap = null;
String unknownList = "", foundNPC; String unknownList = "", foundNPC;
......
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
<property name="password">3g9^pWQs#ft7</property> <property name="password">3g9^pWQs#ft7</property>
<property name="initialPoolSize">3</property> <property name="initialPoolSize">3</property>
<property name="maxIdleTime">30</property> <property name="maxIdleTime">30</property>
<property name="maxPoolSize">10</property> <property name="maxPoolSize">15</property>
<property name="minPoolSize">3</property> <property name="minPoolSize">5</property>
<property name="maxStatements">200</property> <property name="maxStatements">200</property>
</named-config> </named-config>
......
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