From 799babd081c8ba92f8a5ad17e25203ca4505ed53 Mon Sep 17 00:00:00 2001 From: sbaaihamza Date: Fri, 15 Mar 2024 15:02:27 +0000 Subject: [PATCH] Update actions.py --- actions/actions.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/actions/actions.py b/actions/actions.py index ba27f6b..ab3a1a0 100644 --- a/actions/actions.py +++ b/actions/actions.py @@ -47,7 +47,7 @@ def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain) -> lis # Generate recommendations try: df_recommendations = provide_recommendations(user_message_all, input_weight,THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) - # dataframe_json = df_recommendations.to_json(orient='split') + dataframe_json = df_recommendations.to_json(orient='split') except Exception as e: # print(e) dispatcher.utter_message("!! الرجاء المحاولة مرة أخرى") @@ -62,8 +62,8 @@ def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain) -> lis dispatcher.utter_message(text="اختر الوحدة المتعلقة بسؤالك", buttons=button_list) # Set the user_question value in a slot for future use - return [ SlotSet("my_dataframe_slot",input_weight)]#[SlotSet("user_question", user_message_all) , SlotSet("my_dataframe_slot",input_weight)]#SlotSet("my_dataframe_slot", dataframe_json)] - + # return [ SlotSet("my_dataframe_slot",input_weight)]#[SlotSet("user_question", user_message_all) , SlotSet("my_dataframe_slot",input_weight)]#SlotSet("my_dataframe_slot", dataframe_json)] + return [SlotSet("my_dataframe_slot", dataframe_json)] class ActionReselectModule(Action): def name(self) -> str: return "action_reselect_module" @@ -73,8 +73,8 @@ def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain) -> lis # Try reading the user track from Excel file try: my_dataframe_slot = tracker.get_slot('my_dataframe_slot') - df_recommendations = provide_recommendations("user_message_all", my_dataframe_slot, THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) -#pd.read_json(my_dataframe_slot, orient='split') + # df_recommendations = provide_recommendations("user_message_all", my_dataframe_slot, THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) + df_recommendations = pd.read_json(my_dataframe_slot, orient='split') except Exception as e: # print(e) dispatcher.utter_message(" !! خلل في تحميل البيانات") @@ -115,8 +115,8 @@ def name(self): def run(self, dispatcher, tracker, domain): try: my_dataframe_slot = tracker.get_slot('my_dataframe_slot') - df_rslt = provide_recommendations("user_message_all", my_dataframe_slot,THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) - #df_rslt = pd.read_json(my_dataframe_slot, orient='split') + # df_rslt = provide_recommendations("user_message_all", my_dataframe_slot,THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) + df_rslt = pd.read_json(my_dataframe_slot, orient='split') try: module_number = tracker.get_slot('module_id') situation_ids,situation_names=situation_recommendations(df_rslt,int(module_number),n=n_situation) @@ -166,8 +166,8 @@ def run(self, dispatcher, tracker, domain): try: my_dataframe_slot = tracker.get_slot('my_dataframe_slot') - df_rslt = provide_recommendations("user_message_all", my_dataframe_slot,THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) - # df_rslt = pd.read_json(my_dataframe_slot, orient='split') + # df_rslt = provide_recommendations("user_message_all", my_dataframe_slot,THRESH=0.3, n=1000, unique_values_dict=unique_values_dict, BERT_weights=BERT_weights,n_module=n_module) + df_rslt = pd.read_json(my_dataframe_slot, orient='split') except Exception as e: # print(e) dispatcher.utter_message(" !! خلل في تحميل البيانات")