[split-upload 3/6] f2fd4fa backup via proxy

This commit is contained in:
Simon
2026-08-11 14:16:50 +08:00
parent e54529d307
commit 8ef4be0fa0
74 changed files with 7945 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
SELECT id, created_at, message_type, sender_type, content
FROM messages
WHERE sender_type = 'ai'
ORDER BY created_at DESC
LIMIT 10;
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
set +e # collect everything, don't bail
echo '############ STEP 1: Locate project directory ############'
cd /opt/wecom-it-desk 2>&1
echo "Current dir: $(pwd)"
ls -la docker-compose.yml 2>&1
echo ''
echo '############ STEP 2: Diagnose (READ-ONLY) ############'
echo '--- All wecom_it_ containers ---'
docker ps -a --format "table {{.Names}}\t{{.Status}}" | grep -E "wecom_it_|NAMES"
echo ''
echo '--- Disk space ---'
df -h /opt 2>&1
echo ''
echo '--- backend last 60 log lines ---'
docker logs wecom_it_backend --tail 60 2>&1
echo ''
echo '--- backend internal health check ---'
docker exec wecom_it_backend curl -s -o - -w "\nHTTP_CODE: %{http_code}\n" --max-time 5 http://localhost:8000/health 2>&1
echo ''
echo '############ STEP 3: Restart from correct directory ############'
cd /opt/wecom-it-desk
docker compose up -d 2>&1
echo ''
echo 'Waiting 15s for services to stabilize...'
sleep 15
echo ''
echo '--- Containers after restart ---'
docker ps -a --format "table {{.Names}}\t{{.Status}}" | grep -E "wecom_it_|NAMES"
echo ''
echo '############ STEP 4: End-to-end verification ############'
echo '--- backend /health ---'
curl -s -o - -w "\nHTTP_CODE: %{http_code}\n" --max-time 5 http://localhost:8000/health
echo ''
echo '--- nginx routes (expect 200/301/302) ---'
for path in / /itagent/ /ith5/ /itadmin/; do
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "http://localhost${path}")
echo " $path -> HTTP $code"
done
echo ''
echo '############ DONE ############'
echo 'Paste ALL output above back to Claude for diagnosis'
+70
View File
@@ -0,0 +1,70 @@
# NAS probe script (English-only, prevents PowerShell 5.1 GBK encoding issue)
# Output saved to nas_probe_output.txt
$ErrorActionPreference = "Continue"
$outputFile = "$PSScriptRoot\nas_probe_output.txt"
chcp 65001 | Out-Null
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Write-Host "===================================" -ForegroundColor Cyan
Write-Host " NAS Probe Script" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Connecting via Tailscale: simon@100.85.152.112" -ForegroundColor Yellow
Write-Host "Read-only probe, output saved to:" -ForegroundColor Yellow
Write-Host " $outputFile" -ForegroundColor White
Write-Host ""
Write-Host "SSH will prompt for the simon user password..." -ForegroundColor Yellow
Write-Host ""
$cmd = @"
echo '===== [1] DSM Version ====='
cat /etc.defaults/VERSION 2>/dev/null | head -10
uname -a
echo ''
echo '===== [2] Docker availability ====='
which docker && docker --version
ls /var/packages/ContainerManager/target/usr/bin/docker 2>/dev/null
/var/packages/ContainerManager/target/usr/bin/docker --version 2>&1
echo ''
echo '===== [3] All containers (running + stopped) ====='
/var/packages/ContainerManager/target/usr/bin/docker ps -a --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' 2>&1 | head -40
echo ''
echo '===== [4] /volume1/docker structure ====='
ls -la /volume1/docker/ 2>&1 | head -40
echo '--- sub-dir sizes ---'
du -sh /volume1/docker/*/ 2>/dev/null | head -30
echo ''
echo '===== [5] Listening ports (22/80/443/3000/3022/18080) ====='
ss -tln 2>&1 | head -30
echo ''
echo '===== [6] Tailscale ====='
ls /var/packages/Tailscale/target/bin/ 2>/dev/null
/var/packages/Tailscale/target/bin/tailscale status 2>/dev/null | head -10
echo ''
echo '===== [7] Existing Gitea ====='
/var/packages/ContainerManager/target/usr/bin/docker ps -a | grep -i gitea
ls -la /volume1/docker/gitea 2>&1 | head -10
echo ''
echo '===== [8] Disk space ====='
df -h /volume1 2>&1 | head -3
echo ''
echo '===== [9] User and permissions ====='
id
echo ''
echo '===== [10] Installed packages ====='
ls /var/packages/ 2>/dev/null | grep -iE 'docker|container|tail|portain'
echo ''
echo '===== DONE ====='
"@
ssh simon@100.85.152.112 $cmd 2>&1 | Tee-Object -FilePath $outputFile -Encoding UTF8
Write-Host ""
Write-Host "===================================" -ForegroundColor Green
Write-Host " Done. Output saved to:" -ForegroundColor Green
Write-Host " $outputFile" -ForegroundColor White
Write-Host "===================================" -ForegroundColor Green
Write-Host ""
Read-Host "Press Enter to close"
+1
View File
@@ -0,0 +1 @@
UPDATE agents SET status = 'offline' WHERE id = 'agent-sxn-001';
+3
View File
@@ -0,0 +1,3 @@
import requests
r = requests.get('http://127.0.0.1:8000/api/h5/agents/online-status')
print(r.text)
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Test detect-intent API - correct path without /api prefix."""
import json
import httpx
# Backend routes are at root level (no /api prefix, nginx adds it)
url = "http://localhost:8000/approval/detect-intent"
test_messages = [
"我要申请VPN",
"我的电脑坏了",
"我要申请办公用品",
"你好,今天天气怎么样?",
]
for msg in test_messages:
print(f"\n=== Testing: {msg} ===")
try:
resp = httpx.post(
url,
json={"text": msg},
timeout=30.0,
)
print(f" HTTP: {resp.status_code}")
print(f" Response: {resp.text[:500]}")
if resp.status_code == 200:
data = resp.json()
result = data.get("data", data)
print(f" is_approval: {result.get('is_approval_request')}")
print(f" confidence: {result.get('confidence')}")
print(f" type: {result.get('approval_type')}")
print(f" source: {result.get('source')}")
except Exception as e:
print(f" ERROR: {type(e).__name__}: {e}")
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""测试容器能否访问 Dify"""
import httpx
import socket
# 测试 DNS 解析
try:
ip = socket.gethostbyname('yw-dify.dc.servyou-it.com')
print(f"DNS resolved: yw-dify.dc.servyou-it.com -> {ip}")
except Exception as e:
print(f"DNS failed: {e}")
# 测试 HTTP 连接
async def test_dify():
async with httpx.AsyncClient(timeout=10) as client:
# 测试根路径
try:
r = await client.get('http://yw-dify.dc.servyou-it.com/')
print(f"GET / -> {r.status_code}")
except Exception as e:
print(f"GET / failed: {type(e).__name__}: {e}")
# 测试 API 端点
try:
r = await client.post(
'http://yw-dify.dc.servyou-it.com/v1/chat-messages',
json={"inputs": {}, "query": "test", "response_mode": "blocking", "user": "test"}
)
print(f"POST /v1/chat-messages -> {r.status_code}")
except Exception as e:
print(f"POST /v1/chat-messages failed: {type(e).__name__}: {e}")
if __name__ == "__main__":
import asyncio
asyncio.run(test_dify())
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
"""测试 Dify 多个端口"""
import httpx
import asyncio
async def test_ports():
async with httpx.AsyncClient(timeout=10) as client:
ports = [80, 8080, 3000, 5000]
for port in ports:
url = f"http://10.80.0.240:{port}/"
try:
r = await client.get(url)
print(f"Port {port}: {r.status_code}")
except Exception as e:
print(f"Port {port}: FAIL - {type(e).__name__}")
if __name__ == "__main__":
asyncio.run(test_ports())
+9
View File
@@ -0,0 +1,9 @@
import sys
sys.path.insert(0, '/app')
from app.services.asset_recommend_service import AssetRecommendService
svc = AssetRecommendService()
cards = svc.match_keywords('VPN连不上怎么办')
print(f'Found {len(cards)} cards')
for c in cards:
print(f' - {c.title}: {c.description}')
+1
View File
@@ -0,0 +1 @@
UPDATE agents SET status = 'offline';