From 56e78053cf80b0ed00615ffa999bdb3c5d4cb890 Mon Sep 17 00:00:00 2001 From: Alexej Wolff Date: Thu, 7 May 2026 00:25:44 +0200 Subject: [PATCH] fix: restore messages variable in deepseek endpoints --- deploy.ps1 | 27 +++++++++++++++++++++++++++ server/index.js | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 deploy.ps1 diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 0000000..783b399 --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,27 @@ +# ReSekai Deploy Script +# Usage: .\deploy.ps1 + +$SERVER = "root@46.225.108.69" +$PROJECT_PATH = "/var/www/resekai/ReSekai" + +Write-Host "Deploying ReSekai to production..." -ForegroundColor Cyan + +# Build locally first +Write-Host "`nBuilding frontend..." -ForegroundColor Yellow +npm run build +if ($LASTEXITCODE -ne 0) { + Write-Host "Build failed!" -ForegroundColor Red + exit 1 +} + +# Deploy to server +Write-Host "`nDeploying to server..." -ForegroundColor Yellow +$CMD = "cd $PROJECT_PATH && git pull && npm run build && cd server && npm install && pm2 restart resekai-api" +ssh $SERVER $CMD + +if ($LASTEXITCODE -eq 0) { + Write-Host "`nDeployment successful!" -ForegroundColor Green +} else { + Write-Host "`nDeployment failed!" -ForegroundColor Red + exit 1 +} diff --git a/server/index.js b/server/index.js index 5c8fff2..dae8c48 100644 --- a/server/index.js +++ b/server/index.js @@ -1207,7 +1207,7 @@ app.post("/api/deepseek/chat", requireAuth, async (req, res) => { return res.status(500).json({ error: "DeepSeek API key not configured" }); } - const { temperature = 0.8, max_tokens = 1000 } = req.body; + const { messages, temperature = 0.8, max_tokens = 1000 } = req.body; const sanitizedMessages = sanitizeDeepSeekMessages(messages); const clampedMaxTokens = Math.min( max_tokens, @@ -1268,7 +1268,7 @@ app.post("/api/deepseek/chat/stream", requireAuth, async (req, res) => { return res.status(500).json({ error: "DeepSeek API key not configured" }); } - const { temperature = 0.8, max_tokens = 1000 } = req.body; + const { messages, temperature = 0.8, max_tokens = 1000 } = req.body; const sanitizedMessages = sanitizeDeepSeekMessages(messages); const clampedMaxTokens = Math.min( max_tokens,