Improve KB upload
This commit is contained in:
@@ -120,6 +120,19 @@ class TestKnowledgeAPI:
|
||||
assert "id" in data
|
||||
assert data["status"] == "pending"
|
||||
|
||||
def test_upload_file_auto_index(self, client):
|
||||
"""Test uploading a real file triggers auto indexing."""
|
||||
create_response = client.post("/api/knowledge/bases", json={"name": "Auto Index KB"})
|
||||
kb_id = create_response.json()["id"]
|
||||
|
||||
content = "Line one about product.\nLine two about warranty."
|
||||
files = {"file": ("auto-index.txt", content.encode("utf-8"), "text/plain")}
|
||||
response = client.post(f"/api/knowledge/bases/{kb_id}/documents", files=files)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["status"] == "completed"
|
||||
assert data["chunkCount"] >= 1
|
||||
|
||||
def test_delete_document(self, client):
|
||||
"""Test deleting a document from knowledge base"""
|
||||
# Create KB first
|
||||
|
||||
Reference in New Issue
Block a user