fix: 品牌保护+知识库全量覆盖 - 6层防御解决传销问题 + 30+产品关键词补全
This commit is contained in:
55
mcp-server-ssh/deploy_fixes.cjs
Normal file
55
mcp-server-ssh/deploy_fixes.cjs
Normal file
@@ -0,0 +1,55 @@
|
||||
const { Client } = require('ssh2');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const c = new Client();
|
||||
const REMOTE_BASE = '/www/wwwroot/demo.tensorgrove.com.cn/server/services';
|
||||
|
||||
// Read local files
|
||||
const gatewayPath = path.join(__dirname, '..', 'test2', 'server', 'services', 'nativeVoiceGateway.js');
|
||||
const toolExecPath = path.join(__dirname, '..', 'test2', 'server', 'services', 'toolExecutor.js');
|
||||
|
||||
const gatewayContent = fs.readFileSync(gatewayPath, 'utf8');
|
||||
const toolExecContent = fs.readFileSync(toolExecPath, 'utf8');
|
||||
|
||||
console.log(`Gateway file size: ${gatewayContent.length} bytes`);
|
||||
console.log(`ToolExecutor file size: ${toolExecContent.length} bytes`);
|
||||
|
||||
c.on('ready', () => {
|
||||
console.log('SSH connected, starting SFTP...');
|
||||
c.sftp((err, sftp) => {
|
||||
if (err) { console.error('SFTP error:', err); c.end(); return; }
|
||||
|
||||
let done = 0;
|
||||
const total = 2;
|
||||
function checkDone() {
|
||||
done++;
|
||||
if (done >= total) {
|
||||
console.log('All files uploaded. Restarting PM2...');
|
||||
c.exec('cd /www/wwwroot/demo.tensorgrove.com.cn && pm2 restart bigwo-server && sleep 2 && pm2 logs bigwo-server --lines 20 --nostream', (err2, s) => {
|
||||
if (err2) { console.error('Restart error:', err2); c.end(); return; }
|
||||
let o = '';
|
||||
s.on('data', (d) => (o += d));
|
||||
s.stderr.on('data', (d) => (o += d));
|
||||
s.on('close', () => {
|
||||
console.log('=== PM2 Restart Output ===');
|
||||
console.log(o);
|
||||
c.end();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Upload nativeVoiceGateway.js
|
||||
const ws1 = sftp.createWriteStream(`${REMOTE_BASE}/nativeVoiceGateway.js`);
|
||||
ws1.on('close', () => { console.log('✓ nativeVoiceGateway.js uploaded'); checkDone(); });
|
||||
ws1.on('error', (e) => { console.error('Upload gateway error:', e); });
|
||||
ws1.end(gatewayContent);
|
||||
|
||||
// Upload toolExecutor.js
|
||||
const ws2 = sftp.createWriteStream(`${REMOTE_BASE}/toolExecutor.js`);
|
||||
ws2.on('close', () => { console.log('✓ toolExecutor.js uploaded'); checkDone(); });
|
||||
ws2.on('error', (e) => { console.error('Upload toolExec error:', e); });
|
||||
ws2.end(toolExecContent);
|
||||
});
|
||||
}).connect({ host: '119.45.10.34', port: 22, username: 'root', password: '#xyzh%CS#2512@28' });
|
||||
Reference in New Issue
Block a user