Files
wecom_it_smart_desk/test_dify_approval.py
Simon bea288e414 feat: 2026-07-11 全量更新 - 代办集成+会议室预定+知识迭代修复+UI统一+Bug修复
== 已部署上线 (9项) ==
- 代办事项真实数据源集成 (企微审批API 8bug修复链)
- H5/坐席端 Logo样式统一+绿色背景
- 视频引导页修复 (localStorage key v2)
- 坐席端 v9 Vue版本修复 (ElMessage._context)
- 截图按钮 v10 修复 (getDisplayMedia user gesture)
- 扫码样式恢复+H5扫码登录跳转修复
- H5截图快捷键提示

== 代码完成待部署 (3项) ==
- 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查)
- 会议室预定-小鱼易联终端 (40文件, 40/40测试通过)
- IT资产升级审批推送 (asset_service.py)

== 需求文档 (2项) ==
- 坐席端AI辅助消息框-PRD (4项新功能确认)
- 坐席端布局优化建议 v2.0 (7天计划)

== 新增文档 ==
- 日报-2026-07-11.md
- 知识迭代Bug修复报告-20260711.md
- 会议室预定-部署指南.md
- CHANGELOG.md 更新

== 测试 ==
- test_todo_integration.py: 40/40
- test_meetingroom.py: 40/40
- test_bugfix_ki_suggestions.py: 21/21
2026-07-11 23:13:10 +08:00

55 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Test Dify approval intent detection API directly."""
import json
import sys
import httpx
BASE_URL = "http://yw-dify.dc.servyou-it.com/dify2openai"
API_KEY = "app-JWI7u1LTn9XPVe95KL6dHzPx"
url = f"{BASE_URL.rstrip('/')}/v1/chat/completions"
body = {
"model": "dify",
"messages": [
{"role": "system", "content": "你是IT服务台审批意图识别器。"},
{"role": "user", "content": "我要申请VPN"},
],
"temperature": 0,
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
print(f"URL: {url}")
print(f"Body: {json.dumps(body, ensure_ascii=False)}")
print("---")
try:
resp = httpx.post(url, json=body, headers=headers, timeout=30.0)
print(f"HTTP Status: {resp.status_code}")
print(f"Response Headers: {dict(resp.headers)}")
print(f"Response Body (raw): {resp.text[:2000]}")
print("---")
# Try parsing as JSON
try:
data = resp.json()
print(f"Response JSON: {json.dumps(data, ensure_ascii=False, indent=2)[:2000]}")
choices = data.get("choices") or []
if choices:
content = choices[0].get("message", {}).get("content", "")
print(f"Content: {content[:500]}")
# Try parsing content as JSON
try:
parsed = json.loads(content)
print(f"Parsed: {json.dumps(parsed, ensure_ascii=False, indent=2)}")
except json.JSONDecodeError as e:
print(f"Content is NOT valid JSON: {e}")
else:
print("No choices in response")
except Exception as e:
print(f"Response is not JSON: {e}")
except Exception as e:
print(f"Request FAILED: {type(e).__name__}: {e}")