feat: implement service management API for VLM control
- Add /api/v1/mbe/health endpoint for status checks - Add /api/v2/service/start to start llama-server - Add /api/v2/service/stop to stop llama-server - Use TCP connection test for port detection (more reliable than lsof) - Add ps aux fallback for PID detection - Implement structured bilingual VLM tags - Add VLM integration documentation for Studio team Endpoints tested and working with Momentry Studio AdminView UI.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-TW">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Momentry Monitor (Simple)</title>
|
||||
<style>
|
||||
body { font-family: monospace; background: #1a1a1a; color: #fff; padding: 20px; }
|
||||
.job { background: #2a2a2a; padding: 15px; margin: 10px 0; border-radius: 8px; }
|
||||
.processor { background: #3a3a3a; padding: 5px 10px; margin: 5px 0; border-radius: 4px; }
|
||||
.completed { color: #0f0; }
|
||||
.running { color: #0ff; }
|
||||
.failed { color: #f00; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Momentry Monitor</h1>
|
||||
<div id="queue">Loading queue stats...</div>
|
||||
<div id="jobs">Loading running jobs...</div>
|
||||
<div id="worker">Loading worker status...</div>
|
||||
|
||||
<script>
|
||||
async function refresh() {
|
||||
try {
|
||||
// Queue Stats
|
||||
const queueRes = await fetch('/api/v1/monitor/queue_stats');
|
||||
const queue = await queueRes.json();
|
||||
document.getElementById('queue').innerHTML =
|
||||
`<h2>Queue</h2>
|
||||
<div>Pending: ${queue.pending} | Running: ${queue.running} | Completed: ${queue.completed} | Failed: ${queue.failed}</div>`;
|
||||
|
||||
// Running Jobs
|
||||
const jobsRes = await fetch('/api/v1/monitor/running_jobs');
|
||||
const jobsData = await jobsRes.json();
|
||||
let jobsHtml = '<h2>Running Jobs</h2>';
|
||||
if (jobsData.jobs.length === 0) {
|
||||
jobsHtml += '<div>No jobs running</div>';
|
||||
} else {
|
||||
jobsData.jobs.forEach(job => {
|
||||
jobsHtml += `
|
||||
<div class="job">
|
||||
<div><strong>Job #${job.job_id}</strong> - ${job.file_name}</div>
|
||||
<div>UUID: ${job.file_uuid}</div>
|
||||
<div>Duration: ${job.duration_secs}s</div>
|
||||
<div style="margin-top: 10px;">
|
||||
${job.processors.map(p =>
|
||||
`<div class="processor ${p.status}">${p.name}: ${p.status} (${p.progress}%)</div>`
|
||||
).join('')}
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
}
|
||||
document.getElementById('jobs').innerHTML = jobsHtml;
|
||||
|
||||
// Worker Status
|
||||
const workerRes = await fetch('/api/v1/monitor/worker_status');
|
||||
const worker = await workerRes.json();
|
||||
document.getElementById('worker').innerHTML =
|
||||
`<h2>Worker Resources</h2>
|
||||
<div>CPU: ${worker.cpu_percent.toFixed(1)}% | GPU: ${worker.gpu_percent.toFixed(1)}% | Memory: ${worker.memory_mb}MB (${worker.memory_percent.toFixed(1)}%)</div>
|
||||
<div>Active Processors: ${worker.active_processors}/${worker.max_processors}</div>`;
|
||||
|
||||
} catch (e) {
|
||||
console.error('Error:', e);
|
||||
document.getElementById('jobs').innerHTML = '<div style="color: red;">Error loading data: ' + e.message + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
refresh();
|
||||
setInterval(refresh, 5000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user