Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
chore: fix up code to allow letta desktop work properly (#670)
Shubham Naik97e823d29ad3
diff --git a/alembic/versions/88f9432739a9_add_jobtype_to_job_table.py b/alembic/versions/88f9432739a9_add_jobtype_to_job_table.pyindex 199173dbc..1c0090d96 100644--- a/alembic/versions/88f9432739a9_add_jobtype_to_job_table.py+++ b/alembic/versions/88f9432739a9_add_jobtype_to_job_table.py@@ -11,7 +11,6 @@ from typing import Sequence, Unionimport sqlalchemy as safrom alembic import op-from letta.orm.enums import JobType# revision identifiers, used by Alembic.revision: str = "88f9432739a9"@@ -25,8 +24,7 @@ def upgrade() -> None:op.add_column("jobs", sa.Column("job_type", sa.String(), nullable=True))# Set existing rows to have the default value of JobType.JOB- job_value = JobType.JOB.value- op.execute(f"UPDATE jobs SET job_type = '{job_value}' WHERE job_type IS NULL")+ op.execute(f"UPDATE jobs SET job_type = 'job' WHERE job_type IS NULL")# Make the column non-nullable after setting default valuesop.alter_column("jobs", "job_type", existing_type=sa.String(), nullable=False)diff --git a/letta/settings.py b/letta/settings.pyindex 0d5f9f804..b8dd17bf3 100644--- a/letta/settings.py+++ b/letta/settings.py@@ -74,6 +74,16 @@ cors_origins = ["http://localhost:4200",]+# 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+class Settings(BaseSettings):model_config = SettingsConfigDict(env_prefix="letta_", extra="ignore")@@ -88,7 +98,7 @@ class Settings(BaseSettings):pg_password: Optional[str] = Nonepg_host: Optional[str] = Nonepg_port: Optional[int] = None- pg_uri: Optional[str] = None # option to specify full uri+ pg_uri: Optional[str] = default_pg_uri # option to specify full uripg_pool_size: int = 20 # Concurrent connectionspg_max_overflow: int = 10 # Overflow limitpg_pool_timeout: int = 30 # Seconds to wait for a connection