| 91 | |
| 92 | // Generate options with summarize as input type for inline context |
| 93 | function getRestoreOptions(canRestoreCode: boolean): OptionWithDescription<RestoreOption>[] { |
| 94 | const baseOptions: OptionWithDescription<RestoreOption>[] = canRestoreCode ? [{ |
| 95 | value: 'both', |
| 96 | label: 'Restore code and conversation' |
| 97 | }, { |
| 98 | value: 'conversation', |
| 99 | label: 'Restore conversation' |
| 100 | }, { |
| 101 | value: 'code', |
| 102 | label: 'Restore code' |
| 103 | }] : [{ |
| 104 | value: 'conversation', |
| 105 | label: 'Restore conversation' |
| 106 | }]; |
| 107 | const summarizeInputProps = { |
| 108 | type: 'input' as const, |
| 109 | placeholder: 'add context (optional)', |
| 110 | initialValue: '', |
| 111 | allowEmptySubmitToCancel: true, |
| 112 | showLabelWithValue: true, |
| 113 | labelValueSeparator: ': ' |
| 114 | }; |
| 115 | baseOptions.push({ |
| 116 | value: 'summarize', |
| 117 | label: 'Summarize from here', |
| 118 | ...summarizeInputProps, |
| 119 | onChange: setSummarizeFromFeedback |
| 120 | }); |
| 121 | if ("external" === 'ant') { |
| 122 | baseOptions.push({ |
| 123 | value: 'summarize_up_to', |
| 124 | label: 'Summarize up to here', |
| 125 | ...summarizeInputProps, |
| 126 | onChange: setSummarizeUpToFeedback |
| 127 | }); |
| 128 | } |
| 129 | baseOptions.push({ |
| 130 | value: 'nevermind', |
| 131 | label: 'Never mind' |
| 132 | }); |
| 133 | return baseOptions; |
| 134 | } |
| 135 | |
| 136 | // Log when selector is opened |
| 137 | useEffect(() => { |