feat: 修正 Dify 端点为 /chat-messages,补全 inputs 字段;新增直连测试页和 relay 测试页

This commit is contained in:
2026-04-22 16:11:27 +08:00
parent 1f3f8a1121
commit f6f3f641e1
3 changed files with 714 additions and 2 deletions

View File

@@ -162,8 +162,12 @@ async def chat_completions(request: Request):
"Content-Type": "application/json",
}
# 转发到 Dify
dify_endpoint = f"{DIFY_URL.rstrip('/')}/chat/completions"
# 转发到 Dify(Dify 原生端点 /chat-messages)
# 确保 body 包含 inputs 字段(Dify 应用可能要求此字段)
if "inputs" not in body:
body["inputs"] = {}
dify_endpoint = f"{DIFY_URL.rstrip('/')}/chat-messages"
try:
async with httpx.AsyncClient(timeout=60.0) as client: