Skip to content

Commit

Permalink
edit: main func now sends processed queries from the gcloud to supabase
Browse files Browse the repository at this point in the history
  • Loading branch information
ayyubibrahimi committed Dec 7, 2023
1 parent 07c647f commit b7dcf87
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions packages/googlecloud/functions/getanswer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import time
import math

# blocking google cloud for local deploy
#import google.cloud.logging
import google.cloud.logging
import functions_framework
from supabase import create_client
from dotenv import find_dotenv, load_dotenv
Expand All @@ -12,8 +11,8 @@
import os
import json

#logging_client = google.cloud.logging.Client()
#logging_client.setup_logging()
logging_client = google.cloud.logging.Client()
logging_client.setup_logging()

API_VERSION = "0.0.1"

Expand All @@ -22,8 +21,7 @@
# Setup Supabase client
load_dotenv(find_dotenv())

# disabled for local deploy, reenable for web
"""

try:
supabase_url = os.environ["SUPABASE_URL_PRODUCTION"]
supabase_key = os.environ["SUPABASE_SERVICE_KEY_PRODUCTION"]
Expand All @@ -35,7 +33,6 @@
raise ValueError("Supabase URL and key must be set in environment variables")

supabase = create_client(supabase_url, supabase_key)
"""

def update_supabase(responses, citations, card_id, processing_time_ms):
transformed_citations = []
Expand Down Expand Up @@ -122,14 +119,11 @@ def getanswer(request):
end = time.time()
elapsed = int((end - start) * 1000)

#
return(answer)

# disabled for local deployment, reenable for web
"""
update_supabase(responses_data, citations_data, card_id, elapsed)
logging.info(f"Completed getanswer in {elapsed} seconds")
print(f"\n\t--------- Completed getanswer in {elapsed} seconds --------\n")

return ("Answer successfully submitted to Supabase", 200, headers)
"""



0 comments on commit b7dcf87

Please sign in to comment.