Update agent.py
Browse files
agent.py
CHANGED
|
@@ -16,29 +16,15 @@ from langchain_core.tools import tool
|
|
| 16 |
from langchain.tools.retriever import create_retriever_tool
|
| 17 |
from supabase.client import Client, create_client
|
| 18 |
|
| 19 |
-
import
|
| 20 |
-
from dotenv import load_dotenv
|
| 21 |
-
from supabase import create_client, Client
|
| 22 |
-
|
| 23 |
-
# Load variables from .env into environment
|
| 24 |
-
load_dotenv()
|
| 25 |
-
|
| 26 |
-
# Get environment variables
|
| 27 |
-
SUPABASE_URL = os.getenv("SUPABASE_URL", "").strip()
|
| 28 |
-
SUPABASE_KEY = os.getenv("SUPABASE_KEY", "").strip()
|
| 29 |
|
| 30 |
-
|
| 31 |
-
print("DEBUG: SUPABASE_URL =", SUPABASE_URL)
|
| 32 |
-
print("DEBUG: SUPABASE_KEY is set:", bool(SUPABASE_KEY))
|
| 33 |
-
print("DEBUG: SUPABASE_KEY repr:", repr(SUPABASE_KEY)) # optional
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
|
| 41 |
-
print("✅ Supabase client initialized successfully.")
|
| 42 |
|
| 43 |
|
| 44 |
|
|
|
|
| 16 |
from langchain.tools.retriever import create_retriever_tool
|
| 17 |
from supabase.client import Client, create_client
|
| 18 |
|
| 19 |
+
from supabase import create_client
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
supabase = None
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
def init_supabase_client(url, key):
|
| 24 |
+
global supabase
|
| 25 |
+
supabase = create_client(url, key)
|
| 26 |
|
| 27 |
+
# Now you can use `supabase` in your agent code safely.
|
|
|
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
|