mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-17 06:15:45 +00:00
Don't fail when there are no models downloaded.
This commit is contained in:
@@ -922,37 +922,44 @@ static void DrawContents()
|
||||
break;
|
||||
}
|
||||
|
||||
if( !llmModels.empty() )
|
||||
if( llmstatus == 2 )
|
||||
{
|
||||
ImGui::TextDisabled( "Selected model:" );
|
||||
int sel;
|
||||
for( sel=0; sel<llmModels.size(); sel++ )
|
||||
if( !llmModels.empty() )
|
||||
{
|
||||
if( llmModels[sel].name == s_config.llmModel ) break;
|
||||
}
|
||||
if( sel == llmModels.size() )
|
||||
{
|
||||
sel = 0;
|
||||
s_config.llmModel = llmModels[0].name;
|
||||
SaveConfig();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth( 225 * dpiScale );
|
||||
if( ImGui::BeginCombo( "##llmmodel", llmModels[sel].name.c_str() ) )
|
||||
{
|
||||
for( int i=0; i<llmModels.size(); i++ )
|
||||
ImGui::TextDisabled( "Selected model:" );
|
||||
int sel;
|
||||
for( sel=0; sel<llmModels.size(); sel++ )
|
||||
{
|
||||
bool isSelected = ( i == sel );
|
||||
if( ImGui::Selectable( llmModels[i].name.c_str(), isSelected ) )
|
||||
{
|
||||
s_config.llmModel = llmModels[i].name;
|
||||
SaveConfig();
|
||||
}
|
||||
if( isSelected ) ImGui::SetItemDefaultFocus();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(ctx: %s)", tracy::RealToString( llmModels[i].ctxSize ) );
|
||||
if( llmModels[sel].name == s_config.llmModel ) break;
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
if( sel == llmModels.size() )
|
||||
{
|
||||
sel = 0;
|
||||
s_config.llmModel = llmModels[0].name;
|
||||
SaveConfig();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth( 225 * dpiScale );
|
||||
if( ImGui::BeginCombo( "##llmmodel", llmModels[sel].name.c_str() ) )
|
||||
{
|
||||
for( int i=0; i<llmModels.size(); i++ )
|
||||
{
|
||||
bool isSelected = ( i == sel );
|
||||
if( ImGui::Selectable( llmModels[i].name.c_str(), isSelected ) )
|
||||
{
|
||||
s_config.llmModel = llmModels[i].name;
|
||||
SaveConfig();
|
||||
}
|
||||
if( isSelected ) ImGui::SetItemDefaultFocus();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(ctx: %s)", tracy::RealToString( llmModels[i].ctxSize ) );
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored( ImVec4( 1, 0.5f, 0.5f, 1 ), "No models available! Use ollama to get some." );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user