({
instructions,
setInstructions,
loading,
onSubmit,
placeholder = "Send custom instructions",
...props
}: {
instructions: string;
setInstructions: (instructions: string) => void;
loading: boolean;
onSubmit: () => void;
placeholder?: string;
} & InputGroupProps)
| 11 | import AutoResizeTextArea from "./AutoResizeTextArea"; |
| 12 | |
| 13 | export const CustomInstructionsInput = ({ |
| 14 | instructions, |
| 15 | setInstructions, |
| 16 | loading, |
| 17 | onSubmit, |
| 18 | placeholder = "Send custom instructions", |
| 19 | ...props |
| 20 | }: { |
| 21 | instructions: string; |
| 22 | setInstructions: (instructions: string) => void; |
| 23 | loading: boolean; |
| 24 | onSubmit: () => void; |
| 25 | placeholder?: string; |
| 26 | } & InputGroupProps) => { |
| 27 | return ( |
| 28 | <InputGroup |
| 29 | size="md" |
| 30 | w="full" |
| 31 | maxW="600" |
| 32 | boxShadow="0 0 40px 4px rgba(0, 0, 0, 0.1);" |
| 33 | borderRadius={8} |
| 34 | alignItems="center" |
| 35 | colorScheme="orange" |
| 36 | {...props} |
| 37 | > |
| 38 | <AutoResizeTextArea |
| 39 | value={instructions} |
| 40 | onChange={(e) => setInstructions(e.target.value)} |
| 41 | onKeyDown={(e) => { |
| 42 | if (e.key === "Enter" && !e.metaKey && !e.ctrlKey && !e.shiftKey) { |
| 43 | e.preventDefault(); |
| 44 | e.currentTarget.blur(); |
| 45 | onSubmit(); |
| 46 | } |
| 47 | }} |
| 48 | placeholder={placeholder} |
| 49 | py={4} |
| 50 | pl={4} |
| 51 | pr={12} |
| 52 | colorScheme="orange" |
| 53 | borderColor="gray.300" |
| 54 | borderWidth={1} |
| 55 | _hover={{ |
| 56 | borderColor: "gray.300", |
| 57 | }} |
| 58 | _focus={{ |
| 59 | borderColor: "gray.300", |
| 60 | }} |
| 61 | isDisabled={loading} |
| 62 | /> |
| 63 | <HStack></HStack> |
| 64 | <InputRightElement width="8" height="full"> |
| 65 | <Button |
| 66 | h="8" |
| 67 | w="8" |
| 68 | minW="unset" |
| 69 | size="sm" |
| 70 | onClick={() => onSubmit()} |
nothing calls this directly
no outgoing calls
no test coverage detected