MCPcopy
hub / github.com/claude-code-best/claude-code / handleSelect

Function handleSelect

src/components/ModelPicker.tsx:195–232  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

193 );
194
195 function handleSelect(value: string): void {
196 logEvent('tengu_model_command_menu_effort', {
197 effort: effort as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
198 });
199 if (!skipSettingsWrite) {
200 // Prior comes from userSettings on disk — NOT merged settings (which
201 // includes project/policy layers that must not leak into the user's
202 // global ~/.claude/settings.json), and NOT AppState.effortValue (which
203 // includes session-ephemeral sources like --effort CLI flag).
204 // See resolvePickerEffortPersistence JSDoc.
205 const effortLevel = resolvePickerEffortPersistence(
206 effort,
207 getDefaultEffortLevelForOption(value),
208 getSettingsForSource('userSettings')?.effortLevel,
209 hasToggledEffort,
210 );
211 const persistable = toPersistableEffort(effortLevel);
212 if (persistable !== undefined) {
213 updateSettingsForSource('userSettings', { effortLevel: persistable });
214 }
215 setAppState(prev => ({ ...prev, effortValue: effortLevel }));
216 }
217
218 const selectedModel = resolveOptionModel(value);
219 const selectedEffort = hasToggledEffort && selectedModel && modelSupportsEffort(selectedModel) ? effort : undefined;
220 if (value === NO_PREFERENCE) {
221 onSelect(null, selectedEffort);
222 return;
223 }
224 // Apply or strip [1m] suffix based on user toggle. marked1MValues is keyed
225 // on the base value (see initializer + handleToggle1M), so look up with the
226 // base form — not `value`, which may carry a `[1m]` suffix from predefined
227 // 1M options and would never match.
228 const baseValue = value.replace(/\[1m\]/i, '');
229 const wants1M = marked1MValues.has(baseValue);
230 const finalValue = wants1M ? `${baseValue}[1m]` : baseValue;
231 onSelect(finalValue, selectedEffort);
232 }
233
234 const content = (
235 <Box flexDirection="column">

Callers

nothing calls this directly

Calls 11

logEventFunction · 0.85
getSettingsForSourceFunction · 0.85
toPersistableEffortFunction · 0.85
updateSettingsForSourceFunction · 0.85
resolveOptionModelFunction · 0.85
modelSupportsEffortFunction · 0.85
setAppStateFunction · 0.50
onSelectFunction · 0.50
hasMethod · 0.45

Tested by

no test coverage detected