Enhance LoRA and Recipe templates by adding request context to template rendering. Update JavaScript to initialize search managers with context-specific options and improve header navigation with dynamic search placeholders. Refactor header component for better context awareness in search functionality.

This commit is contained in:
Will Miao
2025-03-17 10:11:50 +08:00
parent b0a8b0cc6f
commit 1034282161
8 changed files with 631 additions and 37 deletions

View File

@@ -22,7 +22,7 @@ import {
} from './utils/uiHelpers.js';
import { initializeInfiniteScroll } from './utils/infiniteScroll.js';
import { showDeleteModal, confirmDelete, closeDeleteModal } from './utils/modalUtils.js';
import { SearchManager } from './utils/search.js';
import { SearchManager } from './managers/SearchManager.js';
import { DownloadManager } from './managers/DownloadManager.js';
import { SettingsManager, toggleApiKeyVisibility } from './managers/SettingsManager.js';
import { LoraContextMenu } from './components/ContextMenu.js';
@@ -104,6 +104,22 @@ document.addEventListener('DOMContentLoaded', async () => {
// Update positions on window resize
window.addEventListener('resize', updatePanelPositions);
// Initialize search manager with LoRA-specific options
const loraSearchManager = new SearchManager({
searchCallback: (query, options, recursive) => {
// LoRA-specific search implementation
// This could call your API with the right parameters
fetchLoras({
search: query,
search_options: options,
recursive: recursive
});
}
});
// Set the current page for proper context
document.body.dataset.page = 'loras';
});
// Initialize event listeners