Skip to content

Commit

Permalink
🐛 (openai) Fix default response mapping item
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 8, 2023
1 parent 4614caf commit e9c2dee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/builder/src/components/TableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +32,7 @@ export const TableList = <T,>({
initialItems,
isOrdered,
addLabel = 'Add',
newItemDefaultProps,
Item,
ComponentBetweenItems,
onItemsChange,
Expand All @@ -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])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit e9c2dee

Please sign in to comment.