@@ -723,11 +723,31 @@ <h2>Configure Ollama</h2>
723723 <input type="text" id="ollama-url" placeholder="http://ollama.dappnode:11434" value="${ ollamaUrl } ">
724724 </div>
725725 <div class="field">
726- <label>Model Name</label>
727- <div class="hint">Enter the model to use. Popular choices: llama3, mistral, codellama, qwen3-coder-next:q8_0</div>
728- <input type="text" id="ollama-model" placeholder="llama3" value="${ ollamaModel } ">
726+ <label>Model</label>
727+ <div class="hint">Select a model from your Ollama instance, or choose "Custom" to enter a model name manually.</div>
728+ <select id="ollama-model-select">
729+ <option value="" disabled selected>Run auto-detect first or choose Custom</option>
730+ <option value="__custom">Custom model...</option>
731+ </select>
732+ </div>
733+ <div class="field" id="ollama-custom-model-field" style="display:none">
734+ <label>Custom Model Name</label>
735+ <div class="hint">Enter the model name (e.g. llama3, mistral). If the model is not already downloaded, Ollama will pull it automatically on first use.</div>
736+ <input type="text" id="ollama-custom-model" placeholder="llama3" value="">
729737 </div>
730738 ` ;
739+ // Setup ollama model dropdown logic
740+ const ollamaSelect = document . getElementById ( "ollama-model-select" ) ;
741+ const ollamaCustomField = document . getElementById ( "ollama-custom-model-field" ) ;
742+ ollamaSelect . addEventListener ( "change" , ( ) => {
743+ ollamaCustomField . style . display = ollamaSelect . value === "__custom" ? "block" : "none" ;
744+ } ) ;
745+ // Pre-fill from existing config
746+ if ( ollamaModel ) {
747+ ollamaSelect . value = "__custom" ;
748+ ollamaCustomField . style . display = "block" ;
749+ document . getElementById ( "ollama-custom-model" ) . value = ollamaModel ;
750+ }
731751 } else if ( p . id === "azure" ) {
732752 let azureEndpoint = "" ;
733753 let azureKey = "" ;
@@ -872,8 +892,16 @@ <h2>Configure ${p.name}</h2>
872892 ${ data . models . length > 0 ? "Available models: " + data . models . join ( ", " ) : "No models pulled yet. Pull a model from the terminal." }
873893 </div>` ;
874894 document . getElementById ( "ollama-url" ) . value = data . url ;
875- if ( data . models . length > 0 ) {
876- document . getElementById ( "ollama-model" ) . value = data . models [ 0 ] ;
895+ // Populate model dropdown with detected models
896+ const ollamaSelect = document . getElementById ( "ollama-model-select" ) ;
897+ const ollamaCustomField = document . getElementById ( "ollama-custom-model-field" ) ;
898+ if ( ollamaSelect && data . models . length > 0 ) {
899+ // Remove the placeholder option, keep custom option
900+ ollamaSelect . innerHTML = data . models . map ( m =>
901+ `<option value="${ m } ">${ m } </option>`
902+ ) . join ( "" ) + `<option value="__custom">Custom model...</option>` ;
903+ ollamaSelect . value = data . models [ 0 ] ;
904+ ollamaCustomField . style . display = "none" ;
877905 }
878906 } else {
879907 resultEl . innerHTML = `<div class="probe-result fail">
@@ -926,7 +954,10 @@ <h2>Configure ${p.name}</h2>
926954 // Provider config
927955 if ( p . id === "ollama" ) {
928956 const url = document . getElementById ( "ollama-url" ) . value . trim ( ) || "http://localhost:11434" ;
929- const model = document . getElementById ( "ollama-model" ) . value . trim ( ) || "llama3" ;
957+ const ollamaSelect = document . getElementById ( "ollama-model-select" ) ;
958+ const model = ollamaSelect . value === "__custom"
959+ ? ( document . getElementById ( "ollama-custom-model" ) . value . trim ( ) || "llama3" )
960+ : ( ollamaSelect . value || "llama3" ) ;
930961 config . models . providers . ollama = {
931962 baseUrl : url + "/v1" ,
932963 apiKey : "ollama-local" ,
0 commit comments