Files
OnceLove-New/OnceLove/oncelove-graphrag/test_full.ps1
KOSHM-Pig adabd63769 feat: 新增多用户支持、关系历史查询与恋爱决策建议功能
- 新增用户服务,支持多用户数据隔离与认证
- 新增关系历史查询接口,支持按冲突、积极、时间线等类型过滤
- 新增恋爱决策建议接口,基于图谱分析生成关系健康报告
- 优化前端图谱可视化,增加节点详情面板、图例和边标签显示
- 改进文本分析逻辑,支持实体去重和情感标注
- 新增完整流程测试脚本,验证分析、入库、查询全链路
2026-03-23 22:09:40 +08:00

36 lines
1.8 KiB
PowerShell

# 测试完整流程:分析 + 入库 + 查询
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