feat: Add Lora recipes retrieval and filtering functionality

- Implemented a new API endpoint to fetch recipes associated with a specific Lora by its hash.
- Enhanced the recipe scanning logic to support filtering by Lora hash and bypassing other filters.
- Added a new method to retrieve a recipe by its ID with formatted metadata.
- Created a new RecipeTab component to display recipes in the Lora modal.
- Introduced session storage utilities for managing custom filter states.
- Updated the UI to include a custom filter indicator and loading/error states for recipes.
- Refactored existing recipe management logic to accommodate new features and improve maintainability.
This commit is contained in:
Will Miao
2025-04-07 21:53:39 +08:00
parent b8c78a68e7
commit bddc7a438d
10 changed files with 829 additions and 88 deletions

View File

@@ -0,0 +1,65 @@
/* Filter indicator styles */
.control-group .filter-active {
display: flex;
align-items: center;
gap: 8px;
background: var(--lora-accent);
color: white;
border-radius: 20px;
padding: 6px 12px;
transition: all 0.3s ease;
border: none;
cursor: pointer;
}
.control-group .filter-active:hover {
background: var(--lora-accent);
opacity: 0.9;
}
.control-group .filter-active i.fa-filter {
font-size: 0.9em;
margin-right: 2px;
}
.control-group .filter-active i.clear-filter {
transition: transform 0.2s ease;
cursor: pointer;
margin-left: 4px;
border-radius: 50%;
font-size: 0.9em;
}
.control-group .filter-active i.clear-filter:hover {
transform: scale(1.2);
}
.control-group .filter-active .lora-name {
font-weight: 500;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Animation for filter indicator */
@keyframes filterPulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
.filter-active.animate {
animation: filterPulse 0.6s ease;
}
/* Make responsive */
@media (max-width: 576px) {
.control-group .filter-active {
padding: 6px 10px;
}
.control-group .filter-active .lora-name {
max-width: 100px;
}
}

View File

@@ -863,7 +863,7 @@
}
.model-description-content blockquote {
border-left: 3px solid var(--lora-accent);
border-left: 3px solid var (--lora-accent);
padding-left: 1em;
margin-left: 0;
margin-right: 0;
@@ -1280,4 +1280,47 @@
font-size: 1.1em;
color: var(--lora-accent);
opacity: 0.8;
}
.view-all-btn {
display: flex;
align-items: center;
gap: 5px;
padding: 6px 12px;
background-color: var(--lora-accent);
color: var(--lora-text);
border: none;
border-radius: var(--border-radius-sm);
cursor: pointer;
transition: background-color 0.2s;
font-size: 13px;
}
.view-all-btn:hover {
opacity: 0.9;
}
/* Loading, error and empty states */
.recipes-loading,
.recipes-error,
.recipes-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
text-align: center;
min-height: 200px;
}
.recipes-loading i,
.recipes-error i,
.recipes-empty i {
font-size: 32px;
margin-bottom: 15px;
color: var(--lora-accent);
}
.recipes-error i {
color: var(--lora-error);
}

View File

@@ -18,6 +18,7 @@
@import 'components/search-filter.css';
@import 'components/bulk.css';
@import 'components/shared.css';
@import 'components/filter-indicator.css';
.initialization-notice {
display: flex;