| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package model
- import (
- "charm.land/lipgloss/v2"
- "github.com/charmbracelet/crush/internal/agent"
- "github.com/charmbracelet/crush/internal/ui/common"
- "github.com/charmbracelet/ultraviolet/layout"
- )
- // selectedLargeModel returns the currently selected large language model from
- // the agent coordinator, if one exists.
- func (m *UI) selectedLargeModel() *agent.Model {
- if m.com.App.AgentCoordinator != nil {
- model := m.com.App.AgentCoordinator.Model()
- return &model
- }
- return nil
- }
- // landingView renders the landing page view showing the current working
- // directory, model information, and LSP/MCP status in a two-column layout.
- func (m *UI) landingView() string {
- t := m.com.Styles
- width := m.layout.main.Dx()
- cwd := common.PrettyPath(t, m.com.Config().WorkingDir(), width)
- parts := []string{
- cwd,
- }
- parts = append(parts, "", m.modelInfo(width))
- infoSection := lipgloss.JoinVertical(lipgloss.Left, parts...)
- _, remainingHeightArea := layout.SplitVertical(m.layout.main, layout.Fixed(lipgloss.Height(infoSection)+1))
- mcpLspSectionWidth := min(30, (width-1)/2)
- lspSection := m.lspInfo(mcpLspSectionWidth, max(1, remainingHeightArea.Dy()), false)
- mcpSection := m.mcpInfo(mcpLspSectionWidth, max(1, remainingHeightArea.Dy()), false)
- content := lipgloss.JoinHorizontal(lipgloss.Left, lspSection, " ", mcpSection)
- return lipgloss.NewStyle().
- Width(width).
- Height(m.layout.main.Dy() - 1).
- PaddingTop(1).
- Render(
- lipgloss.JoinVertical(lipgloss.Left, infoSection, "", content),
- )
- }
|