# 测试完整流程:分析 + 入库 + 查询 Write-Host "=== 测试 GraphRAG 完整流程 ===" -ForegroundColor Cyan # 1. 测试健康检查 Write-Host "`n[1/4] 测试健康检查..." -ForegroundColor Yellow $health = Invoke-RestMethod -Uri "http://localhost:3000/health" -Method Get Write-Host "健康状态:$($health.ok)" -ForegroundColor Green # 2. 测试就绪检查 Write-Host "`n[2/4] 测试数据库连接..." -ForegroundColor Yellow $ready = Invoke-RestMethod -Uri "http://localhost:3000/ready" -Method Get Write-Host "数据库状态:$($ready.ok)" -ForegroundColor Green # 3. 测试分析 + 入库 Write-Host "`n[3/4] 测试分析入库..." -ForegroundColor Yellow $testData = '{"text":"我今天跟她吵架了,她说我前两天不给她买花,说我准备的求婚仪式太敷衍"}' Write-Host "测试文本:$testData" -ForegroundColor Gray $analyzeResult = Invoke-RestMethod -Uri "http://localhost:3000/analyze" -Method Post -ContentType "application/json; charset=utf-8" -Body $testData Write-Host "分析结果:" -NoNewline Write-Host "人物 $($analyzeResult.stats.persons) 个,事件 $($analyzeResult.stats.events) 个,主题 $($analyzeResult.stats.topics) 个" -ForegroundColor Green # 4. 查询图谱统计 Write-Host "`n[4/4] 查询图谱数据..." -ForegroundColor Yellow Start-Sleep -Seconds 2 $stats = Invoke-RestMethod -Uri "http://localhost:3000/graph/stats" -Method Get Write-Host "图谱节点:$($stats.nodes.Count) 个" -ForegroundColor Green Write-Host "图谱关系:$($stats.links.Count) 条" -ForegroundColor Green if ($stats.nodes.Count -gt 0) { Write-Host "`n节点列表:" -ForegroundColor Cyan $stats.nodes | ForEach-Object { Write-Host " - $($_.name) ($($_.type))" } } Write-Host "`n=== 测试完成 ===" -ForegroundColor Cyan