[split-upload 3/6] f2fd4fa backup via proxy
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
"""测试容器能否访问 Dify"""
|
||||
import httpx
|
||||
import socket
|
||||
|
||||
# 测试 DNS 解析
|
||||
try:
|
||||
ip = socket.gethostbyname('yw-dify.dc.servyou-it.com')
|
||||
print(f"DNS resolved: yw-dify.dc.servyou-it.com -> {ip}")
|
||||
except Exception as e:
|
||||
print(f"DNS failed: {e}")
|
||||
|
||||
# 测试 HTTP 连接
|
||||
async def test_dify():
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
# 测试根路径
|
||||
try:
|
||||
r = await client.get('http://yw-dify.dc.servyou-it.com/')
|
||||
print(f"GET / -> {r.status_code}")
|
||||
except Exception as e:
|
||||
print(f"GET / failed: {type(e).__name__}: {e}")
|
||||
|
||||
# 测试 API 端点
|
||||
try:
|
||||
r = await client.post(
|
||||
'http://yw-dify.dc.servyou-it.com/v1/chat-messages',
|
||||
json={"inputs": {}, "query": "test", "response_mode": "blocking", "user": "test"}
|
||||
)
|
||||
print(f"POST /v1/chat-messages -> {r.status_code}")
|
||||
except Exception as e:
|
||||
print(f"POST /v1/chat-messages failed: {type(e).__name__}: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
asyncio.run(test_dify())
|
||||
Reference in New Issue
Block a user