File size: 4,073 Bytes
5a81b95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# ============================================
#  DeepSeek SDK Installation Script
#  Tested and verified - Windows PowerShell
# ============================================

# Farver
$ESC = [char]27
$Red = "$ESC[31m"
$Green = "$ESC[32m"
$Yellow = "$ESC[33m"
$Cyan = "$ESC[36m"
$Reset = "$ESC[0m"

Write-Host ""
Write-Host "================================================" -ForegroundColor Cyan
Write-Host "  Installing DeepSeek SDK for WidgetTDC"
Write-Host "================================================" -ForegroundColor Cyan
Write-Host ""

# Check om vi er i den rigtige mappe
if (-not (Test-Path "package.json")) {
    Write-Host "ERROR: package.json ikke fundet!" -ForegroundColor Red
    Write-Host "Kør dette script fra WidgetTDC root mappen"
    exit 1
}

Write-Host "📂 Arbejder i: $(Get-Location)" -ForegroundColor Cyan
Write-Host ""

# Stop alle node processer
Write-Host "🛑 Stopper Node processer..." -ForegroundColor Yellow
Get-Process node -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Get-Process vite -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2

# Ryd op med PowerShell (mere robust end cmd)
Write-Host "🗑️  Sletter gamle node_modules og package-lock.json..." -ForegroundColor Yellow

if (Test-Path "node_modules") {
    Write-Host "   Sletter node_modules..." -ForegroundColor Gray
    Remove-Item -Path "node_modules" -Recurse -Force -ErrorAction SilentlyContinue
    Start-Sleep -Seconds 1
}

if (Test-Path "package-lock.json") {
    Write-Host "   Sletter package-lock.json..." -ForegroundColor Gray
    Remove-Item -Path "package-lock.json" -Force -ErrorAction SilentlyContinue
}

Write-Host "   Slettet!" -ForegroundColor Green
Write-Host ""

# Installer dependencies
Write-Host "📦 Installerer dependencies..." -ForegroundColor Cyan
Write-Host "   Dette kan tage et par minutter..." -ForegroundColor Gray
Write-Host ""

$installSuccess = $false
try {
    $output = npm install 2>&1
    if ($LASTEXITCODE -eq 0) {
        $installSuccess = $true
        Write-Host ""
        Write-Host "✅ Installation gennemført!" -ForegroundColor Green
    }
} catch {
    Write-Host ""
    Write-Host "❌ Installation fejlede!" -ForegroundColor Red
    Write-Host $_.Exception.Message -ForegroundColor Red
    exit 1
}

if (-not $installSuccess) {
    Write-Host "❌ Installation fejlede!" -ForegroundColor Red
    exit 1
}

# Verificer deepseek-sdk
Write-Host ""
Write-Host "🔍 Verificerer installation..." -ForegroundColor Cyan

$deepseekPath = "node_modules\deepseek-sdk"
if (Test-Path $deepseekPath) {
    Write-Host "✅ deepseek-sdk installeret korrekt" -ForegroundColor Green
    
    # Læs version
    $packageJson = Get-Content "$deepseekPath\package.json" -Raw | ConvertFrom-Json
    Write-Host "   Version: $($packageJson.version)" -ForegroundColor Gray
} else {
    Write-Host "❌ deepseek-sdk ikke fundet!" -ForegroundColor Red
    exit 1
}

# Vis statistik
Write-Host ""
Write-Host "📊 Installation statistik:" -ForegroundColor Cyan
$listOutput = npm list --depth=0 2>&1 | Select-String -Pattern "(deepseek|react@)"
$listOutput | ForEach-Object { Write-Host "   $_" -ForegroundColor Gray }

Write-Host ""
Write-Host "================================================" -ForegroundColor Green
Write-Host "  ✨ SUCCESS! Alt er klar!" -ForegroundColor Green
Write-Host "================================================" -ForegroundColor Green
Write-Host ""
Write-Host "Du kan nu bruge deepseek-sdk i dit projekt:" -ForegroundColor White
Write-Host ""
Write-Host @"
  import { DeepSeekAPI } from 'deepseek-sdk';

  const api = new DeepSeekAPI({
    apiKey: process.env.DEEPSEEK_API_KEY
  });

  const response = await api.chat.completions.create({
    model: 'deepseek-chat',
    messages: [{ role: 'user', content: 'Hej!' }]
  });
"@ -ForegroundColor Cyan
Write-Host ""

# Hold vinduet åbent
Write-Host "Tryk på en vilkårlig tast for at lukke..." -ForegroundColor Gray
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")