-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (36 loc) · 1.17 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"os"
"github.com/cloudraftio/kubectl-olly/olly"
"github.com/cloudraftio/kubectl-olly/ui"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
if olly.GetAPIKey() == "" {
fmt.Println("Error: OLLY_API_KEY not set. Please set it in your environment or in $HOME/.olly file.")
// os.Exit(1)
}
myLLM := &olly.MyLLM{}
keyMapConfig := ui.KeyMapConfig{
SwitchMultiline: []string{"ctrl+m"},
Submit: []string{"enter"},
Help: []string{"ctrl+h"},
Quit: []string{"ctrl+c", "esc"},
CopyLastAnswer: []string{"ctrl+y"},
PreviousQuestion: []string{"up"},
NextQuestion: []string{"down"},
NewConversation: []string{"ctrl+n"},
ForgetContext: []string{"ctrl+f"},
RemoveConversation: []string{"ctrl+d"},
PreviousConversation: []string{"ctrl+p"},
NextConversation: []string{"ctrl+x"},
ScrollUp: []string{"up"},
ScrollDown: []string{"down"},
}
p := tea.NewProgram(ui.InitialModel(myLLM, keyMapConfig), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Printf("Alas, there's been an error: %v", err)
os.Exit(1)
}
}