Minor fit/finish updates to the file filter experience

This commit is contained in:
sabaimran 2024-06-07 15:05:00 +05:30
parent 58a02f06ea
commit dbb06466bf

View file

@ -901,14 +901,8 @@ To get started, just start typing below. You can also type / to see a list of co
// Display indexing success message // Display indexing success message
flashStatusInChatInput("✅ File indexed successfully"); flashStatusInChatInput("✅ File indexed successfully");
renderAllFiles(); renderAllFiles();
//get the selected-files ul first addFileFilterToConversation(fileName);
var selectedFiles = document.getElementsByClassName("selected-files")[0]; loadFileFiltersFromConversation();
const escapedFileName = fileName.replace(/\./g, '\\.');
const newFile = selectedFiles.querySelector(`#${escapedFileName}`);
if(!newFile){
addFileFilterToConversation(fileName);
loadFileFiltersFromConversation();
}
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -1841,11 +1835,12 @@ To get started, just start typing below. You can also type / to see a list of co
allFiles = data; allFiles = data;
var nofilesmessage = document.getElementsByClassName("no-files-message")[0]; var nofilesmessage = document.getElementsByClassName("no-files-message")[0];
if(allFiles.length === 0){ if(allFiles.length === 0){
nofilesmessage.innerHTML = "No files found. Visit "; nofilesmessage.innerHTML = `<a class="inline-chat-link" href="https://docs.khoj.dev/category/clients/">How to upload files</a>`;
nofilesmessage.innerHTML += "<a href=\"https://docs.khoj.dev/category/clients/\">Documentation</a>" document.getElementById("file-toggle-button").style.display = "none";
} }
else{ else{
nofilesmessage.innerHTML = ""; nofilesmessage.innerHTML = "";
document.getElementById("file-toggle-button").style.display = "block";
} }
}) })
.catch((error) => { .catch((error) => {
@ -2076,7 +2071,7 @@ To get started, just start typing below. You can also type / to see a list of co
<div style="border-top: 1px solid black; "> <div style="border-top: 1px solid black; ">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; margin-top: 5px;"> <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; margin-top: 5px;">
<p style="margin: 0;">Files</p> <p style="margin: 0;">Files</p>
<svg class="file-toggle-button" style="width:20px; height:20px; position: relative; top: 2px" viewBox="0 0 40 40" fill="#000000" xmlns="http://www.w3.org/2000/svg"> <svg id="file-toggle-button" class="file-toggle-button" style="width:20px; height:20px; position: relative; top: 2px" viewBox="0 0 40 40" fill="#000000" xmlns="http://www.w3.org/2000/svg">
<path d="M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z"></path> <path d="M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z"></path>
</svg> </svg>
</div> </div>
@ -2261,8 +2256,7 @@ To get started, just start typing below. You can also type / to see a list of co
border: 1px solid var(--primary-hover); border: 1px solid var(--primary-hover);
margin-bottom: 4px; margin-bottom: 4px;
margin-top: 4px; margin-top: 4px;
padding-top: 4px; padding: 4px;
padding-bottom: 4px;
} }
li.fileName:hover { li.fileName:hover {