Add Suno companion connection test

This commit is contained in:
DESKTOP-KSVGT20\shkim
2026-05-01 23:00:23 +09:00
parent bee6bb3e81
commit cf848bf0c4
+26 -1
View File
@@ -1,7 +1,7 @@
// ==UserScript==
// @name ChatGPT to Suno Prompt Copier
// @namespace local.suno-helper
// @version 0.5.1
// @version 0.5.2
// @description Copy structured ChatGPT song prompt versions into Suno fields.
// @author local
// @match https://chatgpt.com/*
@@ -978,6 +978,24 @@
setStatus(statusTarget, `로컬 처리 시작: ${data.jobId || "job"} / ${data.log || "companion console 확인"}`);
}
async function testCompanion(statusTarget) {
try {
const response = await fetch("http://127.0.0.1:17873/health", {
method: "GET",
cache: "no-store",
});
const text = await response.text();
if (!response.ok) {
setStatus(statusTarget, `연결 실패: ${response.status} ${response.statusText}`);
return;
}
const data = tryParseJson(text) || {};
setStatus(statusTarget, `연결 OK: ${data.outputRoot || "outputRoot 확인됨"}`);
} catch (error) {
setStatus(statusTarget, `연결 실패: companion을 켜고 새로고침해줘. ${error.message || error}`);
}
}
async function bootSuno() {
const body = createPanel("Suno Prompt Paste");
const slots = await readSlots();
@@ -995,6 +1013,9 @@
<div class="cgs-row">
<button class="cgs-btn cgs-wide" type="button" data-cgs-scan-library>곡 감지</button>
</div>
<div class="cgs-row">
<button class="cgs-btn cgs-wide" type="button" data-cgs-test-companion>연결 테스트</button>
</div>
<div class="cgs-row">
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-library>WAV + 메타데이터 다운</button>
</div>
@@ -1063,6 +1084,10 @@
await exportSunoManifest(libraryTracks, body);
}
});
body.querySelector("[data-cgs-test-companion]").addEventListener("click", async () => {
await testCompanion(body);
});
}
function safeBootSuno() {