From 17e1f2553119e69584b7fadc5a859f592b599793 Mon Sep 17 00:00:00 2001 From: ViperEkura <3081035982@qq.com> Date: Thu, 26 Mar 2026 15:31:07 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9workspaces=20?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index e5eef25..a5fb627 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -22,12 +22,13 @@ def _get_database_uri(cfg: dict) -> str: if db_type == "sqlite": # SQLite: sqlite:///path/to/database.db - db_file = cfg.get("db_sqlite_file", "app.db") - # Store in instance folder for better organization - instance_path = Path(__file__).parent.parent / "instance" - instance_path.mkdir(exist_ok=True) - db_path = instance_path / db_file - return f"sqlite:///{db_path}" + db_file = cfg.get("db_sqlite_file", "nano_claw.db") + # Store in workspace root directory (resolve relative to project root) + project_root = CONFIG_PATH.parent + workspace_root = project_root / cfg.get("workspace_root", "workspaces") + workspace_root.mkdir(parents=True, exist_ok=True) + db_path = workspace_root / db_file + return f"sqlite:///{db_path.resolve()}" elif db_type == "postgresql": # PostgreSQL: postgresql://user:password@host:port/database