()
| 241 | let isPromptControlled = props.value !== undefined; |
| 242 | let isAttachmentsControlled = props.attachments !== undefined; |
| 243 | let onSubmit = () => { |
| 244 | if (prompt.segments.length === 0) { |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | props.onSubmit?.(prompt, attachments); |
| 249 | if (!isPromptControlled) { |
| 250 | setPrompt(new PromptFieldValue([])); |
| 251 | } |
| 252 | if (!isAttachmentsControlled) { |
| 253 | setAttachments([]); |
| 254 | } |
| 255 | inputRef.current?.focus(); |
| 256 | }; |
| 257 | |
| 258 | return ( |
| 259 | <PromptFieldContext.Provider |
no test coverage detected