This commit is contained in:
@@ -59,13 +59,12 @@ ENV DEBUG=false
|
|||||||
# 安装依赖
|
# 安装依赖
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# 复制本地模型文件到镜像(如果有)
|
# 复制本地模型文件到镜像(如果有)
|
||||||
COPY docker/models/*.whl /tmp/models/ 2>/dev/null || true
|
# 注意:docker/models/ 目录需要在构建上下文中存在
|
||||||
|
COPY docker/models/ /tmp/models/
|
||||||
|
|
||||||
# 安装本地模型 wheel(如果有)
|
# 安装本地模型 wheel(如果有 .whl 文件)
|
||||||
RUN if [ -n "$(ls -A /tmp/models/ 2>/dev/null)" ]; then \
|
RUN find /tmp/models -name "*.whl" -type f 2>/dev/null | head -1 | xargs -r pip install --no-cache-dir && \
|
||||||
pip install --no-cache-dir /tmp/models/*.whl && \
|
rm -rf /tmp/models
|
||||||
rm -rf /tmp/models; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 设置 pip 国内镜像源
|
# 设置 pip 国内镜像源
|
||||||
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ async def test_tool_calling(agent_service):
|
|||||||
print(f"使用 user_id: {user_id}")
|
print(f"使用 user_id: {user_id}")
|
||||||
|
|
||||||
# 发送需要 RAG 搜索的问题
|
# 发送需要 RAG 搜索的问题
|
||||||
print("\n发送消息: '请告诉我,打虎英雄是谁?'")
|
print("\n发送消息: '请告诉我,黄双银在魔王大陆的故事?'")
|
||||||
result = await agent_service.process_message(
|
result = await agent_service.process_message(
|
||||||
"请告诉我,打虎英雄是谁?", thread_id, "local", user_id
|
"请告诉我,黄双银在魔王大陆的故事?", thread_id, "local", user_id
|
||||||
)
|
)
|
||||||
print(f"回复: {result['reply'][:200]}...")
|
print(f"回复: {result['reply'][:200]}...")
|
||||||
|
|
||||||
# 检查是否调用了 RAG 工具(回复中会有水浒传相关内容)
|
# 检查是否调用了 RAG 工具(回复中会有黄双银相关内容)
|
||||||
if "武松" in result['reply'] or "李忠" in result['reply'] or "水浒传" in result['reply']:
|
if "黄双银" in result['reply']:
|
||||||
print("\n✅ 工具调用测试通过!")
|
print("\n✅ 工具调用测试通过!")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ async def test_index_builder():
|
|||||||
|
|
||||||
# 创建 IndexBuilder 实例
|
# 创建 IndexBuilder 实例
|
||||||
builder = IndexBuilder(
|
builder = IndexBuilder(
|
||||||
collection_name="test_collection",
|
collection_name="rag_documents",
|
||||||
splitter_type=SplitterType.PARENT_CHILD,
|
splitter_type=SplitterType.PARENT_CHILD,
|
||||||
parent_chunk_size=1000,
|
parent_chunk_size=1000,
|
||||||
child_chunk_size=200
|
child_chunk_size=200
|
||||||
)
|
)
|
||||||
|
|
||||||
# 测试文档路径
|
# 测试文档路径
|
||||||
test_file = os.path.join(os.path.dirname(__file__), "..", "data", "user_docs", "a.txt")
|
test_file = os.path.join(os.path.dirname(__file__), "..", "data", "user_docs", "doublestory.txt")
|
||||||
|
|
||||||
if os.path.exists(test_file):
|
if os.path.exists(test_file):
|
||||||
# 构建索引
|
# 构建索引
|
||||||
|
|||||||
Reference in New Issue
Block a user