Skip to content

Commit 84a64ba

Browse files
author
prima
committed
fix: Characters without alt greetings breaking
1 parent 715f24a commit 84a64ba

File tree

1 file changed

+41
-24
lines changed

1 file changed

+41
-24
lines changed

klite.embd

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37586,27 +37586,35 @@ flowchart TD\n${treeToViewOutput.outputText.trim()}`
3758637586
charIcon.onclick = async () => {
3758737587
if (type === "Character")
3758837588
{
37589-
let data = await getCharacterData(name), {image} = data;
37590-
let {description, first_mes, alternate_greetings, character_book, tags, creator, creator_notes, personality } = (data)?.data;
37591-
let contents = createDetailsContent(name);
37592-
if (!!image)
37589+
let contents = "<span />";
37590+
try
3759337591
{
37594-
let imageContainer = document.createElement("span"), imageElem = document.createElement("img");
37595-
imageElem.src = image;
37596-
imageElem.style = "height: 30%; width: 30%; border-radius: 10px;"
37597-
imageContainer.style = "width: 100%; display: flex; justify-content: space-around; padding: 10px;";
37598-
imageContainer.appendChild(imageElem);
37599-
contents.appendChild(imageContainer);
37592+
let data = await getCharacterData(name), {image} = data;
37593+
let {description, first_mes, alternate_greetings, character_book, tags, creator, creator_notes, personality } = (data)?.data;
37594+
contents = createDetailsContent(name);
37595+
if (!!image)
37596+
{
37597+
let imageContainer = document.createElement("span"), imageElem = document.createElement("img");
37598+
imageElem.src = image;
37599+
imageElem.style = "height: 30%; width: 30%; border-radius: 10px;"
37600+
imageContainer.style = "width: 100%; display: flex; justify-content: space-around; padding: 10px;";
37601+
imageContainer.appendChild(imageElem);
37602+
contents.appendChild(imageContainer);
37603+
}
37604+
createSection(contents, "Creator", creator);
37605+
createSection(contents, "Tags", tags);
37606+
createSection(contents, "Creators notes", creator_notes);
37607+
createSection(contents, "Memory", description);
37608+
createSection(contents, "Alternative greetings", [first_mes, ...(alternate_greetings || [])]);
37609+
createSection(contents, "Personality", personality);
37610+
createSection(contents, "World info", character_book?.entries?.map(entry => {
37611+
return lorebookEntryToString(entry);
37612+
}));
37613+
}
37614+
catch (e)
37615+
{
37616+
console.error(e)
3760037617
}
37601-
createSection(contents, "Creator", creator);
37602-
createSection(contents, "Tags", tags);
37603-
createSection(contents, "Creators notes", creator_notes);
37604-
createSection(contents, "Memory", description);
37605-
createSection(contents, "Alternative greetings", [first_mes, ...alternate_greetings]);
37606-
createSection(contents, "Personality", personality);
37607-
createSection(contents, "World info", character_book?.entries?.map(entry => {
37608-
return lorebookEntryToString(entry);
37609-
}));
3761037618

3761137619
popupUtils.reset().title("Character Options").content(contents).button("Load character", async () => {
3761237620
popupUtils.reset()
@@ -37626,11 +37634,20 @@ flowchart TD\n${treeToViewOutput.outputText.trim()}`
3762637634
}
3762737635
else if (type === "World Info")
3762837636
{
37629-
let data = await getCharacterData(name);
37630-
let contents = createDetailsContent(name);
37631-
createSection(contents, "World info", data?.data?.map(entry => {
37632-
return wiEntryToString(entry);
37633-
}));
37637+
let contents = "<span />";
37638+
try
37639+
{
37640+
let data = await getCharacterData(name);
37641+
let contents = createDetailsContent(name);
37642+
createSection(contents, "World info", data?.data?.map(entry => {
37643+
return wiEntryToString(entry);
37644+
}));
37645+
}
37646+
catch (e)
37647+
{
37648+
console.error(e)
37649+
}
37650+
3763437651
popupUtils.reset().title("World Info Options").content(contents).button("Add to WI", async () => {
3763537652
popupUtils.reset()
3763637653
let charData = await getCharacterData(name)

0 commit comments

Comments
 (0)