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

Function loadAndShowFileTypeSettings

renderer.js:4276–4334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4274 const loadingEl = document.getElementById('system-report-loading');
4275 const contentEl = document.getElementById('system-report-content');
4276 if (loadingEl) {
4277 loadingEl.innerHTML = `<p style="color: #f44336;">Error loading system report: ${error.message}</p>`;
4278 }
4279 if (contentEl) contentEl.style.display = 'none';
4280 }
4281}
4282
4283// Shared function to load AI config settings and show dialog (must be top-level for server menu access)
4284async function loadAndShowAIConfig() {
4285 const dialog = document.getElementById('ai-config-dialog');
4286 if (!dialog) {
4287 console.error('ai-config-dialog element not found.');
4288 return;
4289 }
4290
4291 // Load all settings first, then show dialog with populated values
4292 const apiKeyValue = await window.electron.getSetting('apiKey').catch(() => null);
4293 const serviceValue = await window.electron.getSetting('aiService').catch(() => null);
4294 const endpointValue = await window.electron.getSetting('apiEndpoint').catch(() => null);
4295 const modelValue = await window.electron.getSetting('aiModel').catch(() => null);
4296
4297 // Ensure dialog is in DOM before getting elements
4298 if (!dialog.isConnected) {
4299 document.body.appendChild(dialog);
4300 }
4301
4302 // Get all form elements
4303 const keyEl = document.getElementById('ai-api-key');
4304 const serviceEl = document.getElementById('ai-service-select');
4305 const endpointEl = document.getElementById('ai-endpoint');
4306 const modelEl = document.getElementById('ai-model');
4307 const apiKeyGroup = keyEl?.closest('.form-group');
4308
4309 if (!serviceEl) {
4310 console.error('ai-service-select element not found.');
4311 return;
4312 }
4313
4314 console.log('[AI Config] Found elements:', {
4315 serviceEl: !!serviceEl,
4316 endpointEl: !!endpointEl,
4317 modelEl: !!modelEl,
4318 keyEl: !!keyEl
4319 });
4320
4321 // Set service first - default to 'puter' if undefined
4322 const selectedService = serviceValue || 'puter';
4323
4324 // Force set the select value and verify it stuck
4325 serviceEl.value = selectedService;
4326
4327 // Double-check the value was set correctly
4328 if (serviceEl.value !== selectedService) {
4329 console.warn('[AI Config] Select value mismatch, forcing to:', selectedService);
4330 // Try setting by selectedIndex
4331 for (let i = 0; i < serviceEl.options.length; i++) {
4332 if (serviceEl.options[i].value === selectedService) {
4333 serviceEl.selectedIndex = i;

Callers 2

createServerMenuBarFunction · 0.85
renderer.jsFile · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected