Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

chore: fix letta server file read issue (#685)

Shubham Naik690cfd24525c
diff --git a/letta/settings.py b/letta/settings.py
index dde4cecb2..da3e429fb 100644
--- a/letta/settings.py
+++ b/letta/settings.py
@@ -83,12 +83,16 @@ cors_origins = [
# read pg_uri from ~/.letta/pg_uri or set to none, this is to support Letta Desktop
default_pg_uri = None
-try:
- with open(Path.home() / ".letta/pg_uri", "r") as f:
- default_pg_uri = f.read()
- print("Read pg_uri from ~/.letta/pg_uri")
-except FileNotFoundError:
- pass
+## check if --use-file-pg-uri is passed
+import sys
+
+if "--use-file-pg-uri" in sys.argv:
+ try:
+ with open(Path.home() / ".letta/pg_uri", "r") as f:
+ default_pg_uri = f.read()
+ print("Read pg_uri from ~/.letta/pg_uri")
+ except FileNotFoundError:
+ pass
class Settings(BaseSettings):