feat(scripts): 收纳运维/部署/修复/调试脚本到 scripts/ 目录
**目录结构**: - scripts/ 顶层运维/工具脚本(20 个) - scripts/deploy/ 一键部署脚本(deploy_*.py / upload_*.py / redeploy.py 等 8 个) - scripts/fix/ 一次性修复脚本(fix_*.py / fix_*.cypher / fix_*.sql 等 9 个) - scripts/debug/ 调试脚本集合(check_*.py/sql、test_*.py、debug_*.py 等 42 个) **ops-tools/jms_ops.py**:jumpserver-ops skill 默认路径修复 - 从 'jumpserver-automation-shareable' 改为 'jumpserver-ops' - 同步更新注释(优先 JP_SKILL_DIR 环境变量) **典型脚本用途**: - scripts/deploy-v1.2.ps1 / -staging.ps1:一键部署 v1.2 到生产 / staging - scripts/init_quick_rules.sql:quick_rules 表初始数据 - scripts/gen_admin_token.py:生成 admin JWT token(调试用) - scripts/build-and-verify.sh:v1.1 实施验证脚本 - scripts/verify_*.sh / .py:API/quick_rules 验证 - scripts/fix/*.py:环境修复(compose、env_key、itsm_bridge 等) 合计 81 文件 + 3317 行 / - 1 行
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test multiple Dify API keys to find a working one"""
|
||||
import httpx
|
||||
import json
|
||||
import time
|
||||
|
||||
base_url = "http://yw-dify.dc.servyou-it.com"
|
||||
|
||||
# Test multiple API keys
|
||||
api_keys = [
|
||||
("app-7jkRkAzvX4QM9v9SM3P8mMEO", "审批意图副本"),
|
||||
("app-J3s8sHarZQ2SCaNF3xCppliL", "自建应用"),
|
||||
("app-z3S9AEUUAVPbtR2rioxpiIvp", "分诊应用"),
|
||||
]
|
||||
|
||||
for api_key, name in api_keys:
|
||||
url = f"{base_url}/v1/chat-messages"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = {
|
||||
"inputs": {},
|
||||
"query": "密码忘记了怎么办",
|
||||
"response_mode": "blocking",
|
||||
"user": "test_verify"
|
||||
}
|
||||
|
||||
print(f"=== Testing: {name} ({api_key[:20]}...) ===")
|
||||
start = time.time()
|
||||
try:
|
||||
with httpx.Client(timeout=httpx.Timeout(30.0)) as client:
|
||||
resp = client.post(url, headers=headers, json=payload)
|
||||
elapsed = (time.time() - start) * 1000
|
||||
print(f"Status: {resp.status_code}, Time: {elapsed:.0f}ms")
|
||||
|
||||
if resp.status_code == 200:
|
||||
data = resp.json()
|
||||
answer = data.get('answer', '')
|
||||
print(f"conversation_id: {data.get('conversation_id', 'N/A')}")
|
||||
print(f"answer (first 300 chars): {answer[:300]}")
|
||||
|
||||
# Try JSON parse
|
||||
try:
|
||||
parsed = json.loads(answer)
|
||||
print(f"JSON Parse: SUCCESS - keys: {list(parsed.keys())}")
|
||||
except:
|
||||
print(f"JSON Parse: FAILED (plain text)")
|
||||
else:
|
||||
print(f"Error: {resp.text[:300]}")
|
||||
except Exception as e:
|
||||
print(f"Exception: {type(e).__name__}: {e}")
|
||||
|
||||
print()
|
||||
Reference in New Issue
Block a user