mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
feat: Editor.read + file size检查
This commit is contained in:
parent
d37954d43a
commit
dccd199249
2 changed files with 13 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ from metagpt.tools.libs.editor import Editor
|
|||
from metagpt.tools.libs.index_repo import (
|
||||
CHATS_INDEX_ROOT,
|
||||
CHATS_ROOT,
|
||||
DEFAULT_MIN_TOKEN_COUNT,
|
||||
UPLOAD_ROOT,
|
||||
IndexRepo,
|
||||
)
|
||||
|
|
@ -780,8 +781,10 @@ async def test_similarity_search(query, filename):
|
|||
@pytest.mark.asyncio
|
||||
async def test_read():
|
||||
editor = Editor()
|
||||
content = await editor.read(str(TEST_DATA_PATH / "pdf/9112674.pdf"))
|
||||
assert "similarity_search" in content.block_content
|
||||
filename = TEST_DATA_PATH / "pdf/9112674.pdf"
|
||||
content = await editor.read(str(filename))
|
||||
size = filename.stat().st_size
|
||||
assert "similarity_search" in content.block_content and size > 5 * DEFAULT_MIN_TOKEN_COUNT
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue