refactor: 客服agent的切片结构调整重构

This commit is contained in:
2026-09-11 17:31:16 +08:00
parent b1b764eac9
commit e561c97a4e
20 changed files with 3309 additions and 230 deletions
+4 -4
View File
@@ -1,18 +1,18 @@
import unittest
from rag.embedding import EmbeddingError, embed_texts
from rag.embedding import EMBEDDING_DIMENSION, EmbeddingError, embed_texts
class EmbeddingTests(unittest.IsolatedAsyncioTestCase):
async def test_returns_768_dimension_vectors(self):
async def test_returns_configured_dimension_vectors(self):
class Client:
async def embed(self, texts):
return [[0.1] * 768 for _ in texts]
return [[0.1] * EMBEDDING_DIMENSION for _ in texts]
vectors = await embed_texts(["基金知识"], client=Client())
self.assertEqual(len(vectors), 1)
self.assertEqual(len(vectors[0]), 768)
self.assertEqual(len(vectors[0]), EMBEDDING_DIMENSION)
async def test_rejects_wrong_embedding_dimension(self):
class Client: