Files
PlantAI-rag-new/deploy/integration_check.sh
jerryandClaude Fable 5 1e94de7464 PlantAI-rag-new 首次提交:文献知识工作台
- BFF 薄适配层(FastAPI,8090):QA 代理/SSE 中继/Neo4j 直连/抽取代理/会话持久化
- Vue3 前端:五相位检索流水线、文献来源与证据链、知识图谱、提取任务四 tab
- 四档响应式(桌面/笔记本/平板/手机)、深浅主题
- 81 个 FR 全部实现,测试追溯矩阵 81/81,后端 121 测/前端 156 测
- 真实凭据已脱敏,运行时配置在 backend/.env(不入 git)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 20:47:52 +08:00

53 lines
2.3 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# deploy/integration_check.sh —— M2 集成检查(PM 使用,在远端运行)
# 用途:真实 BFF(8090)接真实上游后的端到端冒烟。
# 前置:BFF 已在 8090 运行(deploy/start-dev.sh),远端可直接访问 127.0.0.1。
set -uo pipefail
BFF="http://127.0.0.1:8090"
PASS=0; FAIL=0
ok() { echo " ✅ $1"; PASS=$((PASS+1)); }
bad() { echo " ❌ $1"; FAIL=$((FAIL+1)); }
check() { # $1 名称 $2 实际输出 $3 期望子串
if echo "$2" | grep -q "$3"; then ok "$1"; else bad "$1(输出: $(echo "$2" | head -c 200))"; fi
}
echo "== 1. 健康 =="
H=$(curl -s --max-time 10 "$BFF/api/health")
check "health 返回 status" "$H" '"status"'
check "qa 上游探测存在" "$H" '"qa"'
check "neo4j 探测存在" "$H" '"neo4j"'
echo "== 2. QA =="
QI=$(curl -s --max-time 10 "$BFF/api/qa/info")
check "qa info 版本" "$QI" '1.1.73'
echo "== 3. 会话 =="
S=$(curl -s -X POST "$BFF/api/sessions" -H 'Content-Type: application/json' -d '{"title":"集成冒烟"}')
SID=$(echo "$S" | python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))" 2>/dev/null)
[ -n "$SID" ] && ok "创建会话 ($SID)" || bad "创建会话(输出: $S)"
L=$(curl -s "$BFF/api/sessions")
check "会话列表包含新会话" "$L" "$SID"
echo "== 4. 知识图谱(Neo4j 直连)=="
KS=$(curl -s --max-time 10 "$BFF/api/kg/status")
check "kg status schema" "$KS" 'canonical'
E=$(curl -s --max-time 10 "$BFF/api/kg/entities?q=SPL&limit=5")
check "实体搜索" "$E" '"results"'
echo "== 5. 抽取任务 =="
J=$(curl -s --max-time 15 "$BFF/api/extraction/jobs")
check "任务列表" "$J" '"jobs"'
echo "== 6. QA 检索(真实上游,约 90s,可选)=="
if [ "${SKIP_QA:-0}" = "1" ]; then echo " ⏭ 跳过(SKIP_QA=1)"; else
Q=$(curl -s --max-time 200 -X POST "$BFF/api/qa/search" -H 'Content-Type: application/json' \
-d '{"question":"SPL gene family in rice","use_llm":false,"debug":false,"chain_top_k":3,"chain_hops":2,"chain_max_edges":12,"chain_max_nodes":10,"native_chain_enabled":true,"native_chain_max_hops":3,"native_chain_top_k":5}')
check "search 返回 sources" "$Q" '"sources"'
fi
[ -n "$SID" ] && curl -s -X DELETE "$BFF/api/sessions/$SID" > /dev/null && ok "清理冒烟会话" || true
echo
echo "结果:$PASS 通过 / $FAIL 失败"
[ "$FAIL" -eq 0 ]