🐛 (openai) Fix default response mapping item
This commit is contained in:
@ -22,6 +22,7 @@ type Props<T> = {
|
||||
initialItems: ItemWithId<T>[]
|
||||
isOrdered?: boolean
|
||||
addLabel?: string
|
||||
newItemDefaultProps?: Partial<T>
|
||||
Item: (props: TableListItemProps<T>) => JSX.Element
|
||||
ComponentBetweenItems?: (props: unknown) => JSX.Element
|
||||
onItemsChange: (items: ItemWithId<T>[]) => void
|
||||
@ -31,6 +32,7 @@ export const TableList = <T,>({
|
||||
initialItems,
|
||||
isOrdered,
|
||||
addLabel = 'Add',
|
||||
newItemDefaultProps,
|
||||
Item,
|
||||
ComponentBetweenItems,
|
||||
onItemsChange,
|
||||
@ -40,7 +42,7 @@ export const TableList = <T,>({
|
||||
|
||||
const createItem = () => {
|
||||
const id = createId()
|
||||
const newItem = { id } as ItemWithId<T>
|
||||
const newItem = { id, ...newItemDefaultProps } as ItemWithId<T>
|
||||
setItems([...items, newItem])
|
||||
onItemsChange([...items, newItem])
|
||||
}
|
||||
|
@ -124,12 +124,12 @@ export const OpenAIChatCompletionSettings = ({
|
||||
</Text>
|
||||
<AccordionIcon />
|
||||
</AccordionButton>
|
||||
|
||||
<AccordionPanel pt="4">
|
||||
<TableList
|
||||
initialItems={options.responseMapping}
|
||||
Item={ChatCompletionResponseItem}
|
||||
onItemsChange={updateResponseMapping}
|
||||
newItemDefaultProps={{ valueToExtract: 'Message content' }}
|
||||
/>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
Reference in New Issue
Block a user