21 lines
896 B
PowerShell
21 lines
896 B
PowerShell
# Copy host "ai-insight/chroma_db" into the running rag container volume.
|
|
# Named volume rag-chroma mounts over the image-baked index — seed after first up.
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Split-Path -Parent $PSScriptRoot
|
|
$Src = Join-Path $Root "ai-insight\chroma_db"
|
|
$Cid = if ($env:RAG_CONTAINER) { $env:RAG_CONTAINER } else { "dashboard-cpsp-rag" }
|
|
|
|
if (-not (Test-Path $Src)) {
|
|
Write-Error "Missing $Src — run: cd ai-insight; python populate_db.py"
|
|
}
|
|
docker inspect $Cid | Out-Null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error "Container $Cid not found. Start with: docker compose up -d rag"
|
|
}
|
|
|
|
Write-Host "Seeding Chroma into ${Cid}:/app/chroma_db from $Src"
|
|
docker exec $Cid sh -c "rm -rf /app/chroma_db/* /app/chroma_db/.[!.]* 2>/dev/null || true"
|
|
docker cp "${Src}/." "${Cid}:/app/chroma_db/"
|
|
docker restart $Cid
|
|
Write-Host "Done. Check: curl -fsS http://127.0.0.1:5002/health"
|