Atualização automática: 2026-05-18 11:16:56
This commit is contained in:
+40
-3
@@ -77,12 +77,13 @@ app.post('/api/wget-clone', async (req, res) => {
|
||||
console.log('✅ Wget clone completed successfully');
|
||||
|
||||
// Sync to host /root/Desktop/Clonados
|
||||
if (response.data && response.data.success && response.data.directory) {
|
||||
const directory = response.data.data?.directory || response.data.directory;
|
||||
if (response.data && response.data.success && directory) {
|
||||
const { exec } = require('child_process');
|
||||
const containerId = require('os').hostname();
|
||||
const cloneDir = response.data.directory.split('/').pop();
|
||||
const cloneDir = directory.split('/').pop();
|
||||
const hostDir = '/root/Desktop/Clonados';
|
||||
exec(`docker cp b38l2zsxjv08xkxg4gd5rl9r-210808689309:${response.data.directory} ${hostDir}/ 2>/dev/null`, (err) => {
|
||||
exec(`docker cp ${containerId}:${directory} ${hostDir}/ 2>/dev/null`, (err) => {
|
||||
if (err) console.log('⚠️ Sync to host failed:', err.message);
|
||||
else console.log('✅ Clone synced to host:', cloneDir);
|
||||
});
|
||||
@@ -281,6 +282,42 @@ app.get('/index', (req, res) => {
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
// AI Agent Route (MiniMax)
|
||||
app.post('/api/ai/agent', async (req, res) => {
|
||||
const { systemPrompt, userMessage } = req.body;
|
||||
const apiKey = process.env.MINIMAX_API_KEY;
|
||||
|
||||
if (!apiKey) {
|
||||
return res.status(500).json({ error: 'MINIMAX_API_KEY is missing in .env' });
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await axios.post('https://api.minimax.io/v1/chat/completions', {
|
||||
model: "MiniMax-M2.7",
|
||||
messages: [
|
||||
{ role: "system", content: systemPrompt || "Você é um assistente de inteligência artificial útil." },
|
||||
{ role: "user", content: userMessage }
|
||||
],
|
||||
max_tokens: 2048
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
timeout: 90000 // 90s
|
||||
});
|
||||
|
||||
let reply = response.data.choices?.[0]?.message?.content || 'Processamento concluído, porém sem retorno.';
|
||||
// Strip <think> reasoning tags if present
|
||||
reply = reply.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
|
||||
|
||||
res.json({ success: true, data: reply });
|
||||
} catch (error) {
|
||||
console.error('MiniMax AI Error:', error.response?.data || error.message);
|
||||
res.status(500).json({ error: error.message, details: error.response?.data });
|
||||
}
|
||||
});
|
||||
|
||||
// Handle 404s
|
||||
app.use((req, res) => {
|
||||
res.status(404).json({
|
||||
|
||||
Reference in New Issue
Block a user