diff --git a/digital-human.py b/digital-human.py index 8dc0e36..35e4723 100644 --- a/digital-human.py +++ b/digital-human.py @@ -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: diff --git a/test-dify.html b/test-dify.html new file mode 100644 index 0000000..7b7ef36 --- /dev/null +++ b/test-dify.html @@ -0,0 +1,294 @@ + + +
+ + +直接在浏览器测试 Dify 接口,无需中转服务
+ 纯前端 · 不经过任何中转 +快速验证 digital-human-relay 与 Dify 的连通性
+