Refactor code structure for improved readability and maintainability

This commit is contained in:
ash66
2026-05-14 18:09:15 +08:00
parent 10d04c4083
commit 35cd927d02
105 changed files with 9043 additions and 7720 deletions

View File

@@ -6,11 +6,12 @@ from loguru import logger
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(PROJECT_ROOT, "backend"))
from src.services.storage.milvus_client import MilvusClient, SearchResult
from src.services.embedding.bge_m3_embedder import BGEM3Embedder
from src.config.settings import settings
from app.services.storage.milvus_client import MilvusClient, SearchResult
from app.services.embedding.bge_m3_embedder import BGEM3Embedder
from app.config.settings import settings
class TestMilvusConnection:
@@ -55,7 +56,7 @@ class TestMilvusOperations:
def test_insert_and_search(self, client):
"""测试插入和检索"""
from src.services.embedding.text_chunker import TextChunk, ChunkMetadata
from app.services.embedding.text_chunker import TextChunk, ChunkMetadata
# 创建测试数据
chunks = [
@@ -133,4 +134,4 @@ class TestEmbedding:
if __name__ == "__main__":
pytest.main([__file__, "-v"])
pytest.main([__file__, "-v"])