diff --git a/settings.html b/settings.html index f5cc2a4..c582a31 100644 --- a/settings.html +++ b/settings.html @@ -210,70 +210,70 @@ cancel.addEventListener('click', rollback); - const container = document.getElementById('ollama-model-selectors'); - const res = await window.electronAPI.ollamaList(); + const container = document.getElementById('ollama-model-selectors'); + const res = await window.electronAPI.ollamaList(); + + if (res.status === 'no-cli') { + container.innerHTML = ` +
+ !! You need to install Ollama to use intelligent message & README generation !! +
`; + return; + } + + if (res.status === 'error') { + container.innerHTML = `
Error fetching models: ${res.msg}
`; + return; + } + + // Liste der Modell-Namen extrahieren + const names = res.models.map(m => m.name || m.model).filter(Boolean); + const qwen = names.filter(n => /^qwen2\.5-coder(:[\w\-.]+)?$/.test(n)); + + if (!qwen.length) { + // keine qwen2.5-coder → Pull-Buttons + container.innerHTML = ` +
+ `; + document.getElementById('pullCommitModelBtn').onclick = async () => { + await window.electronAPI.ollamaPull('qwen2.5-coder:7b'); + location.reload(); + }; + document.getElementById('pullReadmeModelBtn').onclick = async () => { + await window.electronAPI.ollamaPull('qwen2.5-coder:32b'); + location.reload(); + }; + return; + } + + // Dropdowns aufbauen + const makeOpts = (arr, sel) => + arr.map(m => ``).join(''); + + // Default-Auswahl aus Settings (oder erstes gefundenes) + const commitDefault = qwen.find(m=>m.includes('7b'))||qwen[0]; + const readmeDefault= qwen.find(m=>m.includes('32b'))||qwen[0]; + const currentCommit = await window.settingsAPI.getCommitModel?.() || commitDefault; + const currentReadme= await window.settingsAPI.getReadmeModel?.() || readmeDefault; - if (res.status === 'no-cli') { container.innerHTML = ` -
- !! You need to install Ollama to use intelligent message & README generation !! +
+ +
`; - return; - } - - if (res.status === 'error') { - container.innerHTML = `
Error fetching models: ${res.msg}
`; - return; - } - - // Liste der Modell-Namen extrahieren - const names = res.models.map(m => m.name || m.model).filter(Boolean); - const qwen = names.filter(n => /^qwen2\.5-coder(:[\w\-.]+)?$/.test(n)); - - if (!qwen.length) { - // keine qwen2.5-coder → Pull-Buttons - container.innerHTML = ` -
- `; - document.getElementById('pullCommitModelBtn').onclick = async () => { - await window.electronAPI.ollamaPull('qwen2.5-coder:7b'); - location.reload(); - }; - document.getElementById('pullReadmeModelBtn').onclick = async () => { - await window.electronAPI.ollamaPull('qwen2.5-coder:32b'); - location.reload(); - }; - return; - } - - // Dropdowns aufbauen - const makeOpts = (arr, sel) => - arr.map(m => ``).join(''); - - // Default-Auswahl aus Settings (oder erstes gefundenes) - const commitDefault = qwen.find(m=>m.includes('7b'))||qwen[0]; - const readmeDefault= qwen.find(m=>m.includes('32b'))||qwen[0]; - const currentCommit = await window.settingsAPI.getCommitModel?.() || commitDefault; - const currentReadme= await window.settingsAPI.getReadmeModel?.() || readmeDefault; - - container.innerHTML = ` -
- - -
`; -}); + });