diff --git a/NLU.py b/NLU.py index 4876f8c..5fcdf0f 100644 --- a/NLU.py +++ b/NLU.py @@ -88,7 +88,7 @@ class NLU: """ Query -> coref resolution & intent extraction -> if intents are not confident or if query is ambig -> rewrite query and recheck -> if still ambig, ask a clarifying question """ - if utterance in ["help", "list resources", "list papers", "list datasets", "list topics"]: + if utterance.lower() in ["help", "list resources", "list papers", "list datasets", "list topics"]: return {"modified_query": utterance, "intent": "COMMAND", "entities": [], "is_offensive": False, "is_clear": True} self.to_process = utterance diff --git a/ResponseGenerator.py b/ResponseGenerator.py index 26e03e3..cd1bd12 100644 --- a/ResponseGenerator.py +++ b/ResponseGenerator.py @@ -255,7 +255,7 @@ class ResponseGenerator: return self.gen_response(action="listCommands") elif action == "sumPaper": - if len(self.paper) == 0 or (len(self.paper) > 0 and len(state['entities'])>0) + if len(self.paper) == 0 or (len(self.paper) > 0 and len(state['entities'])>0): for entity in state['entities']: if (entity['entity'] == 'TITLE'): paper = self._get_matching_titles('paper_db', entity['value']) diff --git a/main.py b/main.py index 8fcdb83..0202b4d 100644 --- a/main.py +++ b/main.py @@ -159,6 +159,7 @@ def feedback(): data['speed'], data['intent'])) conn.commit() cur.close() + reply = jsonify({"status": "done"}) return reply @@ -198,6 +199,7 @@ if __name__ == "__main__": threading.Thread(target=vre_fetch, name='updatevre').start() threading.Thread(target=clear_inactive, name='clear').start() + conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD")) cur = conn.cursor() @@ -219,4 +221,5 @@ if __name__ == "__main__": ) conn.commit() cur.close() + app.run(host='0.0.0.0')