[split-upload 5/6] f2fd4fa backup via proxy
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import asyncio
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
async def test():
|
||||
from app.services.neo4j_client import get_neo4j_client
|
||||
|
||||
neo4j_client = await get_neo4j_client()
|
||||
keyword = "打印机驱动安装"
|
||||
|
||||
# 直接测试 Cypher 查询
|
||||
try:
|
||||
data = await neo4j_client.execute_read_query(
|
||||
"MATCH (i:Issue) WHERE i.name CONTAINS $keyword RETURN i.uuid AS uuid, i.name AS name, i.category AS category LIMIT 5",
|
||||
{"keyword": keyword}
|
||||
)
|
||||
print(f"Data type: {type(data)}")
|
||||
print(f"Data: {data}")
|
||||
if data:
|
||||
print(f"First record uuid: {data[0].get('uuid')}")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
asyncio.run(test())
|
||||
@@ -0,0 +1,14 @@
|
||||
// 添加测试数据到 Neo4j 图谱
|
||||
CREATE (i1:Issue {name: "打印机驱动安装", category: "硬件问题"})
|
||||
CREATE (a1:Action {name: "打印机驱动安装步骤", description: "1. 打开控制面板 2. 添加打印机 3. 选择手动添加"})
|
||||
CREATE (i1)-[:HAS_ACTION]->(a1)
|
||||
|
||||
CREATE (i2:Issue {name: "网络连不上", category: "网络问题"})
|
||||
CREATE (a2:Action {name: "网络诊断步骤", description: "1. 检查网线 2. 重启路由器 3. 检查IP配置"})
|
||||
CREATE (i2)-[:HAS_ACTION]->(a2)
|
||||
|
||||
CREATE (i3:Issue {name: "邮箱无法收发", category: "软件问题"})
|
||||
CREATE (a3:Action {name: "邮箱故障排除", description: "1. 检查网络 2. 清除缓存 3. 重新登录"})
|
||||
CREATE (i3)-[:HAS_ACTION]->(a3)
|
||||
|
||||
RETURN "测试数据添加完成"
|
||||
@@ -0,0 +1,4 @@
|
||||
MATCH (n:Document)
|
||||
WHERE n.content CONTAINS "余额"
|
||||
RETURN n.title, n.content
|
||||
LIMIT 5;
|
||||
@@ -0,0 +1,78 @@
|
||||
cat > /tmp/gitea-stage1.sh <<'NAS_EOF'
|
||||
#!/bin/bash
|
||||
set +e # don't bail on error, collect everything
|
||||
|
||||
DOCKER=/var/packages/ContainerManager/target/usr/bin/docker
|
||||
|
||||
echo '===== [1] Disk space ====='
|
||||
df -h /volume1
|
||||
|
||||
echo ''
|
||||
echo '===== [2] Docker version ====='
|
||||
$DOCKER --version 2>&1
|
||||
$DOCKER info 2>&1 | head -20
|
||||
|
||||
echo ''
|
||||
echo '===== [3] Existing containers (running + stopped) ====='
|
||||
$DOCKER ps -a --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' 2>&1
|
||||
|
||||
echo ''
|
||||
echo '===== [4] Existing images (gitea-related highlighted) ====='
|
||||
$DOCKER images --format 'table {{.Repository}}\t{{.Tag}}\t{{.Size}}' 2>&1
|
||||
echo '--- gitea images only ---'
|
||||
$DOCKER images 2>&1 | grep -i gitea
|
||||
|
||||
echo ''
|
||||
echo '===== [5] /volume1/docker structure (top-level) ====='
|
||||
ls -la /volume1/docker/ 2>&1 | head -30
|
||||
echo '--- sub-dir sizes (top 20) ---'
|
||||
sudo du -sh /volume1/docker/*/ 2>/dev/null | sort -rh | head -20
|
||||
|
||||
echo ''
|
||||
echo '===== [6] /volume1/docker/gitea exists? ====='
|
||||
ls -la /volume1/docker/gitea 2>&1
|
||||
|
||||
echo ''
|
||||
echo '===== [7] Listening ports (3000/2222 must be free) ====='
|
||||
ss -tln 2>&1 | grep -E ':3000|:2222|:80|:443' || echo '(none of 3000/2222/80/443 in use)'
|
||||
|
||||
echo ''
|
||||
echo '===== [8] Tailscale ====='
|
||||
/var/packages/Tailscale/target/bin/tailscale status 2>&1 | head -10
|
||||
ip -4 addr show tailscale0 2>&1 | grep inet
|
||||
|
||||
echo ''
|
||||
echo '===== [9] Docker daemon registry config ====='
|
||||
cat /var/packages/ContainerManager/etc/docker/daemon.json 2>&1
|
||||
|
||||
echo ''
|
||||
echo '===== [10] Test Docker Hub reachability ====='
|
||||
curl -s -o /dev/null -w 'docker.io: HTTP %{http_code}, time %{time_total}s\n' \
|
||||
--max-time 8 https://registry-1.docker.io/v2/ 2>&1
|
||||
curl -s -o /dev/null -w 'gcr.io: HTTP %{http_code}, time %{time_total}s\n' \
|
||||
--max-time 8 https://gcr.io/v2/ 2>&1
|
||||
curl -s -o /dev/null -w 'tencentyun mirror: HTTP %{http_code}, time %{time_total}s\n' \
|
||||
--max-time 8 https://mirror.ccs.tencentyun.com/v2/ 2>&1
|
||||
|
||||
echo ''
|
||||
echo '===== [11] User & groups (is simon in docker group?) ====='
|
||||
id
|
||||
groups
|
||||
|
||||
echo ''
|
||||
echo '===== [12] CPU / memory ====='
|
||||
free -h
|
||||
nproc
|
||||
|
||||
echo ''
|
||||
echo '===== STAGE 1 DONE ====='
|
||||
NAS_EOF
|
||||
|
||||
chmod +x /tmp/gitea-stage1.sh
|
||||
echo '=== SCRIPT WRITTEN: /tmp/gitea-stage1.sh ==='
|
||||
echo '=== Press ENTER to execute (sudo will prompt for password) ==='
|
||||
read
|
||||
sudo bash /tmp/gitea-stage1.sh 2>&1 | tee /tmp/gitea-stage1.log
|
||||
echo ''
|
||||
echo '=== LOG SAVED: /tmp/gitea-stage1.log ==='
|
||||
echo '=== Paste the entire output above back to Claude ==='
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify WeCom contact sync works after IP whitelist configuration."""
|
||||
import httpx
|
||||
import json
|
||||
|
||||
CORP_ID = "wwa8c87970b2011f41"
|
||||
CONTACT_SECRET = "BM6iosc3gKnPqkEXmsQN3ErJUpfO-whfMUN646eezB8"
|
||||
|
||||
# Step 1: Get contact access token
|
||||
print("=" * 60)
|
||||
print("Step 1: Get contact access token")
|
||||
resp = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={CORP_ID}&corpsecret={CONTACT_SECRET}", timeout=10)
|
||||
token_data = resp.json()
|
||||
print(f" errcode: {token_data.get('errcode')}")
|
||||
print(f" errmsg: {token_data.get('errmsg')}")
|
||||
|
||||
if 'access_token' not in token_data:
|
||||
print(" FAILED: No access token returned")
|
||||
exit(1)
|
||||
|
||||
token = token_data['access_token']
|
||||
print(f" access_token: {token[:30]}...")
|
||||
|
||||
# Step 2: Get department list
|
||||
print("\n" + "=" * 60)
|
||||
print("Step 2: Get department list")
|
||||
resp2 = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token={token}", timeout=10)
|
||||
dept_data = resp2.json()
|
||||
print(f" errcode: {dept_data.get('errcode')}")
|
||||
print(f" errmsg: {dept_data.get('errmsg')}")
|
||||
departments = dept_data.get('department', [])
|
||||
print(f" department count: {len(departments)}")
|
||||
if departments:
|
||||
print(f" first 5 departments:")
|
||||
for d in departments[:5]:
|
||||
print(f" - id={d.get('id')}, name={d.get('name')}, parentid={d.get('parentid')}")
|
||||
|
||||
# Step 3: Get members of root department (id=1)
|
||||
print("\n" + "=" * 60)
|
||||
print("Step 3: Get members of root department (id=1)")
|
||||
resp3 = httpx.get(f"https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={token}&department_id=1&fetch_child=1", timeout=15)
|
||||
user_data = resp3.json()
|
||||
print(f" errcode: {user_data.get('errcode')}")
|
||||
print(f" errmsg: {user_data.get('errmsg')}")
|
||||
users = user_data.get('userlist', [])
|
||||
print(f" user count: {len(users)}")
|
||||
if users:
|
||||
print(f" first 3 users:")
|
||||
for u in users[:3]:
|
||||
print(f" - userid={u.get('userid')}, name={u.get('name')}, department={u.get('department')}")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("SUMMARY:")
|
||||
print(f" Token: OK")
|
||||
print(f" Departments: {len(departments)}")
|
||||
print(f" Users: {len(users)}")
|
||||
if dept_data.get('errcode') == 0 and len(departments) > 0:
|
||||
print(" RESULT: SUCCESS - Contact sync is working!")
|
||||
else:
|
||||
print(" RESULT: STILL FAILING")
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""测试 Dify API v1 端点"""
|
||||
import httpx
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
async def test_dify():
|
||||
# Test the base URL
|
||||
async with httpx.AsyncClient(timeout=5) as client:
|
||||
print("=== Test 1: Base URL ===")
|
||||
r = await client.get("http://yw-dify.dc.servyou-it.com/")
|
||||
print(f"Status: {r.status_code}, Location: {r.headers.get('location', 'N/A')}")
|
||||
|
||||
print("\n=== Test 2: API v1/chat-messages ===")
|
||||
url = "http://yw-dify.dc.servyou-it.com/v1/chat-messages"
|
||||
headers = {"Authorization": "Bearer app-7jkRkAzvX4QM9v9SM3P8mMEO"}
|
||||
payload = {
|
||||
"query": "hello",
|
||||
"user": "test",
|
||||
"response_mode": "blocking"
|
||||
}
|
||||
r = await client.post(url, json=payload, headers=headers)
|
||||
print(f"Status: {r.status_code}")
|
||||
print(f"Response: {r.text[:500]}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test_dify())
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""测试 Dify 直接通过 IP 访问"""
|
||||
import httpx
|
||||
import asyncio
|
||||
|
||||
async def test_by_ip():
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
# 直接通过 IP 访问
|
||||
print("=== Direct IP: 10.80.0.240 ===")
|
||||
try:
|
||||
r = await client.post(
|
||||
"http://10.80.0.240/v1/chat-messages",
|
||||
json={"query": "hello", "user": "test"},
|
||||
headers={
|
||||
"Authorization": "Bearer app-7jkRkAzvX4QM9v9SM3P8mMEO",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
)
|
||||
print(f"Status: {r.status_code}")
|
||||
print(f"Response: {r.text[:300]}")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test_by_ip())
|
||||
@@ -0,0 +1,25 @@
|
||||
import asyncio
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
async def test():
|
||||
from app.services.graph_query_service import get_graph_query_service
|
||||
from app.services.neo4j_client import get_neo4j_client
|
||||
|
||||
neo4j_client = await get_neo4j_client()
|
||||
graph_service = await get_graph_query_service(neo4j_client)
|
||||
|
||||
keyword = "打印机驱动安装"
|
||||
print(f"Testing find_issues_by_keyword for: {keyword}")
|
||||
|
||||
try:
|
||||
issues = await neo4j_client.find_issues_by_keyword(keyword, limit=5)
|
||||
print(f"Issues found: {len(issues)}")
|
||||
for issue in issues:
|
||||
print(f" - uuid: {issue.uuid}, name: {issue.name}")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
asyncio.run(test())
|
||||
@@ -0,0 +1,18 @@
|
||||
import asyncio
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
async def test():
|
||||
from app.services.neo4j_client import get_neo4j_client
|
||||
client = await get_neo4j_client()
|
||||
print(f'Neo4j client: {client}')
|
||||
if client:
|
||||
try:
|
||||
healthy = await client.health_check()
|
||||
print(f'Health check: {healthy}')
|
||||
except Exception as e:
|
||||
print(f'Health check error: {e}')
|
||||
else:
|
||||
print('Neo4j client is None - connection failed')
|
||||
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user