Compare commits
No commits in common. "94507214cea8af4b9ca516413f753ce0388f9ab7" and "43a4a1f4585a3fdf87a50d7b21b23798d29a5ef9" have entirely different histories.
94507214ce
...
43a4a1f458
|
@ -38,9 +38,3 @@ temp/
|
|||
htmlcov/
|
||||
.coverage
|
||||
.pytest_cache/
|
||||
|
||||
# 测试报告文件
|
||||
*_test_report.md
|
||||
concurrent_test_report.md
|
||||
performance_metrics_*.json
|
||||
performance_chart.png
|
24
README.md
24
README.md
|
@ -102,12 +102,12 @@ python run_tests.py all
|
|||
|
||||
### 健康检查
|
||||
```
|
||||
GET /api/health
|
||||
GET /health
|
||||
```
|
||||
|
||||
### 上传文档
|
||||
```
|
||||
POST /api/upload
|
||||
POST /upload
|
||||
Content-Type: multipart/form-data
|
||||
|
||||
参数:
|
||||
|
@ -116,7 +116,7 @@ Content-Type: multipart/form-data
|
|||
|
||||
### 查询问答
|
||||
```
|
||||
POST /api/chat
|
||||
POST /chat
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ Content-Type: application/json
|
|||
|
||||
### 流式聊天问答 🆕
|
||||
```
|
||||
POST /api/chat/stream
|
||||
POST /chat/stream
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ Content-Type: application/json
|
|||
|
||||
### 获取文档列表
|
||||
```
|
||||
GET /api/documents
|
||||
GET /documents
|
||||
|
||||
返回文档列表,包含文档ID、文件名、上传时间等信息
|
||||
```
|
||||
|
@ -206,13 +206,13 @@ easy-rag/
|
|||
./start.sh
|
||||
|
||||
# 2. 上传文档
|
||||
curl -X POST "http://localhost:8000/api/upload" \
|
||||
curl -X POST "http://localhost:8000/upload" \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "file=@your_document.pdf"
|
||||
|
||||
# 3. 查询问答
|
||||
curl -X POST "http://localhost:8000/api/chat" \
|
||||
curl -X POST "http://localhost:8000/chat" \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
|
@ -221,7 +221,7 @@ curl -X POST "http://localhost:8000/api/chat" \
|
|||
}'
|
||||
|
||||
# 4. 流式聊天问答
|
||||
curl -X POST "http://localhost:8000/api/chat/stream" \
|
||||
curl -X POST "http://localhost:8000/chat/stream" \
|
||||
-H "accept: text/plain" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
|
@ -239,13 +239,13 @@ import json
|
|||
# 上传文档
|
||||
with open('document.pdf', 'rb') as f:
|
||||
response = requests.post(
|
||||
'http://localhost:8000/api/upload',
|
||||
'http://localhost:8000/upload',
|
||||
files={'file': f}
|
||||
)
|
||||
|
||||
# 查询问答
|
||||
response = requests.post(
|
||||
'http://localhost:8000/api/chat',
|
||||
'http://localhost:8000/chat',
|
||||
json={
|
||||
'question': '这个文档讲了什么?',
|
||||
'top_k': 3
|
||||
|
@ -256,7 +256,7 @@ print(response.json())
|
|||
# 流式聊天问答
|
||||
def stream_chat(question):
|
||||
response = requests.post(
|
||||
'http://localhost:8000/api/chat/stream',
|
||||
'http://localhost:8000/chat/stream',
|
||||
json={'question': question, 'top_k': 3},
|
||||
stream=True
|
||||
)
|
||||
|
@ -286,7 +286,7 @@ stream_chat("详细解释文档的主要观点")
|
|||
```javascript
|
||||
// 流式聊天问答 - 前端实现
|
||||
async function streamChat(question) {
|
||||
const response = await fetch('/api/chat/stream', {
|
||||
const response = await fetch('/chat/stream', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# RAG 系统并发测试报告
|
||||
|
||||
## 测试时间
|
||||
2025-07-07 23:17:54
|
||||
|
||||
## 测试概览
|
||||
本次测试验证了 RAG 系统在并发环境下的稳定性和性能表现。
|
||||
|
||||
## 健康检查测试
|
||||
- 请求数量: 10
|
||||
- 成功率: 100.0%
|
||||
|
||||
## 文档上传测试
|
||||
- 上传数量: 5
|
||||
- 成功率: 100.0%
|
||||
|
||||
## 聊天查询测试
|
||||
- 查询数量: 10
|
||||
- 成功率: 100.0%
|
||||
|
||||
## 文档列表测试
|
||||
- 请求数量: 5
|
||||
- 成功率: 100.0%
|
||||
|
||||
## 混合操作测试
|
||||
- 总任务数: 12
|
||||
- 执行时间: 87.58秒
|
||||
|
||||
## 性能总结
|
||||
✅ 系统在并发环境下表现稳定
|
||||
✅ 各项功能响应正常
|
||||
✅ 错误率在可接受范围内
|
||||
|
||||
## 建议
|
||||
1. 继续监控高负载下的内存使用情况
|
||||
2. 考虑添加更多的边界条件测试
|
||||
3. 定期执行并发测试以确保系统稳定性
|
||||
|
||||
---
|
||||
*测试由 ConcurrentRAGTester 自动生成*
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
# 服务器配置
|
||||
BASE_URL = "http://localhost:8000"
|
||||
HEALTH_CHECK_ENDPOINT = "/api/health"
|
||||
UPLOAD_ENDPOINT = "/api/upload"
|
||||
CHAT_ENDPOINT = "/api/chat"
|
||||
DOCUMENTS_ENDPOINT = "/api/documents"
|
||||
HEALTH_CHECK_ENDPOINT = "/health"
|
||||
UPLOAD_ENDPOINT = "/upload"
|
||||
CHAT_ENDPOINT = "/chat"
|
||||
DOCUMENTS_ENDPOINT = "/documents"
|
||||
|
||||
# 并发测试配置
|
||||
CONCURRENT_CONFIG = {
|
||||
|
|
|
@ -179,7 +179,7 @@ async def upload_document(session: aiohttp.ClientSession, content: str, filename
|
|||
data = aiohttp.FormData()
|
||||
data.add_field('file', f, filename=filename, content_type='text/plain')
|
||||
|
||||
async with session.post("http://localhost:8000/api/upload", data=data) as response:
|
||||
async with session.post("http://localhost:8000/upload", data=data) as response:
|
||||
return {
|
||||
"success": response.status == 200,
|
||||
"type": "upload",
|
||||
|
@ -198,7 +198,7 @@ async def chat_query(session: aiohttp.ClientSession, question: str):
|
|||
payload = {"question": question, "top_k": 3, "temperature": 0.7}
|
||||
|
||||
async with session.post(
|
||||
"http://localhost:8000/api/chat",
|
||||
"http://localhost:8000/chat",
|
||||
json=payload,
|
||||
headers={"Content-Type": "application/json"}
|
||||
) as response:
|
||||
|
|
|
@ -8,7 +8,7 @@ def test_upload_and_chat():
|
|||
|
||||
# 测试健康检查
|
||||
print("1. 测试健康检查...")
|
||||
response = requests.get(f"{base_url}/api/health")
|
||||
response = requests.get(f"{base_url}/health")
|
||||
print(f"状态码: {response.status_code}")
|
||||
print(f"响应: {response.json()}")
|
||||
print()
|
||||
|
@ -23,7 +23,7 @@ def test_upload_and_chat():
|
|||
|
||||
with open("test_doc.txt", "rb") as f:
|
||||
files = {"file": ("test_doc.txt", f, "text/plain")}
|
||||
response = requests.post(f"{base_url}/api/upload", files=files)
|
||||
response = requests.post(f"{base_url}/upload", files=files)
|
||||
|
||||
print(f"状态码: {response.status_code}")
|
||||
if response.status_code == 200:
|
||||
|
@ -37,7 +37,7 @@ def test_upload_and_chat():
|
|||
|
||||
# 测试文档列表
|
||||
print("3. 测试文档列表...")
|
||||
response = requests.get(f"{base_url}/api/documents")
|
||||
response = requests.get(f"{base_url}/documents")
|
||||
print(f"状态码: {response.status_code}")
|
||||
print(f"文档列表: {response.json()}")
|
||||
print()
|
||||
|
@ -47,7 +47,7 @@ def test_upload_and_chat():
|
|||
chat_data = {"question": "什么是人工智能?", "top_k": 3, "temperature": 0.7}
|
||||
start_time = datetime.now()
|
||||
response = requests.post(
|
||||
f"{base_url}/api/chat/stream",
|
||||
f"{base_url}/chat/stream",
|
||||
json=chat_data,
|
||||
headers={"Content-Type": "application/json"},
|
||||
stream=True,
|
||||
|
|
Loading…
Reference in New Issue