Skip to content

Commit

Permalink
Merge pull request #150 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 38c6a8b + ed6a4f1 commit e088d23
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/googlecloud/functions/getanswer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@
supabase = create_client(supabase_url, supabase_key)

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, 'card_type': response_type}).execute()
if response.error:
logging.error(f"Failed to update Supabase: {response.error}")
# Insert data into the Supabase table
result = supabase.table('cards').insert({'title': query, 'card_type': response_type, 'responses': response}).execute()

# Check for errors in the response
if result.status_code != 200: # or another appropriate success code
# Log the error or handle it as per your application logic
logging.error(f"Failed to update Supabase: {result}")
else:
# Handle successful insertion
logging.info("Data successfully inserted into Supabase")

@functions_framework.http
def getanswer(request):
Expand Down

0 comments on commit e088d23

Please sign in to comment.