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

Method handleCopyModelKey

app_model.go:684–703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

682}
683
684func (m *AppModel) handleCopyModelKey() (tea.Model, tea.Cmd) {
685 defer func() {
686 m.refreshList()
687 }()
688 logging.DebugLogger.Println("CopyModel key matched")
689 if item, ok := m.list.SelectedItem().(Model); ok {
690 newName, cancelled := promptForNewName(item.Name)
691 if cancelled {
692 m.message = styles.InfoStyle().Render("Copy cancelled")
693 } else if newName == "" {
694 m.message = styles.ErrorStyle().Render("Error: name can't be empty")
695 } else if newName == item.Name {
696 m.message = styles.ErrorStyle().Render("Error: new name must be different from the original name")
697 } else {
698 copyModel(m, m.client, item.Name, newName)
699 m.message = fmt.Sprintf("Model %s copied to %s", item.Name, newName)
700 }
701 }
702 return m, nil
703}
704
705func (m *AppModel) handlePushModelKey() (tea.Model, tea.Cmd) {
706 logging.DebugLogger.Println("PushModel key matched")

Callers 1

handleKeyMsgMethod · 0.95

Calls 6

refreshListMethod · 0.95
InfoStyleFunction · 0.92
ErrorStyleFunction · 0.92
promptForNewNameFunction · 0.85
copyModelFunction · 0.85
RenderMethod · 0.80

Tested by

no test coverage detected