From bde0f4784363be388ec6cee3029e540ee672538e Mon Sep 17 00:00:00 2001 From: ahmed531998 Date: Thu, 6 Apr 2023 21:54:35 +0200 Subject: [PATCH] add_recommend_functionality --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e6a99fa..49f901f 100644 --- a/main.py +++ b/main.py @@ -77,11 +77,17 @@ def predict(): state = nlu.process_utterance(text, dm.get_consec_history(), dm.get_sep_history()) state['help'] = False state['inactive'] = False + old_user_interests = user.get_user_interests() + old_vre_material = pd.concat([vre.db['paper_db'], vre.db['dataset_db']]).drop_duplicates(keep=False).reset_index(drop=True) user_interests = [] for entity in state['entities']: if entity['entity'] == 'TOPIC': user_interests.append(entity['value']) user.update_interests(user_interests) + new_user_interests = user.get_user_interests() + new_vre_material = pd.concat([vre.db['paper_db'], vre.db['dataset_db']]).drop_duplicates(keep=False).reset_index(drop=True) + if (new_user_interests() != old_user_interests or old_vre_material != new_vre_material): + rec.generate_recommendations(new_user_interests, new_vre_material) dm.update(state) action = dm.next_action() response = rg.gen_response(action=action, utterance=state['modified_query'], state=dm.get_recent_state(), consec_history=dm.get_consec_history()) @@ -167,4 +173,4 @@ if __name__ == "__main__": 'response_intent text NOT NULL);' ) conn.commit() - app.run(host='0.0.0.0', port=4000) + app.run(host='0.0.0.0')