dff_wiki_skill fixes
@@ -367,7 +367,8 @@ def if_facts_agree(vars):
return flag
-def extract_and_save_wikipage(vars):
+def extract_and_save_wikipage(vars, save=False):
+ flag = False
user_uttr = state_utils.get_last_human_utterance(vars)
bot_uttr = state_utils.get_last_bot_utterance(vars)
shared_memory = state_utils.get_shared_memory(vars)
@@ -375,11 +376,14 @@ def extract_and_save_wikipage(vars):
for fact in cur_facts:
wikihow_page = fact.get("wikihow_page", "")
condition = fact["cond"]
- flag = check_condition(condition, user_uttr, bot_uttr, shared_memory)
- if flag and wikihow_page:
+ checked = check_condition(condition, user_uttr, bot_uttr, shared_memory)
+ if checked and wikihow_page:
+ flag = True
+ if save:
state_utils.save_to_shared_memory(vars, cur_wikihow_page=wikihow_page)
state_utils.save_to_shared_memory(vars, cur_facts={})
break
+ return flag
def check_used_subtopic_utt(vars, topic_config, subtopic):
@@ -709,6 +713,9 @@ def start_or_continue_facts(vars, topic_config):
if wikihow_page or wikipedia_page or if_facts_agree(vars):
flag = True
else:
+ checked_wikipage = extract_and_save_wikipage(vars)
+ if checked_wikipage:
+ flag = True
if cur_wikipedia_page or cur_wikihow_page and not isno:
wikihow_page_content_list = memory.get("wikihow_content", [])
wikipedia_page_content_list = memory.get("wikipedia_content", [])
@@ -743,7 +750,7 @@ def facts_response(vars, topic_config):
found_topic, first_utt, utt_can_continue, utt_conf = check_switch(vars, topic_config)
extract_and_save_entity(vars)
extract_and_save_subtopic(vars)
- extract_and_save_wikipage(vars)
+ extract_and_save_wikipage(vars, True)
if found_topic and cur_mode == "smalltalk":
if "triggers" in topic_config[found_topic]:
triggers = topic_config[found_topic]["triggers"]
