MCPcopy
hub / github.com/sammcj/gollama / topView

Method topView

app_model.go:1113–1147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1111}
1112
1113func (m *AppModel) topView() string {
1114 headerStyle := styles.HeaderStyle()
1115
1116 runningModels, err := showRunningModels(m.client)
1117 if err != nil {
1118 return fmt.Sprintf("Error showing running models: %v", err)
1119 }
1120
1121 columns := []table.Column{
1122 {Title: "Name", Width: 40},
1123 {Title: "Size (GB)", Width: 10},
1124 {Title: "VRAM (GB)", Width: 10},
1125 {Title: "Until", Width: 20},
1126 }
1127
1128 t := table.New(
1129 table.WithColumns(columns),
1130 table.WithRows(runningModels),
1131 table.WithFocused(true),
1132 table.WithHeight(len(runningModels)+1),
1133 )
1134
1135 // Set the table styles
1136 s := table.DefaultStyles()
1137 s.Header = s.Header.BorderStyle(lipgloss.NormalBorder()).BorderForeground(styles.GetTheme().GetColour(styles.GetTheme().Colours.HeaderBorder))
1138 s.Selected = styles.SelectedItemStyle()
1139 t.SetStyles(s)
1140
1141 // Render the table view
1142 return lipgloss.JoinVertical(
1143 lipgloss.Left,
1144 headerStyle.Render(fmt.Sprintf("Connected to Ollama at: %s", m.cfg.OllamaAPIURL)),
1145 "\n"+t.View()+"\nPress 'q' or `esc` to return to the main view.",
1146 )
1147}
1148
1149// FullHelp returns keybindings for the expanded help view. It's part of the key.Map interface.
1150func (k KeyMap) FullHelp() [][]key.Binding {

Callers 1

ViewMethod · 0.95

Calls 7

HeaderStyleFunction · 0.92
GetThemeFunction · 0.92
SelectedItemStyleFunction · 0.92
showRunningModelsFunction · 0.85
GetColourMethod · 0.80
RenderMethod · 0.80
ViewMethod · 0.45

Tested by

no test coverage detected