diff --git a/packages/googlecloud/functions/getanswer/main.py b/packages/googlecloud/functions/getanswer/main.py index 529ba43d..0850dea5 100644 --- a/packages/googlecloud/functions/getanswer/main.py +++ b/packages/googlecloud/functions/getanswer/main.py @@ -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}") @@ -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)