test_router.py 500 B

123456789101112131415161718
  1. import requests
  2. import json
  3. # 测试通过 Router 调用 gpt_image_2 工具
  4. response = requests.post(
  5. "http://localhost:8001/run_tool",
  6. headers={"Content-Type": "application/json"},
  7. json={
  8. "tool_id": "gpt_image_2",
  9. "params": {
  10. "prompt": "1024x1024 square image, a beautiful sunset over mountains"
  11. }
  12. },
  13. timeout=180
  14. )
  15. print(f"Status Code: {response.status_code}")
  16. print(f"Response: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")