Skip to content

Commit

Permalink
Merge pull request #149 from eye-on-surveillance/AI/misc-bugs
Browse files Browse the repository at this point in the history
AI/misc-bugs
  • Loading branch information
ayyubibrahimi authored Nov 14, 2023
2 parents aa73442 + 1040f86 commit 38c6a8b
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):
def update_supabase(response, query, response_type):
# Assume you have a table named 'answers' with a column named 'answer'
response = supabase.table('cards').insert({'title': query, 'responses': response}).execute()
response = supabase.table('cards').insert({'title': query, 'responses': response, 'card_type': response_type}).execute()
if response.error:
logging.error(f"Failed to update Supabase: {response.error}")

Expand Down Expand Up @@ -74,7 +74,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)
update_supabase(answer, query, response_type)

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

0 comments on commit 38c6a8b

Please sign in to comment.