Skip to content

Commit

Permalink
Merge pull request #155 from eye-on-surveillance/AI/request-flow-fix
Browse files Browse the repository at this point in the history
AI/request-flow-fix
  • Loading branch information
ayyubibrahimi authored Nov 14, 2023
2 parents 6a536d5 + d1cebb3 commit 19dbe62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/googlecloud/functions/getanswer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
supabase_key = os.environ.get("SUPABASE_SERVICE_KEY_STAGING")
supabase = create_client(supabase_url, supabase_key)

def update_supabase(response, query, response_type, card_id):
def update_supabase(response, card_id):
try:
response = supabase.table('cards').update({'title': query, 'card_type': response_type, 'responses': response}).eq('id', card_id).execute()
response = supabase.table('cards').update({'responses': response}).eq('id', card_id).execute()
logging.info("Data successfully inserted into Supabase")
except Exception as e:
logging.error(f"Failed to update Supabase: {e}")
Expand Down Expand Up @@ -77,7 +77,7 @@ def getanswer(request):
answer = answer_query(query, response_type, voting_roll_df, db_general, db_in_depth)

# Update Supabase instead of returning the answer to the client
update_supabase(answer, query, response_type, card_id)
update_supabase(answer, card_id)

end = time.time()
elapsed = math.ceil(end - start)
Expand Down

0 comments on commit 19dbe62

Please sign in to comment.