MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / createSortableHeader

Function createSortableHeader

renderer.js:14865–14988  ·  view source on GitHub ↗
(label, sortKey, width, options = {})

Source from the content-addressed store, hash-verified

14863 } else {
14864 progressContainer.style.display = 'block';
14865 }
14866 });
14867
14868 window.electron.on('select-model-by-filepath', (filePath) => {
14869 // Context menu highlights the file only. Details open from the Details control.
14870 highlightModelWithoutDetails(filePath);
14871 });
14872
14873 // Fetch models without thumbnails
14874 const modelsWithoutThumbnails = await window.electron.getModelsWithoutThumbnails();
14875 const modelsCount = modelsWithoutThumbnails.length;
14876
14877 document.getElementById('ai-service-select').addEventListener('change', async (event) => {
14878 const selectedService = event.target.value;
14879 const endpointEl = document.getElementById('ai-endpoint');
14880 const modelEl = document.getElementById('ai-model');
14881 const apiKeyEl = document.getElementById('ai-api-key');
14882
14883 if (selectedService === 'openai') {
14884 endpointEl.value = 'https://api.openai.com/v1';
14885 modelEl.value = 'gpt-4o-mini';
14886 } else if (selectedService === 'claude') {
14887 endpointEl.value = 'https://api.anthropic.com/v1/';
14888 modelEl.value = 'claude-haiku-4-5';
14889 } else if (selectedService === 'gemini') {
14890 endpointEl.value = 'https://generativelanguage.googleapis.com/v1beta/openai/';
14891 modelEl.value = 'gemini-2.5-flash';
14892 } else if (selectedService === 'puter') {
14893 // Load Puter.js when user selects Puter service
14894 loadPuterJS().catch(err => {
14895 console.warn('[AI Config] Failed to load Puter.js:', err);
14896 });
14897
14898 endpointEl.value = 'https://js.puter.com/v2/';
14899 modelEl.value = 'gpt-5-nano';
14900 } else if (selectedService === 'custom') {
14901 endpointEl.value = '';
14902 modelEl.value = '';
14903 }
14904
14905 if (apiKeyEl && selectedService !== 'puter') {
14906 apiKeyEl.value = '';
14907 }
14908 syncAiApiKeyField(selectedService);
14909
14910 // Save the new values to the database
14911 await window.electron.saveSetting('apiEndpoint', endpointEl.value).catch(err => console.error('Error saving endpoint:', err));
14912 await window.electron.saveSetting('aiModel', modelEl.value).catch(err => console.error('Error saving model:', err));
14913 await window.electron.saveSetting('aiService', selectedService).catch(err => console.error('Error saving service:', err));
14914 console.log('[AI Config] Service changed to:', selectedService, 'and saved to database');
14915 });
14916
14917 // Add missing function renderThumbnail used in generateThumbnail().
14918 async function renderThumbnail(file) {
14919 try {
14920 // Determine filePath: if file is a string, use it directly; otherwise, assume it's an object with filePath property.
14921 const filePath = (typeof file === 'string') ? file : file.filePath;
14922 if (!filePath) {

Callers 1

createListViewHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected