mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for user script popup
This commit is contained in:
22
aiserver.py
22
aiserver.py
@@ -8788,19 +8788,19 @@ def valid_userscripts_to_unload(file):
|
|||||||
def get_userscripts_desc(item_full_path, item, valid_selection):
|
def get_userscripts_desc(item_full_path, item, valid_selection):
|
||||||
if not valid_selection:
|
if not valid_selection:
|
||||||
return [None, None]
|
return [None, None]
|
||||||
ob = ["", ""]
|
ob = [item, "", ""]
|
||||||
description = []
|
description = []
|
||||||
multiline = False
|
multiline = False
|
||||||
with open(item_full_path) as f:
|
with open(item_full_path) as f:
|
||||||
ob[0] = f.readline().strip().replace("\033", "")
|
ob[1] = f.readline().strip().replace("\033", "")
|
||||||
if ob[0][:2] != "--":
|
if ob[1][:2] != "--":
|
||||||
ob[0] = file
|
ob[1] = file
|
||||||
else:
|
else:
|
||||||
ob[0] = ob[0][2:]
|
ob[1] = ob[1][2:]
|
||||||
if ob[0][:2] == "[[":
|
if ob[1][:2] == "[[":
|
||||||
ob[0] = ob[0][2:]
|
ob[1] = ob[1][2:]
|
||||||
multiline = True
|
multiline = True
|
||||||
ob[0] = ob[0].lstrip("-").strip()
|
ob[1] = ob[1].lstrip("-").strip()
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.strip().replace("\033", "")
|
line = line.strip().replace("\033", "")
|
||||||
if multiline:
|
if multiline:
|
||||||
@@ -8820,9 +8820,9 @@ def get_userscripts_desc(item_full_path, item, valid_selection):
|
|||||||
multiline = True
|
multiline = True
|
||||||
line = line[2:]
|
line = line[2:]
|
||||||
description.append(line.strip())
|
description.append(line.strip())
|
||||||
ob[1] = "\n".join(description)
|
ob[2] = "\n".join(description)
|
||||||
if len(ob[1]) > 250:
|
if len(ob[2]) > 250:
|
||||||
ob[1] = ob[1][:247] + "..."
|
ob[2] = ob[2][:247] + "..."
|
||||||
return ob
|
return ob
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
|
@@ -969,7 +969,7 @@ function redrawPopup() {
|
|||||||
let gridIndex = 0;
|
let gridIndex = 0;
|
||||||
if (row.showFilename) {
|
if (row.showFilename) {
|
||||||
let popup_item = document.createElement("span");
|
let popup_item = document.createElement("span");
|
||||||
popup_item.style = `grid-area: p${gridIndex};`;
|
popup_item.style = `overflow-x: hidden; grid-area: p${gridIndex};`;
|
||||||
gridIndex += 1;
|
gridIndex += 1;
|
||||||
|
|
||||||
popup_item.id = row.path;
|
popup_item.id = row.path;
|
||||||
@@ -1006,7 +1006,7 @@ function redrawPopup() {
|
|||||||
const dataValue = row.data[columnName];
|
const dataValue = row.data[columnName];
|
||||||
|
|
||||||
let td = document.createElement("span");
|
let td = document.createElement("span");
|
||||||
td.style = `grid-area: p${gridIndex};`;
|
td.style = `overflow-x: hidden; grid-area: p${gridIndex};`;
|
||||||
|
|
||||||
gridIndex += 1;
|
gridIndex += 1;
|
||||||
dataIndex++;
|
dataIndex++;
|
||||||
@@ -1151,7 +1151,7 @@ function popup_items(data) {
|
|||||||
if (data.show_filename) {
|
if (data.show_filename) {
|
||||||
td = document.createElement("span");
|
td = document.createElement("span");
|
||||||
td.textContent = "File Name";
|
td.textContent = "File Name";
|
||||||
td.style = "grid-area: p"+i+";";
|
td.style = "overflow-x: hidden; grid-area: p"+i+";";
|
||||||
i+=1;
|
i+=1;
|
||||||
tr.append(td)
|
tr.append(td)
|
||||||
}
|
}
|
||||||
@@ -1167,13 +1167,13 @@ function popup_items(data) {
|
|||||||
});
|
});
|
||||||
}(columnName));
|
}(columnName));
|
||||||
container.classList.add("table-header-container")
|
container.classList.add("table-header-container")
|
||||||
container.style = `grid-area: p${i};`;
|
container.style = 'overflow-x: hidden; grid-area: p${i};';
|
||||||
|
|
||||||
td.classList.add("table-header-label");
|
td.classList.add("table-header-label");
|
||||||
td.textContent = columnName;
|
td.textContent = columnName;
|
||||||
|
|
||||||
// TODO: Better unsorted icon
|
// TODO: Better unsorted icon
|
||||||
icon.id = `sort-icon-${columnName.toLowerCase().replaceAll(" ", "-")}`;
|
icon.id = 'sort-icon-${columnName.toLowerCase().replaceAll(" ", "-")}';
|
||||||
icon.innerText = "filter_list";
|
icon.innerText = "filter_list";
|
||||||
icon.classList.add("material-icons-outlined");
|
icon.classList.add("material-icons-outlined");
|
||||||
icon.classList.add("table-header-sort-icon");
|
icon.classList.add("table-header-sort-icon");
|
||||||
|
Reference in New Issue
Block a user