({
value,
cursor,
onChange,
onCursorChange,
onSubmit,
placeholder,
inputRef,
width,
isSubmitting = false,
})
| 94 | } |
| 95 | |
| 96 | const FeedbackTextSection: React.FC<FeedbackTextSectionProps> = ({ |
| 97 | value, |
| 98 | cursor, |
| 99 | onChange, |
| 100 | onCursorChange, |
| 101 | onSubmit, |
| 102 | placeholder, |
| 103 | inputRef, |
| 104 | width, |
| 105 | isSubmitting = false, |
| 106 | }) => { |
| 107 | const inputFocused = useChatStore((state) => state.inputFocused) |
| 108 | |
| 109 | return ( |
| 110 | <> |
| 111 | {/* Top separator */} |
| 112 | <Separator width={width} widthOffset={4} /> |
| 113 | |
| 114 | {/* Feedback input */} |
| 115 | <box style={{ paddingTop: 0, paddingBottom: 0 }}> |
| 116 | <MultilineInput |
| 117 | value={value} |
| 118 | onChange={({ text, cursorPosition }) => { |
| 119 | onChange(text) |
| 120 | onCursorChange(cursorPosition) |
| 121 | }} |
| 122 | onSubmit={onSubmit} |
| 123 | onKeyIntercept={(key) => { |
| 124 | if (!isPlainEnterKey(key)) return false |
| 125 | // Just add newline on Enter |
| 126 | const newText = value.slice(0, cursor) + '\n' + value.slice(cursor) |
| 127 | onChange(newText) |
| 128 | onCursorChange(cursor + 1) |
| 129 | return true |
| 130 | }} |
| 131 | onPaste={createTextPasteHandler(value, cursor, ({ text, cursorPosition }) => { |
| 132 | onChange(text) |
| 133 | onCursorChange(cursorPosition) |
| 134 | })} |
| 135 | placeholder={placeholder} |
| 136 | focused={inputFocused && !isSubmitting} |
| 137 | maxHeight={5} |
| 138 | minHeight={3} |
| 139 | ref={inputRef} |
| 140 | cursorPosition={cursor} |
| 141 | /> |
| 142 | </box> |
| 143 | |
| 144 | {/* Bottom separator */} |
| 145 | <Separator width={width} widthOffset={4} /> |
| 146 | </> |
| 147 | ) |
| 148 | } |
| 149 | |
| 150 | interface FeedbackInputModeProps { |
| 151 | value: string |
nothing calls this directly
no test coverage detected