From 0f31d6ac1ab6181926ecb7ba9ca46e4be2b3454e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 11 May 2025 17:24:40 +0200 Subject: [PATCH] List LLM models in global settings. --- profiler/src/main.cpp | 59 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 63ba571e..0666d4be 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -864,6 +864,7 @@ static void DrawContents() { static int llmstatus = 0; static std::string llmVersion; + static std::vector llmModels; ImGui::Indent(); ImGui::TextUnformatted( "Ollama URL" ); @@ -876,10 +877,28 @@ static void DrawContents() if( ImGui::InputText( "##ollamaurl", llmAddress, sizeof( llmAddress ) ) ) { llmstatus = 0; + llmModels.clear(); s_config.llmAddress = llmAddress; SaveConfig(); } + if( llmstatus == 1 ) ImGui::BeginDisabled(); + const bool doCheck = ImGui::Button( ICON_FA_PLUG " Check connection" ); + if( llmstatus == 1 ) ImGui::EndDisabled(); + if( doCheck ) + { + llmstatus = 1; + // TODO put into a thread? + tracy::TracyLlm llm; + const bool valid = llm.IsValid(); + llmstatus = valid ? 2 : 3; + if( valid ) + { + llmVersion = llm.GetVersion(); + llmModels = llm.GetModels(); + } + } + ImGui::TextDisabled( "Connection status:" ); ImGui::SameLine(); switch( llmstatus ) @@ -902,17 +921,37 @@ static void DrawContents() assert( false ); break; } - if( llmstatus == 1 ) ImGui::BeginDisabled(); - const bool doCheck = ImGui::Button( ICON_FA_PLUG " Check connection" ); - if( llmstatus == 1 ) ImGui::EndDisabled(); - if( doCheck ) + + if( !llmModels.empty() ) { - llmstatus = 1; - // TODO put into a thread? - tracy::TracyLlm llm; - const bool valid = llm.IsValid(); - llmstatus = valid ? 2 : 3; - if( valid ) llmVersion = llm.GetVersion(); + ImGui::TextDisabled( "Selected model:" ); + int sel; + for( sel=0; sel