38 lines
		
	
	
		
			675 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			675 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package main
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"fmt"
							 | 
						||
| 
								 | 
							
									"lazykimi/internal/ui/app"
							 | 
						||
| 
								 | 
							
									"os"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									tea "github.com/charmbracelet/bubbletea/v2"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func main() {
							 | 
						||
| 
								 | 
							
									// Get API key from environment
							 | 
						||
| 
								 | 
							
									apiKey := os.Getenv("OPENAI_API_KEY")
							 | 
						||
| 
								 | 
							
									if apiKey == "" {
							 | 
						||
| 
								 | 
							
										fmt.Println("Error: Please set the OPENAI_API_KEY environment variable")
							 | 
						||
| 
								 | 
							
										os.Exit(1)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// Initialize application
							 | 
						||
| 
								 | 
							
									app, err := app.NewApp(apiKey)
							 | 
						||
| 
								 | 
							
									if err != nil {
							 | 
						||
| 
								 | 
							
										fmt.Println("Error initializing: " + err.Error())
							 | 
						||
| 
								 | 
							
										os.Exit(1)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// Create and run program
							 | 
						||
| 
								 | 
							
									p := tea.NewProgram(
							 | 
						||
| 
								 | 
							
										app,
							 | 
						||
| 
								 | 
							
										tea.WithAltScreen(),
							 | 
						||
| 
								 | 
							
										tea.WithMouseAllMotion(),
							 | 
						||
| 
								 | 
							
									)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									if _, err := p.Run(); err != nil {
							 | 
						||
| 
								 | 
							
										fmt.Println("Error running program: " + err.Error())
							 | 
						||
| 
								 | 
							
										os.Exit(1)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |