refactor: 客服agent的切片结构调整重构
This commit is contained in:
@@ -9,6 +9,7 @@ from api.chat.knowledge import (
|
||||
list_documents,
|
||||
preview_document_upload,
|
||||
)
|
||||
from rag.embedding import EMBEDDING_DIMENSION
|
||||
from service.knowledge_base.upload import KnowledgeUploadService
|
||||
from types import SimpleNamespace
|
||||
|
||||
@@ -65,14 +66,13 @@ class KnowledgeRouterTests(unittest.IsolatedAsyncioTestCase):
|
||||
service = KnowledgeUploadService(
|
||||
storage_dir=tmp,
|
||||
milvus_client=AsyncMock(),
|
||||
embedder=AsyncMock(return_value=[[0.0] * 768]),
|
||||
embedder=AsyncMock(return_value=[[0.0] * EMBEDDING_DIMENSION]),
|
||||
publisher=AsyncMock(),
|
||||
)
|
||||
preview = await service.preview("faq.md", b"Q: Q\nA: A", strategy="qa_pair")
|
||||
request = FakeRequest(
|
||||
service,
|
||||
json_data={
|
||||
"upload_id": preview["upload_id"],
|
||||
form_data={
|
||||
"file": FakeUpload("faq.md", b"Q: Q\nA: A"),
|
||||
"title": "FAQ",
|
||||
"doc_id": "doc-1",
|
||||
"collection_name": "fin_faq",
|
||||
@@ -144,4 +144,4 @@ class KnowledgeRouterTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user