(t0)
| 16 | import { isModelAllowed } from '../../utils/model/modelAllowlist.js'; |
| 17 | import { validateModel } from '../../utils/model/validateModel.js'; |
| 18 | function ModelPickerWrapper(t0) { |
| 19 | const $ = _c(17); |
| 20 | const { |
| 21 | onDone |
| 22 | } = t0; |
| 23 | const mainLoopModel = useAppState(_temp); |
| 24 | const mainLoopModelForSession = useAppState(_temp2); |
| 25 | const isFastMode = useAppState(_temp3); |
| 26 | const setAppState = useSetAppState(); |
| 27 | let t1; |
| 28 | if ($[0] !== mainLoopModel || $[1] !== onDone) { |
| 29 | t1 = function handleCancel() { |
| 30 | logEvent("tengu_model_command_menu", { |
| 31 | action: "cancel" as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 32 | }); |
| 33 | const displayModel = renderModelLabel(mainLoopModel); |
| 34 | onDone(`Kept model as ${chalk.bold(displayModel)}`, { |
| 35 | display: "system" |
| 36 | }); |
| 37 | }; |
| 38 | $[0] = mainLoopModel; |
| 39 | $[1] = onDone; |
| 40 | $[2] = t1; |
| 41 | } else { |
| 42 | t1 = $[2]; |
| 43 | } |
| 44 | const handleCancel = t1; |
| 45 | let t2; |
| 46 | if ($[3] !== isFastMode || $[4] !== mainLoopModel || $[5] !== onDone || $[6] !== setAppState) { |
| 47 | t2 = function handleSelect(model, effort) { |
| 48 | logEvent("tengu_model_command_menu", { |
| 49 | action: model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 50 | from_model: mainLoopModel as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 51 | to_model: model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 52 | }); |
| 53 | setAppState(prev => ({ |
| 54 | ...prev, |
| 55 | mainLoopModel: model, |
| 56 | mainLoopModelForSession: null |
| 57 | })); |
| 58 | let message = `Set model to ${chalk.bold(renderModelLabel(model))}`; |
| 59 | if (effort !== undefined) { |
| 60 | message = message + ` with ${chalk.bold(effort)} effort`; |
| 61 | } |
| 62 | let wasFastModeToggledOn = undefined; |
| 63 | if (isFastModeEnabled()) { |
| 64 | clearFastModeCooldown(); |
| 65 | if (!isFastModeSupportedByModel(model) && isFastMode) { |
| 66 | setAppState(_temp4); |
| 67 | wasFastModeToggledOn = false; |
| 68 | } else { |
| 69 | if (isFastModeSupportedByModel(model) && isFastModeAvailable() && isFastMode) { |
| 70 | message = message + " \xB7 Fast mode ON"; |
| 71 | wasFastModeToggledOn = true; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | if (isBilledAsExtraUsage(model, wasFastModeToggledOn === true, isOpus1mMergeEnabled())) { |
nothing calls this directly
no test coverage detected