Added renaming and adding query results , fixed missing localization

This commit is contained in:
2026-01-19 13:14:04 +01:00
parent 59945cb523
commit 4f257a745b
3 changed files with 89 additions and 25 deletions

View File

@@ -324,4 +324,16 @@
<data name="parallelEmbeddingsPrefetchInfo" xml:space="preserve"> <data name="parallelEmbeddingsPrefetchInfo" xml:space="preserve">
<value>Wenn diese Einstellung aktiv ist, wird das Abrufen von Embeddings beim Indizieren von Entities parallelisiert. Deaktiviere diese Einstellung, falls Model-unloading ein Problem ist.</value> <value>Wenn diese Einstellung aktiv ist, wird das Abrufen von Embeddings beim Indizieren von Entities parallelisiert. Deaktiviere diese Einstellung, falls Model-unloading ein Problem ist.</value>
</data> </data>
<data name="Add result" xml:space="preserve">
<value>Ergebnis hinzufügen</value>
</data>
<data name="Search query was updated successfully" xml:space="preserve">
<value>Suchanfrage wurde erfolgreich angepasst</value>
</data>
<data name="Total RAM usage" xml:space="preserve">
<value>RAM Verwendung insgesamt</value>
</data>
<data name="Total Database size" xml:space="preserve">
<value>Datenbankgröße insgesamt</value>
</data>
</root> </root>

View File

@@ -324,4 +324,16 @@
<data name="parallelEmbeddingsPrefetchInfo" xml:space="preserve"> <data name="parallelEmbeddingsPrefetchInfo" xml:space="preserve">
<value>With this setting activated the embeddings retrieval will be parallelized when indexing entities. Disable this setting if model unloading is an issue.</value> <value>With this setting activated the embeddings retrieval will be parallelized when indexing entities. Disable this setting if model unloading is an issue.</value>
</data> </data>
<data name="Add result" xml:space="preserve">
<value>Add result</value>
</data>
<data name="Search query was updated successfully" xml:space="preserve">
<value>Search query was updated successfully</value>
</data>
<data name="Total RAM usage" xml:space="preserve">
<value>Total RAM usage</value>
</data>
<data name="Total Database size" xml:space="preserve">
<value>Total Database size</value>
</data>
</root> </root>

View File

@@ -265,12 +265,13 @@
<!-- Results --> <!-- Results -->
<h3>@T["Results"]</h3> <h3>@T["Results"]</h3>
<button class="btn btn-primary btn-sm" onclick="queryUpdateAddResult('', '', null, true)">@T["Add result"]</button>
<table class="table table-sm table-striped"> <table class="table table-sm table-striped">
<thead> <thead>
<tr> <tr>
<th style="width: 85px;">@T["Score"]</th> <th style="width: 85px;">@T["Score"]</th>
<th>@T["Name"]</th> <th>@T["Name"]</th>
<th>@T["Action"]</th> <th class="text-center">@T["Action"]</th>
</tr> </tr>
</thead> </thead>
<tbody id="queryUpdateResultsBody"></tbody> <tbody id="queryUpdateResultsBody"></tbody>
@@ -970,7 +971,7 @@
}).then(async response => { }).then(async response => {
result = await response.json(); result = await response.json();
if (response.ok && result.Success) { if (response.ok && result.Success) {
showToast("@T["Searchdomain was created successfully"]", "success"); showToast("@T["Search query was updated successfully"]", "success");
console.log('Search query was updated successfully'); console.log('Search query was updated successfully');
selectDomain(getSelectedDomainKey()); selectDomain(getSelectedDomainKey());
} else { } else {
@@ -1494,28 +1495,7 @@
</tr>`; </tr>`;
} else { } else {
query.Results.forEach(r => { query.Results.forEach(r => {
const row = document.createElement('tr'); queryUpdateAddResult(r.Score.toFixed(4), r.Name, resultsBody);
row.setAttribute("draggable", true);
const tdScore = document.createElement('td');
const scoreInput = document.createElement('input');
scoreInput.classList.add('form-control');
scoreInput.value = r.Score.toFixed(4);
tdScore.append(scoreInput);
const tdName = document.createElement('td');
tdName.classList.add("text-break");
tdName.innerText = r.Name;
const tdAction = document.createElement('td');
const deleteButton = document.createElement('button');
deleteButton.classList.add('btn', 'btn-danger', 'btn-sm');
deleteButton.innerText = '@Html.Raw(T["Delete"])';
deleteButton.onclick = function() {
row.remove();
};
tdAction.append(deleteButton);
row.append(tdScore);
row.append(tdName);
row.append(tdAction);
resultsBody.appendChild(row);
}); });
} }
@@ -1526,6 +1506,66 @@
modal.show(); modal.show();
} }
function queryUpdateAddResult(score, name, target=null, insertAtTop=false) {
target = target ?? document.getElementById('queryUpdateResultsBody');
const row = document.createElement('tr');
row.setAttribute("draggable", true);
const tdScore = document.createElement('td');
const scoreInput = document.createElement('input');
scoreInput.classList.add('form-control');
scoreInput.value = score;
scoreInput.ariaLabel = "@T["Score"]";
tdScore.append(scoreInput);
const tdName = document.createElement('td');
const tdNameInput = document.createElement('input');
tdNameInput.classList.add("form-control");
tdNameInput.value = name;
tdNameInput.ariaLabel = "@T["Name"]";
tdName.append(tdNameInput);
const tdAction = document.createElement('td');
tdAction.classList.add('text-center');
const upButton = document.createElement('button');
upButton.classList.add('btn', 'btn-primary', 'btn-sm');
upButton.innerText = '↑';
upButton.onclick = function() {
const currentRow = this.closest('tr');
const previousRow = currentRow.previousElementSibling;
if (previousRow) {
target.insertBefore(currentRow, previousRow);
}
};
const downButton = document.createElement('button');
downButton.classList.add('btn', 'btn-primary', 'btn-sm', 'mx-1');
downButton.innerText = '↓';
downButton.onclick = function() {
const currentRow = this.closest('tr');
const nextRow = currentRow.nextElementSibling;
if (nextRow) {
target.insertBefore(nextRow, currentRow);
}
};
const deleteButton = document.createElement('button');
deleteButton.classList.add('btn', 'btn-danger', 'btn-sm', 'mx-2');
deleteButton.innerText = '@Html.Raw(T["Delete"])';
deleteButton.onclick = function() {
row.remove();
};
tdAction.append(upButton);
tdAction.append(downButton);
tdAction.append(deleteButton);
row.append(tdScore);
row.append(tdName);
row.append(tdAction);
if (!insertAtTop) {
target.appendChild(row);
} else {
target.insertBefore(row, target.firstChild);
}
}
function NumberOfBytesAsHumanReadable(bytes, decimals = 2) { function NumberOfBytesAsHumanReadable(bytes, decimals = 2) {
if (bytes === 0) return '0 B'; if (bytes === 0) return '0 B';
if (bytes > 1.20892581961*(10**27)) return "∞ B"; if (bytes > 1.20892581961*(10**27)) return "∞ B";
@@ -1732,7 +1772,7 @@
// Get the text content from the second cell (index 1) which contains the path // Get the text content from the second cell (index 1) which contains the path
const score = parseFloat(cells[0].firstChild.value); const score = parseFloat(cells[0].firstChild.value);
const name = cells[1].textContent.trim(); const name = cells[1].firstChild.value;
result.push({ result.push({
"Score": score, "Score": score,