MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / ProviderPicker

Function ProviderPicker

src/components/ProviderPicker.tsx:79–152  ·  view source on GitHub ↗
({
  initial,
  onSelect,
  onCancel,
  isStandaloneCommand,
  headerText,
}: ProviderPickerProps)

Source from the content-addressed store, hash-verified

77}
78
79export function ProviderPicker({
80 initial,
81 onSelect,
82 onCancel,
83 isStandaloneCommand,
84 headerText,
85}: ProviderPickerProps) {
86 const exitState = useExitOnCtrlCDWithKeybindings()
87 const providerOptions = getAllProviderConfigs().map(provider => ({
88 label: provider.name,
89 value: provider.id,
90 description: getProviderDescription(provider),
91 }))
92 const envOverrideId = getEnvironmentProviderOverrideId()
93 const envOverrideName = envOverrideId
94 ? getProviderConfigById(envOverrideId).name
95 : undefined
96 const initialValue =
97 initial && providerOptions.some(option => option.value === initial)
98 ? initial
99 : getActiveProviderConfig().id
100 const visibleCount = Math.min(8, providerOptions.length)
101
102 return (
103 <Box flexDirection="column">
104 <Box marginBottom={1} flexDirection="column">
105 <Text color="remember" bold>
106 Select provider
107 </Text>
108 <Text dimColor>
109 {headerText ??
110 'Choose the model provider for Claude Code. When the change can take effect immediately, model selection opens next.'}
111 </Text>
112 {envOverrideName ? (
113 <Text dimColor>
114 Current session is forced to {envOverrideName} by environment
115 variables. Picking another provider saves a preference for future
116 sessions.
117 </Text>
118 ) : null}
119 </Box>
120
121 <Box flexDirection="column" marginBottom={1}>
122 <Select
123 options={providerOptions}
124 onChange={onSelect}
125 onCancel={onCancel}
126 defaultValue={initialValue}
127 defaultFocusValue={initialValue}
128 visibleOptionCount={visibleCount}
129 layout="compact-vertical"
130 />
131 </Box>
132
133 {isStandaloneCommand ? (
134 <Text dimColor italic>
135 {exitState.pending ? (
136 <>Press {exitState.keyName} again to exit</>

Callers

nothing calls this directly

Calls 6

getAllProviderConfigsFunction · 0.85
getProviderDescriptionFunction · 0.85
getProviderConfigByIdFunction · 0.85
getActiveProviderConfigFunction · 0.85

Tested by

no test coverage detected