Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: compare local model params with remote #142

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions app_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ func (m *AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}
}
if m.comparingModelfile {
switch msg.String() {
case "q", "esc":
m.comparingModelfile = false
return m, nil
}
}
switch {
case key.Matches(msg, m.keys.CompareModelfile):
return m.handleCompareModelfile()
}
case pullSuccessMsg:
return m.handlePullSuccessMsg(msg)
case pullErrorMsg:
Expand Down Expand Up @@ -250,6 +261,8 @@ func (m *AppModel) handleKeyMsg(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
return m.handleTopKey()
case key.Matches(msg, m.keys.Help):
return m.handleHelpKey()
case key.Matches(msg, m.keys.CompareModelfile):
return m.handleCompareModelfile()
default:
m.list, cmd = m.list.Update(msg)
return m, cmd
Expand Down Expand Up @@ -730,17 +743,18 @@ func (m *AppModel) View() string {
if m.view == TopView {
return m.topView()
}

if m.confirmDeletion {
return m.confirmDeletionView()
}

if m.inspecting {
return m.inspectModelView(m.inspectedModel)
}
if m.filtering() {
return m.filterView()
}
if m.comparingModelfile {
return m.modelfileDiffView()
}

if m.pulling {
if m.newModelPull && m.pullProgress == 0 {
Expand Down Expand Up @@ -791,7 +805,7 @@ func (m *AppModel) inspectModelView(model Model) string {
}

// Use getModelParams to get the model parameters and add them to the rows
modelParams, err := getModelParams(model.Name, m.client)
modelParams, _, err := getModelParams(model.Name, m.client)
if err != nil {
logging.ErrorLogger.Printf("Error getting model parameters: %v\n", err)
}
Expand All @@ -808,7 +822,7 @@ func (m *AppModel) inspectModelView(model Model) string {

// getModelParams returns a map of model parameters, so we need to iterate over the map and add the parameters to the rows
for key, value := range modelParams {
rows = append(rows, []string{key, strings.Join(value, ", ")})
rows = append(rows, []string{key, value})
}

// Log the rows to ensure they are being populated correctly
Expand Down
Loading
Loading