mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-07-10 01:18:32 +00:00
allow fallback plan with LLM
This commit is contained in:
parent
e9d670e203
commit
fcceb68f3f
2 changed files with 48 additions and 8 deletions
|
|
@ -395,6 +395,35 @@ async function fetchVoices(){
|
|||
}
|
||||
}
|
||||
|
||||
var has_llm_loaded = false;
|
||||
async function fetchStats(){
|
||||
try{
|
||||
const base = document.getElementById("baseUrl").value.trim();
|
||||
const url = (base ? base.replace(/\/$/,"") : "") + "/api/extra/version";
|
||||
|
||||
let headers = {"Content-Type": "application/json"};
|
||||
if(document.getElementById("baseUrlKey").value!="")
|
||||
{
|
||||
headers["Authorization"] = `Bearer ${document.getElementById("baseUrlKey").value}`;
|
||||
}
|
||||
|
||||
const res = await fetch(url,{
|
||||
method: "GET",
|
||||
headers: headers
|
||||
});
|
||||
if(!res.ok) throw new Error();
|
||||
|
||||
const perf = await res.json();
|
||||
if(perf && perf.llm)
|
||||
{
|
||||
has_llm_loaded = true;
|
||||
}
|
||||
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function populateVoiceList(list){
|
||||
const select = document.getElementById("tts_voice");
|
||||
select.innerHTML = "";
|
||||
|
|
@ -624,7 +653,15 @@ async function planSongNative(){
|
|||
const data=await res.json();
|
||||
if(data && data.error && data.error != "")
|
||||
{
|
||||
showMessage(`Plan failed! Error: ${data.error}`);
|
||||
//if llm is loaded, retry with that
|
||||
if(has_llm_loaded)
|
||||
{
|
||||
await planSongWithLLM();
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessage(`Plan failed! Error: ${data.error}`);
|
||||
}
|
||||
}else{
|
||||
updateForm(data);
|
||||
showMessage("Plan generated.");
|
||||
|
|
@ -894,6 +931,7 @@ function importPlan(event){
|
|||
|
||||
initDB().then(loadLibrary);
|
||||
fetchVoices();
|
||||
fetchStats();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -9007,7 +9007,7 @@ Current version indicated by LITEVER below.
|
|||
.then(modelsdata => {
|
||||
|
||||
if (modelsdata == null || modelsdata.length == 0) {
|
||||
msgbox("Invalid data received or no models found. Is ComfyUI running at the url " + localsettings.saved_comfy_url + " ?\n\nIt must be launched with the flags --listen --enable-cors-header '*' to enable API access");
|
||||
msgbox("Invalid data received or no models found. Is ComfyUI running at the url " + localsettings.saved_comfy_url + " ?\n\nIt must be launched with the flags --listen --enable-cors-header '*' to enable API access.\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)");
|
||||
} else {
|
||||
let current_loaded_model = modelsdata[0];
|
||||
//repopulate our model list
|
||||
|
|
@ -9022,7 +9022,7 @@ Current version indicated by LITEVER below.
|
|||
}).catch((error) => {
|
||||
if(!silent)
|
||||
{
|
||||
msgbox("ComfyUI Connect Error: " + error+"\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flags --listen --enable-cors-header '*' to enable API access. If using ComfyUI-Login, the Bearer Token must match.\n");
|
||||
msgbox("ComfyUI Connect Error: " + error+"\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flags --listen --enable-cors-header '*' to enable API access. If using ComfyUI-Login, the Bearer Token must match.\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)\n");
|
||||
}
|
||||
comfyui_is_connected = false;
|
||||
});
|
||||
|
|
@ -9228,15 +9228,15 @@ Current version indicated by LITEVER below.
|
|||
image_db[imgid].imrefid = resp.prompt_id.toString();
|
||||
}else{
|
||||
console.log("Generation Error!");
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n");
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)\n");
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Generation Error: " + error);
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n");
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)\n");
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.log("Upload Img2Img Error: " + error);
|
||||
msgbox("Image Upload Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n");
|
||||
msgbox("Image Upload Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)\n");
|
||||
});
|
||||
return imgid;
|
||||
}
|
||||
|
|
@ -12801,7 +12801,9 @@ Current version indicated by LITEVER below.
|
|||
let clickinfo = "";
|
||||
if(elem.info && elem.info!="")
|
||||
{
|
||||
clickinfo += escape_html(replaceAll(elem.info,"\'","\\\'"));
|
||||
let tmp = replaceAll(elem.info,"\'","\\\'");
|
||||
tmp = replaceAll(tmp,"\n"," ");
|
||||
clickinfo += escape_html(tmp);
|
||||
}
|
||||
if(elem.threads>1)
|
||||
{
|
||||
|
|
@ -23473,7 +23475,7 @@ Current version indicated by LITEVER below.
|
|||
}).catch((error) => {
|
||||
console.log("Generation Error: " + error);
|
||||
delete image_db[key];
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n");
|
||||
msgbox("Image Generation Failed!\n\nPlease make sure ComfyUI is running at "+localsettings.saved_comfy_url+" and properly configured!\n\nIt must be launched with the flag --listen --enable-cors-header '*' to enable API access\n(If --enable-cors-header '*' does not work, try --enable-cors-header *)\n");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue