From 1d03987fd70aab5d958579196b07365be1eb64e0 Mon Sep 17 00:00:00 2001 From: Devin Gaffney Date: Tue, 27 Aug 2024 11:56:48 -0700 Subject: [PATCH] simplify calls and bring back in line with latest naming convention --- app/lib/smooch_nlu.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/lib/smooch_nlu.rb b/app/lib/smooch_nlu.rb index 1b4490480..e1b8b0d33 100644 --- a/app/lib/smooch_nlu.rb +++ b/app/lib/smooch_nlu.rb @@ -44,14 +44,10 @@ def update_keywords(language, keywords, keyword, operation, doc_id, context) } if operation == 'add' && !keywords.include?(keyword) keywords << keyword - alegre_operation = 'post' - alegre_params = common_alegre_params.merge({ text: keyword, models: ALEGRE_MODELS_AND_THRESHOLDS.keys }) - Bot::Alegre.get_sync_raw_params(alegre_params, "text") if alegre_operation && alegre_params + Bot::Alegre.get_sync_with_params(common_alegre_params.merge({ text: keyword, models: ALEGRE_MODELS_AND_THRESHOLDS.keys }), "text") elsif operation == 'remove' keywords -= [keyword] - alegre_operation = 'delete' - alegre_params = common_alegre_params.merge({ quiet: true }) - Bot::Alegre.request_delete_from_raw(alegre_params, "text") if alegre_operation && alegre_params + Bot::Alegre.request_delete_from_raw(common_alegre_params.merge({ quiet: true }), "text") end keywords end @@ -91,7 +87,7 @@ def self.alegre_matches_from_message(message, language, context, alegre_result_k language: language, }.merge(context) } - response = Bot::Alegre.get_sync_raw_params(params, "text") + response = Bot::Alegre.get_sync_with_params(params, "text") # One approach would be to take the option that has the most matches # Unfortunately this approach is influenced by the number of keywords per option