Add Suno companion connection test
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name ChatGPT to Suno Prompt Copier
|
// @name ChatGPT to Suno Prompt Copier
|
||||||
// @namespace local.suno-helper
|
// @namespace local.suno-helper
|
||||||
// @version 0.5.1
|
// @version 0.5.2
|
||||||
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
||||||
// @author local
|
// @author local
|
||||||
// @match https://chatgpt.com/*
|
// @match https://chatgpt.com/*
|
||||||
@@ -978,6 +978,24 @@
|
|||||||
setStatus(statusTarget, `로컬 처리 시작: ${data.jobId || "job"} / ${data.log || "companion console 확인"}`);
|
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() {
|
async function bootSuno() {
|
||||||
const body = createPanel("Suno Prompt Paste");
|
const body = createPanel("Suno Prompt Paste");
|
||||||
const slots = await readSlots();
|
const slots = await readSlots();
|
||||||
@@ -995,6 +1013,9 @@
|
|||||||
<div class="cgs-row">
|
<div class="cgs-row">
|
||||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-scan-library>곡 감지</button>
|
<button class="cgs-btn cgs-wide" type="button" data-cgs-scan-library>곡 감지</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cgs-row">
|
||||||
|
<button class="cgs-btn cgs-wide" type="button" data-cgs-test-companion>연결 테스트</button>
|
||||||
|
</div>
|
||||||
<div class="cgs-row">
|
<div class="cgs-row">
|
||||||
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-library>WAV + 메타데이터 다운</button>
|
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-library>WAV + 메타데이터 다운</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -1063,6 +1084,10 @@
|
|||||||
await exportSunoManifest(libraryTracks, body);
|
await exportSunoManifest(libraryTracks, body);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
body.querySelector("[data-cgs-test-companion]").addEventListener("click", async () => {
|
||||||
|
await testCompanion(body);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeBootSuno() {
|
function safeBootSuno() {
|
||||||
|
|||||||
Reference in New Issue
Block a user