This commit is contained in:
2025-12-28 10:33:47 +08:00
parent 061ce1b2a6
commit 79b3f79c15
6 changed files with 1111 additions and 8 deletions

View File

@@ -3,7 +3,7 @@ import json
import random
# 配置后端地址
BASE_URL = "http://127.0.0.1:8000"
BASE_URL = "http://47.122.127.178"
def log_res(name, response):
print(f"\n=== 测试接口: {name} ===")
@@ -80,7 +80,16 @@ def run_tests():
}
res = requests.post(f"{BASE_URL}/save_results", json=payload)
log_res("保存结果", res)
# 5. 测试 /search
print("\n步骤 5: 测试基于向量的搜索...")
query = [round(random.uniform(-1, 1), 8) for _ in range(1536)]
res = requests.post(f"{BASE_URL}/search", json={
"task_id": None,
"query_embedding": query,
"limit": 5
})
log_res("基于向量的搜索", res)
print("\n✅ 所有 API 流程测试完成!")
if __name__ == "__main__":