2
0

(openai) Show textarea instead of text input for message content

This commit is contained in:
Baptiste Arnaud
2023-03-29 10:58:26 +02:00
parent 84cdf4e934
commit 50db9985c4
3 changed files with 9 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ type Props = {
moreInfoTooltip?: string moreInfoTooltip?: string
withVariableButton?: boolean withVariableButton?: boolean
isRequired?: boolean isRequired?: boolean
placeholder?: string
onChange: (value: string) => void onChange: (value: string) => void
} & Pick<TextareaProps, 'minH'> } & Pick<TextareaProps, 'minH'>
@@ -32,8 +33,10 @@ export const Textarea = ({
debounceTimeout = 1000, debounceTimeout = 1000,
label, label,
moreInfoTooltip, moreInfoTooltip,
placeholder,
withVariableButton = true, withVariableButton = true,
isRequired, isRequired,
minH,
}: Props) => { }: Props) => {
const inputRef = useRef<HTMLTextAreaElement | null>(null) const inputRef = useRef<HTMLTextAreaElement | null>(null)
const [isTouched, setIsTouched] = useState(false) const [isTouched, setIsTouched] = useState(false)
@@ -89,6 +92,8 @@ export const Textarea = ({
value={localValue} value={localValue}
onBlur={updateCarretPosition} onBlur={updateCarretPosition}
onChange={(e) => changeValue(e.target.value)} onChange={(e) => changeValue(e.target.value)}
placeholder={placeholder}
minH={minH}
/> />
) )

View File

@@ -1,5 +1,5 @@
import { DropdownList } from '@/components/DropdownList' import { DropdownList } from '@/components/DropdownList'
import { TextInput } from '@/components/inputs' import { Textarea } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput' import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { TableListItemProps } from '@/components/TableList' import { TableListItemProps } from '@/components/TableList'
import { Stack } from '@chakra-ui/react' import { Stack } from '@chakra-ui/react'
@@ -77,10 +77,11 @@ export const ChatCompletionMessageItem = ({ item, onItemChange }: Props) => {
/> />
</> </>
) : ( ) : (
<TextInput <Textarea
defaultValue={item.content} defaultValue={item.content}
onChange={changeSingleMessageContent} onChange={changeSingleMessageContent}
placeholder="Content" placeholder="Content"
minH="150px"
/> />
)} )}
</Stack> </Stack>

View File

@@ -79,7 +79,7 @@ export const OpenAIChatCompletionSettings = ({
items={chatCompletionModels} items={chatCompletionModels}
onItemSelect={updateModel} onItemSelect={updateModel}
/> />
<Accordion allowToggle allowMultiple> <Accordion allowMultiple>
<AccordionItem> <AccordionItem>
<AccordionButton> <AccordionButton>
<Text w="full" textAlign="left"> <Text w="full" textAlign="left">