()
| 1111 | } |
| 1112 | |
| 1113 | func (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. |
| 1150 | func (k KeyMap) FullHelp() [][]key.Binding { |
no test coverage detected