MCPcopy Index your code
hub / github.com/codeaashu/claude-code / setModel

Function setModel

src/commands/model/model.tsx:198–228  ·  view source on GitHub ↗
(modelValue: string | null)

Source from the content-addressed store, hash-verified

196 }
197 }
198 function setModel(modelValue: string | null): void {
199 setAppState(prev => ({
200 ...prev,
201 mainLoopModel: modelValue,
202 mainLoopModelForSession: null
203 }));
204 let message = `Set model to ${chalk.bold(renderModelLabel(modelValue))}`;
205 let wasFastModeToggledOn = undefined;
206 if (isFastModeEnabled()) {
207 clearFastModeCooldown();
208 if (!isFastModeSupportedByModel(modelValue) && isFastMode) {
209 setAppState(prev_0 => ({
210 ...prev_0,
211 fastMode: false
212 }));
213 wasFastModeToggledOn = false;
214 // Do not update fast mode in settings since this is an automatic downgrade
215 } else if (isFastModeSupportedByModel(modelValue) && isFastMode) {
216 message += ` · Fast mode ON`;
217 wasFastModeToggledOn = true;
218 }
219 }
220 if (isBilledAsExtraUsage(modelValue, wasFastModeToggledOn === true, isOpus1mMergeEnabled())) {
221 message += ` · Billed as extra usage`;
222 }
223 if (wasFastModeToggledOn === false) {
224 // Fast mode was toggled off, show suffix after extra usage billing
225 message += ` · Fast mode OFF`;
226 }
227 onDone(message);
228 }
229 void handleModelChange();
230 }, [model, onDone, setAppState]);
231 return null;

Callers 1

handleModelChangeFunction · 0.85

Calls 7

renderModelLabelFunction · 0.85
isFastModeEnabledFunction · 0.85
clearFastModeCooldownFunction · 0.85
isBilledAsExtraUsageFunction · 0.85
isOpus1mMergeEnabledFunction · 0.85
onDoneFunction · 0.50

Tested by

no test coverage detected