1package splash
2
3import (
4 "fmt"
5 "strings"
6 "time"
7
8 "github.com/charmbracelet/bubbles/v2/key"
9 "github.com/charmbracelet/bubbles/v2/spinner"
10 tea "github.com/charmbracelet/bubbletea/v2"
11 "github.com/charmbracelet/catwalk/pkg/catwalk"
12 "github.com/charmbracelet/crush/internal/config"
13 "github.com/charmbracelet/crush/internal/home"
14 "github.com/charmbracelet/crush/internal/llm/prompt"
15 "github.com/charmbracelet/crush/internal/tui/components/chat"
16 "github.com/charmbracelet/crush/internal/tui/components/core"
17 "github.com/charmbracelet/crush/internal/tui/components/core/layout"
18 "github.com/charmbracelet/crush/internal/tui/components/dialogs/models"
19 "github.com/charmbracelet/crush/internal/tui/components/logo"
20 lspcomponent "github.com/charmbracelet/crush/internal/tui/components/lsp"
21 "github.com/charmbracelet/crush/internal/tui/components/mcp"
22 "github.com/charmbracelet/crush/internal/tui/exp/list"
23 "github.com/charmbracelet/crush/internal/tui/styles"
24 "github.com/charmbracelet/crush/internal/tui/util"
25 "github.com/charmbracelet/crush/internal/version"
26 "github.com/charmbracelet/lipgloss/v2"
27)
28
29type Splash interface {
30 util.Model
31 layout.Sizeable
32 layout.Help
33 Cursor() *tea.Cursor
34 // SetOnboarding controls whether the splash shows model selection UI
35 SetOnboarding(bool)
36 // SetProjectInit controls whether the splash shows project initialization prompt
37 SetProjectInit(bool)
38
39 // Showing API key input
40 IsShowingAPIKey() bool
41
42 // IsAPIKeyValid returns whether the API key is valid
43 IsAPIKeyValid() bool
44}
45
46const (
47 SplashScreenPaddingY = 1 // Padding Y for the splash screen
48
49 LogoGap = 6
50)
51
52// OnboardingCompleteMsg is sent when onboarding is complete
53type (
54 OnboardingCompleteMsg struct{}
55 SubmitAPIKeyMsg struct{}
56)
57
58type splashCmp struct {
59 width, height int
60 keyMap KeyMap
61 logoRendered string
62
63 // State
64 isOnboarding bool
65 needsProjectInit bool
66 needsAPIKey bool
67 selectedNo bool
68
69 listHeight int
70 modelList *models.ModelListComponent
71 apiKeyInput *models.APIKeyInput
72 selectedModel *models.ModelOption
73 isAPIKeyValid bool
74 apiKeyValue string
75}
76
77func New() Splash {
78 keyMap := DefaultKeyMap()
79 listKeyMap := list.DefaultKeyMap()
80 listKeyMap.Down.SetEnabled(false)
81 listKeyMap.Up.SetEnabled(false)
82 listKeyMap.HalfPageDown.SetEnabled(false)
83 listKeyMap.HalfPageUp.SetEnabled(false)
84 listKeyMap.Home.SetEnabled(false)
85 listKeyMap.End.SetEnabled(false)
86 listKeyMap.DownOneItem = keyMap.Next
87 listKeyMap.UpOneItem = keyMap.Previous
88
89 modelList := models.NewModelListComponent(listKeyMap, "Find your fave", false)
90 apiKeyInput := models.NewAPIKeyInput()
91
92 return &splashCmp{
93 width: 0,
94 height: 0,
95 keyMap: keyMap,
96 logoRendered: "",
97 modelList: modelList,
98 apiKeyInput: apiKeyInput,
99 selectedNo: false,
100 }
101}
102
103func (s *splashCmp) SetOnboarding(onboarding bool) {
104 s.isOnboarding = onboarding
105}
106
107func (s *splashCmp) SetProjectInit(needsInit bool) {
108 s.needsProjectInit = needsInit
109}
110
111// GetSize implements SplashPage.
112func (s *splashCmp) GetSize() (int, int) {
113 return s.width, s.height
114}
115
116// Init implements SplashPage.
117func (s *splashCmp) Init() tea.Cmd {
118 return tea.Batch(s.modelList.Init(), s.apiKeyInput.Init())
119}
120
121// SetSize implements SplashPage.
122func (s *splashCmp) SetSize(width int, height int) tea.Cmd {
123 wasSmallScreen := s.isSmallScreen()
124 rerenderLogo := width != s.width
125 s.height = height
126 s.width = width
127 if rerenderLogo || wasSmallScreen != s.isSmallScreen() {
128 s.logoRendered = s.logoBlock()
129 }
130 // remove padding, logo height, gap, title space
131 s.listHeight = s.height - lipgloss.Height(s.logoRendered) - (SplashScreenPaddingY * 2) - s.logoGap() - 2
132 listWidth := min(60, width)
133 s.apiKeyInput.SetWidth(width - 2)
134 return s.modelList.SetSize(listWidth, s.listHeight)
135}
136
137// Update implements SplashPage.
138func (s *splashCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
139 switch msg := msg.(type) {
140 case tea.WindowSizeMsg:
141 return s, s.SetSize(msg.Width, msg.Height)
142 case models.APIKeyStateChangeMsg:
143 u, cmd := s.apiKeyInput.Update(msg)
144 s.apiKeyInput = u.(*models.APIKeyInput)
145 if msg.State == models.APIKeyInputStateVerified {
146 return s, tea.Tick(5*time.Second, func(t time.Time) tea.Msg {
147 return SubmitAPIKeyMsg{}
148 })
149 }
150 return s, cmd
151 case SubmitAPIKeyMsg:
152 if s.isAPIKeyValid {
153 return s, s.saveAPIKeyAndContinue(s.apiKeyValue)
154 }
155 case tea.KeyPressMsg:
156 switch {
157 case key.Matches(msg, s.keyMap.Back):
158 if s.isAPIKeyValid {
159 return s, nil
160 }
161 if s.needsAPIKey {
162 // Go back to model selection
163 s.needsAPIKey = false
164 s.selectedModel = nil
165 s.isAPIKeyValid = false
166 s.apiKeyValue = ""
167 s.apiKeyInput.Reset()
168 return s, nil
169 }
170 case key.Matches(msg, s.keyMap.Select):
171 if s.isAPIKeyValid {
172 return s, s.saveAPIKeyAndContinue(s.apiKeyValue)
173 }
174 if s.isOnboarding && !s.needsAPIKey {
175 selectedItem := s.modelList.SelectedModel()
176 if selectedItem == nil {
177 return s, nil
178 }
179 if s.isProviderConfigured(string(selectedItem.Provider.ID)) {
180 cmd := s.setPreferredModel(*selectedItem)
181 s.isOnboarding = false
182 return s, tea.Batch(cmd, util.CmdHandler(OnboardingCompleteMsg{}))
183 } else {
184 // Provider not configured, show API key input
185 s.needsAPIKey = true
186 s.selectedModel = selectedItem
187 s.apiKeyInput.SetProviderName(selectedItem.Provider.Name)
188 return s, nil
189 }
190 } else if s.needsAPIKey {
191 // Handle API key submission
192 s.apiKeyValue = strings.TrimSpace(s.apiKeyInput.Value())
193 if s.apiKeyValue == "" {
194 return s, nil
195 }
196
197 provider, err := s.getProvider(s.selectedModel.Provider.ID)
198 if err != nil || provider == nil {
199 return s, util.ReportError(fmt.Errorf("provider %s not found", s.selectedModel.Provider.ID))
200 }
201 providerConfig := config.ProviderConfig{
202 ID: string(s.selectedModel.Provider.ID),
203 Name: s.selectedModel.Provider.Name,
204 APIKey: s.apiKeyValue,
205 Type: provider.Type,
206 BaseURL: provider.APIEndpoint,
207 }
208 return s, tea.Sequence(
209 util.CmdHandler(models.APIKeyStateChangeMsg{
210 State: models.APIKeyInputStateVerifying,
211 }),
212 func() tea.Msg {
213 start := time.Now()
214 err := providerConfig.TestConnection(config.Get().Resolver())
215 // intentionally wait for at least 750ms to make sure the user sees the spinner
216 elapsed := time.Since(start)
217 if elapsed < 750*time.Millisecond {
218 time.Sleep(750*time.Millisecond - elapsed)
219 }
220 if err == nil {
221 s.isAPIKeyValid = true
222 return models.APIKeyStateChangeMsg{
223 State: models.APIKeyInputStateVerified,
224 }
225 }
226 return models.APIKeyStateChangeMsg{
227 State: models.APIKeyInputStateError,
228 }
229 },
230 )
231 } else if s.needsProjectInit {
232 return s, s.initializeProject()
233 }
234 case key.Matches(msg, s.keyMap.Tab, s.keyMap.LeftRight):
235 if s.needsAPIKey {
236 u, cmd := s.apiKeyInput.Update(msg)
237 s.apiKeyInput = u.(*models.APIKeyInput)
238 return s, cmd
239 }
240 if s.needsProjectInit {
241 s.selectedNo = !s.selectedNo
242 return s, nil
243 }
244 case key.Matches(msg, s.keyMap.Yes):
245 if s.needsAPIKey {
246 u, cmd := s.apiKeyInput.Update(msg)
247 s.apiKeyInput = u.(*models.APIKeyInput)
248 return s, cmd
249 }
250 if s.isOnboarding {
251 u, cmd := s.modelList.Update(msg)
252 s.modelList = u
253 return s, cmd
254 }
255 if s.needsProjectInit {
256 return s, s.initializeProject()
257 }
258 case key.Matches(msg, s.keyMap.No):
259 if s.needsAPIKey {
260 u, cmd := s.apiKeyInput.Update(msg)
261 s.apiKeyInput = u.(*models.APIKeyInput)
262 return s, cmd
263 }
264 if s.isOnboarding {
265 u, cmd := s.modelList.Update(msg)
266 s.modelList = u
267 return s, cmd
268 }
269 if s.needsProjectInit {
270 s.selectedNo = true
271 return s, s.initializeProject()
272 }
273 default:
274 if s.needsAPIKey {
275 u, cmd := s.apiKeyInput.Update(msg)
276 s.apiKeyInput = u.(*models.APIKeyInput)
277 return s, cmd
278 } else if s.isOnboarding {
279 u, cmd := s.modelList.Update(msg)
280 s.modelList = u
281 return s, cmd
282 }
283 }
284 case tea.PasteMsg:
285 if s.needsAPIKey {
286 u, cmd := s.apiKeyInput.Update(msg)
287 s.apiKeyInput = u.(*models.APIKeyInput)
288 return s, cmd
289 } else if s.isOnboarding {
290 var cmd tea.Cmd
291 s.modelList, cmd = s.modelList.Update(msg)
292 return s, cmd
293 }
294 case spinner.TickMsg:
295 u, cmd := s.apiKeyInput.Update(msg)
296 s.apiKeyInput = u.(*models.APIKeyInput)
297 return s, cmd
298 }
299 return s, nil
300}
301
302func (s *splashCmp) saveAPIKeyAndContinue(apiKey string) tea.Cmd {
303 if s.selectedModel == nil {
304 return nil
305 }
306
307 cfg := config.Get()
308 err := cfg.SetProviderAPIKey(string(s.selectedModel.Provider.ID), apiKey)
309 if err != nil {
310 return util.ReportError(fmt.Errorf("failed to save API key: %w", err))
311 }
312
313 // Reset API key state and continue with model selection
314 s.needsAPIKey = false
315 cmd := s.setPreferredModel(*s.selectedModel)
316 s.isOnboarding = false
317 s.selectedModel = nil
318 s.isAPIKeyValid = false
319
320 return tea.Batch(cmd, util.CmdHandler(OnboardingCompleteMsg{}))
321}
322
323func (s *splashCmp) initializeProject() tea.Cmd {
324 s.needsProjectInit = false
325
326 if err := config.MarkProjectInitialized(); err != nil {
327 return util.ReportError(err)
328 }
329 var cmds []tea.Cmd
330
331 cmds = append(cmds, util.CmdHandler(OnboardingCompleteMsg{}))
332 if !s.selectedNo {
333 cmds = append(cmds,
334 util.CmdHandler(chat.SessionClearedMsg{}),
335 util.CmdHandler(chat.SendMsg{
336 Text: prompt.Initialize(),
337 }),
338 )
339 }
340 return tea.Sequence(cmds...)
341}
342
343func (s *splashCmp) setPreferredModel(selectedItem models.ModelOption) tea.Cmd {
344 cfg := config.Get()
345 model := cfg.GetModel(string(selectedItem.Provider.ID), selectedItem.Model.ID)
346 if model == nil {
347 return util.ReportError(fmt.Errorf("model %s not found for provider %s", selectedItem.Model.ID, selectedItem.Provider.ID))
348 }
349
350 selectedModel := config.SelectedModel{
351 Model: selectedItem.Model.ID,
352 Provider: string(selectedItem.Provider.ID),
353 ReasoningEffort: model.DefaultReasoningEffort,
354 MaxTokens: model.DefaultMaxTokens,
355 }
356
357 err := cfg.UpdatePreferredModel(config.SelectedModelTypeLarge, selectedModel)
358 if err != nil {
359 return util.ReportError(err)
360 }
361
362 // Now lets automatically setup the small model
363 knownProvider, err := s.getProvider(selectedItem.Provider.ID)
364 if err != nil {
365 return util.ReportError(err)
366 }
367 if knownProvider == nil {
368 // for local provider we just use the same model
369 err = cfg.UpdatePreferredModel(config.SelectedModelTypeSmall, selectedModel)
370 if err != nil {
371 return util.ReportError(err)
372 }
373 } else {
374 smallModel := knownProvider.DefaultSmallModelID
375 model := cfg.GetModel(string(selectedItem.Provider.ID), smallModel)
376 // should never happen
377 if model == nil {
378 err = cfg.UpdatePreferredModel(config.SelectedModelTypeSmall, selectedModel)
379 if err != nil {
380 return util.ReportError(err)
381 }
382 return nil
383 }
384 smallSelectedModel := config.SelectedModel{
385 Model: smallModel,
386 Provider: string(selectedItem.Provider.ID),
387 ReasoningEffort: model.DefaultReasoningEffort,
388 MaxTokens: model.DefaultMaxTokens,
389 }
390 err = cfg.UpdatePreferredModel(config.SelectedModelTypeSmall, smallSelectedModel)
391 if err != nil {
392 return util.ReportError(err)
393 }
394 }
395 cfg.SetupAgents()
396 return nil
397}
398
399func (s *splashCmp) getProvider(providerID catwalk.InferenceProvider) (*catwalk.Provider, error) {
400 cfg := config.Get()
401 providers, err := config.Providers(cfg)
402 if err != nil {
403 return nil, err
404 }
405 for _, p := range providers {
406 if p.ID == providerID {
407 return &p, nil
408 }
409 }
410 return nil, nil
411}
412
413func (s *splashCmp) isProviderConfigured(providerID string) bool {
414 cfg := config.Get()
415 if _, ok := cfg.Providers.Get(providerID); ok {
416 return true
417 }
418 return false
419}
420
421func (s *splashCmp) View() string {
422 t := styles.CurrentTheme()
423 var content string
424 if s.needsAPIKey {
425 remainingHeight := s.height - lipgloss.Height(s.logoRendered) - (SplashScreenPaddingY * 2)
426 apiKeyView := t.S().Base.PaddingLeft(1).Render(s.apiKeyInput.View())
427 apiKeySelector := t.S().Base.AlignVertical(lipgloss.Bottom).Height(remainingHeight).Render(
428 lipgloss.JoinVertical(
429 lipgloss.Left,
430 apiKeyView,
431 ),
432 )
433 content = lipgloss.JoinVertical(
434 lipgloss.Left,
435 s.logoRendered,
436 apiKeySelector,
437 )
438 } else if s.isOnboarding {
439 modelListView := s.modelList.View()
440 remainingHeight := s.height - lipgloss.Height(s.logoRendered) - (SplashScreenPaddingY * 2)
441 modelSelector := t.S().Base.AlignVertical(lipgloss.Bottom).Height(remainingHeight).Render(
442 lipgloss.JoinVertical(
443 lipgloss.Left,
444 t.S().Base.PaddingLeft(1).Foreground(t.Primary).Render("Choose a Model"),
445 "",
446 modelListView,
447 ),
448 )
449 content = lipgloss.JoinVertical(
450 lipgloss.Left,
451 s.logoRendered,
452 modelSelector,
453 )
454 } else if s.needsProjectInit {
455 titleStyle := t.S().Base.Foreground(t.FgBase)
456 pathStyle := t.S().Base.Foreground(t.Success).PaddingLeft(2)
457 bodyStyle := t.S().Base.Foreground(t.FgMuted)
458 shortcutStyle := t.S().Base.Foreground(t.Success)
459
460 initText := lipgloss.JoinVertical(
461 lipgloss.Left,
462 titleStyle.Render("Would you like to initialize this project?"),
463 "",
464 pathStyle.Render(s.cwd()),
465 "",
466 bodyStyle.Render("When I initialize your codebase I examine the project and put the"),
467 bodyStyle.Render("result into a CRUSH.md file which serves as general context."),
468 "",
469 bodyStyle.Render("You can also initialize anytime via ")+shortcutStyle.Render("ctrl+p")+bodyStyle.Render("."),
470 "",
471 bodyStyle.Render("Would you like to initialize now?"),
472 )
473
474 yesButton := core.SelectableButton(core.ButtonOpts{
475 Text: "Yep!",
476 UnderlineIndex: 0,
477 Selected: !s.selectedNo,
478 })
479
480 noButton := core.SelectableButton(core.ButtonOpts{
481 Text: "Nope",
482 UnderlineIndex: 0,
483 Selected: s.selectedNo,
484 })
485
486 buttons := lipgloss.JoinHorizontal(lipgloss.Left, yesButton, " ", noButton)
487 remainingHeight := s.height - lipgloss.Height(s.logoRendered) - (SplashScreenPaddingY * 2)
488
489 initContent := t.S().Base.AlignVertical(lipgloss.Bottom).PaddingLeft(1).Height(remainingHeight).Render(
490 lipgloss.JoinVertical(
491 lipgloss.Left,
492 initText,
493 "",
494 buttons,
495 ),
496 )
497
498 content = lipgloss.JoinVertical(
499 lipgloss.Left,
500 s.logoRendered,
501 "",
502 initContent,
503 )
504 } else {
505 parts := []string{
506 s.logoRendered,
507 s.infoSection(),
508 }
509 content = lipgloss.JoinVertical(lipgloss.Left, parts...)
510 }
511
512 return t.S().Base.
513 Width(s.width).
514 Height(s.height).
515 PaddingTop(SplashScreenPaddingY).
516 PaddingBottom(SplashScreenPaddingY).
517 Render(content)
518}
519
520func (s *splashCmp) Cursor() *tea.Cursor {
521 if s.needsAPIKey {
522 cursor := s.apiKeyInput.Cursor()
523 if cursor != nil {
524 return s.moveCursor(cursor)
525 }
526 } else if s.isOnboarding {
527 cursor := s.modelList.Cursor()
528 if cursor != nil {
529 return s.moveCursor(cursor)
530 }
531 } else {
532 return nil
533 }
534 return nil
535}
536
537func (s *splashCmp) isSmallScreen() bool {
538 // Consider a screen small if either the width is less than 40 or if the
539 // height is less than 20
540 return s.width < 55 || s.height < 20
541}
542
543func (s *splashCmp) infoSection() string {
544 t := styles.CurrentTheme()
545 infoStyle := t.S().Base.PaddingLeft(2)
546 if s.isSmallScreen() {
547 infoStyle = infoStyle.MarginTop(1)
548 }
549 return infoStyle.Render(
550 lipgloss.JoinVertical(
551 lipgloss.Left,
552 s.cwdPart(),
553 "",
554 s.currentModelBlock(),
555 "",
556 lipgloss.JoinHorizontal(lipgloss.Left, s.lspBlock(), s.mcpBlock()),
557 "",
558 ),
559 )
560}
561
562func (s *splashCmp) logoBlock() string {
563 t := styles.CurrentTheme()
564 logoStyle := t.S().Base.Padding(0, 2).Width(s.width)
565 if s.isSmallScreen() {
566 // If the width is too small, render a smaller version of the logo
567 // NOTE: 20 is not correct because [splashCmp.height] is not the
568 // *actual* window height, instead, it is the height of the splash
569 // component and that depends on other variables like compact mode and
570 // the height of the editor.
571 return logoStyle.Render(
572 logo.SmallRender(s.width - logoStyle.GetHorizontalFrameSize()),
573 )
574 }
575 return logoStyle.Render(
576 logo.Render(version.Version, false, logo.Opts{
577 FieldColor: t.Primary,
578 TitleColorA: t.Secondary,
579 TitleColorB: t.Primary,
580 CharmColor: t.Secondary,
581 VersionColor: t.Primary,
582 Width: s.width - logoStyle.GetHorizontalFrameSize(),
583 }),
584 )
585}
586
587func (s *splashCmp) moveCursor(cursor *tea.Cursor) *tea.Cursor {
588 if cursor == nil {
589 return nil
590 }
591 // Calculate the correct Y offset based on current state
592 logoHeight := lipgloss.Height(s.logoRendered)
593 if s.needsAPIKey {
594 infoSectionHeight := lipgloss.Height(s.infoSection())
595 baseOffset := logoHeight + SplashScreenPaddingY + infoSectionHeight
596 remainingHeight := s.height - baseOffset - lipgloss.Height(s.apiKeyInput.View()) - SplashScreenPaddingY
597 offset := baseOffset + remainingHeight
598 cursor.Y += offset
599 cursor.X = cursor.X + 1
600 } else if s.isOnboarding {
601 offset := logoHeight + SplashScreenPaddingY + s.logoGap() + 2
602 cursor.Y += offset
603 cursor.X = cursor.X + 1
604 }
605
606 return cursor
607}
608
609func (s *splashCmp) logoGap() int {
610 if s.height > 35 {
611 return LogoGap
612 }
613 return 0
614}
615
616// Bindings implements SplashPage.
617func (s *splashCmp) Bindings() []key.Binding {
618 if s.needsAPIKey {
619 return []key.Binding{
620 s.keyMap.Select,
621 s.keyMap.Back,
622 }
623 } else if s.isOnboarding {
624 return []key.Binding{
625 s.keyMap.Select,
626 s.keyMap.Next,
627 s.keyMap.Previous,
628 }
629 } else if s.needsProjectInit {
630 return []key.Binding{
631 s.keyMap.Select,
632 s.keyMap.Yes,
633 s.keyMap.No,
634 s.keyMap.Tab,
635 s.keyMap.LeftRight,
636 }
637 }
638 return []key.Binding{}
639}
640
641func (s *splashCmp) getMaxInfoWidth() int {
642 return min(s.width-2, 90) // 2 for left padding
643}
644
645func (s *splashCmp) cwdPart() string {
646 t := styles.CurrentTheme()
647 maxWidth := s.getMaxInfoWidth()
648 return t.S().Muted.Width(maxWidth).Render(s.cwd())
649}
650
651func (s *splashCmp) cwd() string {
652 return home.Short(config.Get().WorkingDir())
653}
654
655func LSPList(maxWidth int) []string {
656 return lspcomponent.RenderLSPList(nil, lspcomponent.RenderOptions{
657 MaxWidth: maxWidth,
658 ShowSection: false,
659 })
660}
661
662func (s *splashCmp) lspBlock() string {
663 t := styles.CurrentTheme()
664 maxWidth := s.getMaxInfoWidth() / 2
665 section := t.S().Subtle.Render("LSPs")
666 lspList := append([]string{section, ""}, LSPList(maxWidth-1)...)
667 return t.S().Base.Width(maxWidth).PaddingRight(1).Render(
668 lipgloss.JoinVertical(
669 lipgloss.Left,
670 lspList...,
671 ),
672 )
673}
674
675func MCPList(maxWidth int) []string {
676 return mcp.RenderMCPList(mcp.RenderOptions{
677 MaxWidth: maxWidth,
678 ShowSection: false,
679 })
680}
681
682func (s *splashCmp) mcpBlock() string {
683 t := styles.CurrentTheme()
684 maxWidth := s.getMaxInfoWidth() / 2
685 section := t.S().Subtle.Render("MCPs")
686 mcpList := append([]string{section, ""}, MCPList(maxWidth-1)...)
687 return t.S().Base.Width(maxWidth).PaddingRight(1).Render(
688 lipgloss.JoinVertical(
689 lipgloss.Left,
690 mcpList...,
691 ),
692 )
693}
694
695func (s *splashCmp) currentModelBlock() string {
696 cfg := config.Get()
697 agentCfg := cfg.Agents["coder"]
698 model := config.Get().GetModelByType(agentCfg.Model)
699 if model == nil {
700 return ""
701 }
702 t := styles.CurrentTheme()
703 modelIcon := t.S().Base.Foreground(t.FgSubtle).Render(styles.ModelIcon)
704 modelName := t.S().Text.Render(model.Name)
705 modelInfo := fmt.Sprintf("%s %s", modelIcon, modelName)
706 parts := []string{
707 modelInfo,
708 }
709
710 return lipgloss.JoinVertical(
711 lipgloss.Left,
712 parts...,
713 )
714}
715
716func (s *splashCmp) IsShowingAPIKey() bool {
717 return s.needsAPIKey
718}
719
720func (s *splashCmp) IsAPIKeyValid() bool {
721 return s.isAPIKeyValid
722}