chore: 修改workspaces 目录

This commit is contained in:
ViperEkura 2026-03-26 15:31:07 +08:00
parent eff0700145
commit 17e1f25531
1 changed files with 7 additions and 6 deletions

View File

@ -22,12 +22,13 @@ def _get_database_uri(cfg: dict) -> str:
if db_type == "sqlite": if db_type == "sqlite":
# SQLite: sqlite:///path/to/database.db # SQLite: sqlite:///path/to/database.db
db_file = cfg.get("db_sqlite_file", "app.db") db_file = cfg.get("db_sqlite_file", "nano_claw.db")
# Store in instance folder for better organization # Store in workspace root directory (resolve relative to project root)
instance_path = Path(__file__).parent.parent / "instance" project_root = CONFIG_PATH.parent
instance_path.mkdir(exist_ok=True) workspace_root = project_root / cfg.get("workspace_root", "workspaces")
db_path = instance_path / db_file workspace_root.mkdir(parents=True, exist_ok=True)
return f"sqlite:///{db_path}" db_path = workspace_root / db_file
return f"sqlite:///{db_path.resolve()}"
elif db_type == "postgresql": elif db_type == "postgresql":
# PostgreSQL: postgresql://user:password@host:port/database # PostgreSQL: postgresql://user:password@host:port/database