feat: persist_path

This commit is contained in:
莘权 马 2024-09-04 19:11:45 +08:00
parent ed0b9e33bc
commit aa710129f7
2 changed files with 13 additions and 12 deletions

View file

@ -10,7 +10,7 @@ from metagpt.tools.libs.index_repo import IndexRepo
@pytest.mark.parametrize(("path", "query"), [(TEST_DATA_PATH / "requirements", "业务线")])
async def test_index_repo(path, query):
index_path = DEFAULT_WORKSPACE_ROOT / ".index"
repo = IndexRepo(filename=str(index_path), root_path=str(path), min_token_count=0)
repo = IndexRepo(persist_path=str(index_path), root_path=str(path), min_token_count=0)
await repo.add([path])
await repo.add([path])
assert index_path.exists()
@ -18,7 +18,7 @@ async def test_index_repo(path, query):
rsp = await repo.search(query)
assert rsp
repo2 = IndexRepo(filename=str(index_path), root_path=str(path), min_token_count=0)
repo2 = IndexRepo(persist_path=str(index_path), root_path=str(path), min_token_count=0)
rsp2 = await repo2.search(query)
assert rsp2