1+ # Yuxi-Know Initialization Script for PowerShell
2+ # This script helps set up the environment for the Yuxi-Know project
3+ # Note: API keys will be visible during input - use with care
4+
5+ Write-Host " 🚀 Initializing Yuxi-Know project..." - ForegroundColor Cyan
6+ Write-Host " ==================================" - ForegroundColor Cyan
7+
8+ # Check if .env file exists
9+ if (Test-Path " .env" ) {
10+ Write-Host " ✅ .env file already exists. Skipping environment setup." - ForegroundColor Green
11+ } else {
12+ Write-Host " 📝 .env file not found. Let's set up your environment variables." - ForegroundColor Yellow
13+ Write-Host " "
14+
15+ # Get SILICONFLOW_API_KEY
16+ Write-Host " 🔑 SiliconFlow API Key required" - ForegroundColor Yellow
17+ Write-Host " Get your API key from: https://cloud.siliconflow.cn/i/Eo5yTHGJ" - ForegroundColor Blue
18+ Write-Host " Note: Press Ctrl+C at any time to cancel" - ForegroundColor Gray
19+ Write-Host " "
20+
21+ do {
22+ $apiKey = Read-Host " Please enter your SILICONFLOW_API_KEY"
23+ if ([string ]::IsNullOrEmpty($apiKey )) {
24+ Write-Host " ❌ API Key cannot be empty. Please try again." - ForegroundColor Red
25+ }
26+ } while ([string ]::IsNullOrEmpty($apiKey ))
27+
28+ # Get TAVILY_API_KEY (optional)
29+ Write-Host " "
30+ Write-Host " 🔍 Tavily API Key (optional) - for search service" - ForegroundColor Yellow
31+ Write-Host " Get your API key from: https://app.tavily.com/" - ForegroundColor Blue
32+
33+ $TAVILY_API_KEY = Read-Host " Please enter your TAVILY_API_KEY (press Enter to skip)"
34+
35+ # Create .env file
36+ $envContent = @"
37+ # SiliconFlow API Key (required)
38+ SILICONFLOW_API_KEY=$apiKey
39+
40+ # Tavily API Key (optional - for search service)
41+ "@
42+
43+ if (-not [string ]::IsNullOrEmpty($TAVILY_API_KEY )) {
44+ $envContent += " TAVILY_API_KEY=$TAVILY_API_KEY "
45+ }
46+
47+ $envContent | Out-File - FilePath " .env" - Encoding UTF8
48+ Write-Host " ✅ .env file created successfully!" - ForegroundColor Green
49+
50+ # Clear the variables from memory
51+ Remove-Variable - Name " apiKey" - ErrorAction SilentlyContinue
52+ Remove-Variable - Name " TAVILY_API_KEY" - ErrorAction SilentlyContinue
53+ }
54+
55+ Write-Host " "
56+ Write-Host " 📦 Pulling Docker images..." - ForegroundColor Cyan
57+ Write-Host " =========================" - ForegroundColor Cyan
58+
59+ # List of Docker images to pull
60+ $images = @ (
61+ " python:3.12-slim" ,
62+ " node:20-slim" ,
63+ " node:20-alpine" ,
64+ " milvusdb/milvus:v2.5.6" ,
65+ " neo4j:5.26" ,
66+ " minio/minio:RELEASE.2023-03-20T20-16-18Z" ,
67+ " ghcr.io/astral-sh/uv:0.7.2" ,
68+ " nginx:alpine" ,
69+ " quay.io/coreos/etcd:v3.5.5"
70+ )
71+
72+ # Pull each image
73+ foreach ($image in $images ) {
74+ Write-Host " 🔄 Pulling ${image} ..." - ForegroundColor Yellow
75+ try {
76+ & docker/ pull_image.ps1 $image
77+ if ($LASTEXITCODE -eq 0 ) {
78+ Write-Host " ✅ Successfully pulled ${image} " - ForegroundColor Green
79+ } else {
80+ Write-Host " ❌ Failed to pull ${image} " - ForegroundColor Red
81+ exit 1
82+ }
83+ } catch {
84+ Write-Host " ❌ Error pulling ${image} : $_ " - ForegroundColor Red
85+ exit 1
86+ }
87+ }
88+
89+ Write-Host " "
90+ Write-Host " 🎉 Initialization complete!" - ForegroundColor Green
91+ Write-Host " ==========================" - ForegroundColor Green
92+ Write-Host " You can now run: docker compose up -d --build" - ForegroundColor Cyan
93+ Write-Host " This will start all services in development mode with hot-reload enabled." - ForegroundColor Cyan
0 commit comments