From 0d9d5f1e444d08215c81aa1b461a035fcc179d70 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Sun, 23 Jul 2023 11:08:29 +0200 Subject: [PATCH] Safety check & remove log --- javascript/ext_loras.js | 4 ++-- javascript/ext_lycos.js | 4 ++-- javascript/ext_modelKeyword.js | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/javascript/ext_loras.js b/javascript/ext_loras.js index b035630..56e5473 100644 --- a/javascript/ext_loras.js +++ b/javascript/ext_loras.js @@ -30,8 +30,8 @@ async function load() { if (loras.length === 0) { try { loras = (await loadCSV(`${tagBasePath}/temp/lora.txt`)) - .filter(x => x[0].trim().length > 0) // Remove empty lines - .map(x => [x[0].trim(), x[1]]); // Remove carriage returns and padding if it exists, split into name, hash pairs + .filter(x => x[0]?.trim().length > 0) // Remove empty lines + .map(x => [x[0]?.trim(), x[1]]); // Trim filenames and return the name, hash pairs } catch (e) { console.error("Error loading lora.txt: " + e); } diff --git a/javascript/ext_lycos.js b/javascript/ext_lycos.js index b2da91c..f24fa01 100644 --- a/javascript/ext_lycos.js +++ b/javascript/ext_lycos.js @@ -30,8 +30,8 @@ async function load() { if (lycos.length === 0) { try { lycos = (await loadCSV(`${tagBasePath}/temp/lyco.txt`)) - .filter(x => x[0].trim().length > 0) // Remove empty lines - .map(x => [x[0].trim(), x[1]]); // Remove carriage returns and padding if it exists, split into name, hash pairs + .filter(x => x[0]?.trim().length > 0) // Remove empty lines + .map(x => [x[0]?.trim(), x[1]]); // Trim filenames and return the name, hash pairs } catch (e) { console.error("Error loading lyco.txt: " + e); } diff --git a/javascript/ext_modelKeyword.js b/javascript/ext_modelKeyword.js index d21576e..ff07910 100644 --- a/javascript/ext_modelKeyword.js +++ b/javascript/ext_modelKeyword.js @@ -16,7 +16,6 @@ async function load() { if (csv_lines.length === 0) return; csv_lines = csv_lines.filter(x => x[0].trim().length > 0 && x[0].trim()[0] !== "#") // Remove empty lines and comments - console.log(csv_lines) // Add to the dict csv_lines.forEach(parts => {