Add parallel companion processing dashboard

This commit is contained in:
DESKTOP-KSVGT20\shkim
2026-05-02 01:31:25 +09:00
parent 0d03921b1a
commit 056a08a5c8
3 changed files with 255 additions and 71 deletions
+23 -5
View File
@@ -1,7 +1,7 @@
// ==UserScript==
// @name ChatGPT to Suno Prompt Copier
// @namespace local.suno-helper
// @version 0.8.6
// @version 0.8.7
// @description Copy structured ChatGPT song prompt versions into Suno fields.
// @author local
// @match https://chatgpt.com/*
@@ -30,7 +30,7 @@
(function () {
"use strict";
const SCRIPT_VERSION = "0.8.6";
const SCRIPT_VERSION = "0.8.7";
const STORAGE_KEY = "chatgptSunoPromptSlots";
const SLOT_COUNT = 2;
const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com");
@@ -1417,7 +1417,11 @@
}
await new Promise((resolve) => setTimeout(resolve, 400));
}
setStatus(statusTarget, `${format.toUpperCase()} 일괄 업로드 완료: ${uploaded}곡 성공, ${failed}곡 실패. 로컬에서 메타데이터 후처리 중.`);
let healthText = "";
try {
healthText = ` / ${formatCompanionStatus(await readCompanionHealth())}`;
} catch {}
setStatus(statusTarget, `${format.toUpperCase()} 일괄 업로드 완료: ${uploaded}곡 성공, ${failed}곡 실패. 로컬에서 메타데이터 후처리 중${healthText}`);
}
function trackOptionLabel(track, index) {
@@ -1438,7 +1442,7 @@
return;
}
const data = tryParseJson(text) || {};
setStatus(statusTarget, `연결 OK: ${data.outputRoot || "outputRoot 확인됨"}`);
setStatus(statusTarget, `연결 OK: ${formatCompanionStatus(data)}`);
} catch (error) {
setStatus(statusTarget, `연결 실패: companion을 켜고 새로고침해줘. ${error.message || error}`);
}
@@ -1456,6 +1460,20 @@
return tryParseJson(text) || {};
}
function formatCompanionStatus(data) {
if (!data || typeof data !== "object") return "상태 정보 없음";
const active = Number(data.activeCount || 0);
const queued = Number(data.queued || 0);
const done = Number(data.done ?? ((data.completed || 0) + (data.failed || 0)));
const total = Number(data.total || 0);
const failed = Number(data.failed || 0);
const percent = Number.isFinite(Number(data.percent)) ? Number(data.percent) : (total ? Math.round((done / total) * 1000) / 10 : 100);
const workerText = data.maxWorkers ? `${active}/${data.maxWorkers}` : `${active}`;
const title = data.active || "";
const titleText = title ? ` / 처리중: ${title}` : "";
return `작업 ${done}/${total} (${percent}%), 실행 ${workerText}, 대기 ${queued}, 실패 ${failed}${titleText}`;
}
async function bootSuno() {
const body = createPanel("Suno Prompt Paste");
const slots = await readSlots();
@@ -1573,7 +1591,7 @@
}
try {
const data = await uploadTrackToCompanion(track, body, format);
setStatus(body, `선택 1곡 ${format.toUpperCase()} 업로드 완료: ${track.title || track.id} / 대기 ${data.queued ?? "?"}개 / 처리 ${data.active || "대기"}`);
setStatus(body, `선택 1곡 ${format.toUpperCase()} 업로드 완료: ${track.title || track.id} / ${formatCompanionStatus(data)}`);
} catch (error) {
setStatus(body, `선택 1곡 ${format.toUpperCase()} 처리 실패: ${error.message || error}`);
}