Files
group_xinghuo_jinrong/scripts/dev/seed_analyst.ps1
T

61 lines
1.2 KiB
PowerShell
Raw Normal View History

# 口径字典 + 问数模板种子(本机 MySQL jinrong_agent)
param(
[ValidateSet("Auto", "Docker", "Local")]
[string]$RestartBackend = "Local",
[switch]$SkipRestart
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
$AgentDir = Join-Path $Root "scripts\agent"
Write-Host "Seeding analyst metric dict..."
Get-Content (Join-Path $AgentDir "seed-analyst-metric-dict.sql") -Raw | mysql -u root jinrong_agent
Write-Host "Seeding analyst query templates..."
Get-Content (Join-Path $AgentDir "seed-analyst-query-templates.sql") -Raw | mysql -u root jinrong_agent
Write-Host "Seeding analyst few-shots (D-11 published)..."
Get-Content (Join-Path $AgentDir "seed-analyst-few-shots.sql") -Raw | mysql -u root jinrong_agent
Write-Host "Done."
if (-not $SkipRestart) {
$RestartScript = Join-Path $Root "scripts\dev\restart-dev.ps1"
if (Test-Path $RestartScript) {
Write-Host "Restarting backend after seed ($RestartBackend)..." -ForegroundColor Cyan
& $RestartScript -Backend $RestartBackend -SkipFrontend
} else {
Write-Host "WARN: restart-dev.ps1 not found; skip backend restart." -ForegroundColor Yellow
}
}