Skip to content

Commit 35fa5ee

Browse files
committed
feat(cli): configurable chromadb log path. Fix #63.
1 parent f2cbcec commit 35fa5ee

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vectorcode/cli_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Config:
7272
n_result: int = 1
7373
force: bool = False
7474
db_path: Optional[str] = "~/.local/share/vectorcode/chromadb/"
75+
db_log_path: str = "~/.local/share/vectorcode/"
7576
db_settings: Optional[dict] = None
7677
chunk_size: int = 2500
7778
overlap_ratio: float = 0.2
@@ -110,6 +111,9 @@ async def import_from(cls, config_dict: dict[str, Any]) -> "Config":
110111
"host": host,
111112
"port": port,
112113
"db_path": db_path,
114+
"db_log_path": os.path.expanduser(
115+
config_dict.get("db_log_path", "~/.local/share/vectorcode/")
116+
),
113117
"chunk_size": config_dict.get("chunk_size", 2500),
114118
"overlap_ratio": config_dict.get("overlap_ratio", 0.2),
115119
"query_multiplier": config_dict.get("query_multiplier", -1),

src/vectorcode/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async def start_server(configs: Config):
9292
"--path",
9393
db_path,
9494
"--log-path",
95-
os.path.join(str(configs.project_root), "chroma.log"),
95+
os.path.join(str(configs.db_log_path), "chroma.log"),
9696
stdout=subprocess.DEVNULL,
9797
stderr=sys.stderr,
9898
env=env,

tests/test_cli_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ async def test_config_import_from():
4141
}
4242
config = await Config.import_from(config_dict)
4343
assert config.db_path == db_path
44+
assert config.db_log_path == os.path.expanduser("~/.local/share/vectorcode/")
4445
assert config.host == "test_host"
4546
assert config.port == 1234
4647
assert config.embedding_function == "TestEmbedding"

tests/test_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ async def test_start_server():
390390
"--path",
391391
temp_dir,
392392
"--log-path",
393-
os.path.join(temp_dir, "chroma.log"),
393+
os.path.join(str(config.db_log_path), "chroma.log"),
394394
]
395395
assert args[0] == sys.executable
396396
assert tuple(args[1:]) == tuple(expected_args[1:])

0 commit comments

Comments
 (0)