feat: Update recursive search option to default to true and remove related UI elements

This commit is contained in:
Will Miao
2025-08-26 18:14:43 +08:00
parent d2268fc9e0
commit 842beec7cc
7 changed files with 8 additions and 105 deletions

View File

@@ -191,7 +191,7 @@ class BaseModelRoutes(ABC):
'modelname': request.query.get('search_modelname', 'true').lower() == 'true',
'tags': request.query.get('search_tags', 'false').lower() == 'true',
'creator': request.query.get('search_creator', 'false').lower() == 'true',
'recursive': request.query.get('recursive', 'false').lower() == 'true',
'recursive': request.query.get('recursive', 'true').lower() == 'true',
}
# Parse hash filters if provided

View File

@@ -68,7 +68,7 @@ class BaseModelService(ABC):
'filename': True,
'modelname': True,
'tags': False,
'recursive': False,
'recursive': True,
}
# Get the base data set using new sort logic
@@ -139,7 +139,7 @@ class BaseModelService(ABC):
# Apply folder filtering
if folder is not None:
if search_options and search_options.get('recursive', False):
if search_options and search_options.get('recursive', True):
# Recursive folder filtering - include all subfolders
data = [
item for item in data

View File

@@ -445,69 +445,6 @@
border-color: var(--lora-accent);
}
/* Switch styles */
.search-option-switch {
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px 0;
}
.switch {
position: relative;
display: inline-block;
width: 46px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
}
input:checked + .slider {
background-color: var(--lora-accent);
}
input:focus + .slider {
box-shadow: 0 0 1px var(--lora-accent);
}
input:checked + .slider:before {
transform: translateX(22px);
}
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
/* Mobile adjustments */
@media (max-width: 768px) {
.search-options-panel,

View File

@@ -673,7 +673,6 @@ export class BaseModelApiClient {
}
}
}
params.append('recursive', (pageState.searchOptions?.recursive ?? false).toString());
if (pageState.filters) {
if (pageState.filters.tags && pageState.filters.tags.length > 0) {

View File

@@ -19,7 +19,6 @@ export class SearchManager {
this.searchOptionsPanel = document.getElementById('searchOptionsPanel');
this.closeSearchOptions = document.getElementById('closeSearchOptions');
this.searchOptionTags = document.querySelectorAll('.search-option-tag');
this.recursiveSearchToggle = document.getElementById('recursiveSearchToggle');
this.searchTimeout = null;
this.currentPage = options.page || document.body.dataset.page || 'loras';
@@ -112,14 +111,6 @@ export class SearchManager {
});
}
// Recursive search toggle
if (this.recursiveSearchToggle) {
this.recursiveSearchToggle.addEventListener('change', () => {
this.saveSearchPreferences();
this.performSearch();
});
}
// Add global click handler to close panels when clicking outside
document.addEventListener('click', (e) => {
// Close search options panel when clicking outside
@@ -218,11 +209,6 @@ export class SearchManager {
});
}
// Apply recursive search - only if the toggle exists
if (this.recursiveSearchToggle && preferences.recursive !== undefined) {
this.recursiveSearchToggle.checked = preferences.recursive;
}
// Ensure at least one search option is selected
this.validateSearchOptions();
} catch (error) {
@@ -272,11 +258,6 @@ export class SearchManager {
options
};
// Only add recursive option if the toggle exists
if (this.recursiveSearchToggle) {
preferences.recursive = this.recursiveSearchToggle.checked;
}
setStorageItem(`${this.currentPage}_search_prefs`, preferences);
} catch (error) {
console.error('Error saving search preferences:', error);
@@ -294,7 +275,6 @@ export class SearchManager {
performSearch() {
const query = this.searchInput.value.trim();
const options = this.getActiveSearchOptions();
const recursive = this.recursiveSearchToggle ? this.recursiveSearchToggle.checked : false;
// Update the state with search parameters
const pageState = getCurrentPageState();
@@ -318,16 +298,14 @@ export class SearchManager {
filename: options.filename || false,
modelname: options.modelname || false,
tags: options.tags || false,
creator: options.creator || false,
recursive: recursive
creator: options.creator || false
};
} else if (this.currentPage === 'checkpoints') {
pageState.searchOptions = {
filename: options.filename || false,
modelname: options.modelname || false,
tags: options.tags || false,
creator: options.creator || false,
recursive: recursive
creator: options.creator || false
};
}
}

View File

@@ -38,7 +38,7 @@ export const state = {
modelname: true,
tags: false,
creator: false,
recursive: false
recursive: true,
},
filters: {
baseModel: [],
@@ -85,7 +85,7 @@ export const state = {
filename: true,
modelname: true,
creator: false,
recursive: false
recursive: true,
},
filters: {
baseModel: [],
@@ -113,7 +113,7 @@ export const state = {
modelname: true,
tags: false,
creator: false,
recursive: false
recursive: true,
},
filters: {
baseModel: [],

View File

@@ -101,17 +101,6 @@
{% endif %}
</div>
</div>
{% if request.path != '/loras/recipes' %}
<div class="options-section">
<div class="search-option-switch">
<span>Include Subfolders</span>
<label class="switch">
<input type="checkbox" id="recursiveSearchToggle">
<span class="slider round"></span>
</label>
</div>
</div>
{% endif %}
</div>
<!-- Add filter panel -->