@@ -76,7 +76,7 @@
|
||||
"nextjs-cors": "2.1.2",
|
||||
"nodemailer": "6.9.3",
|
||||
"nprogress": "0.2.0",
|
||||
"openai": "4.19.0",
|
||||
"openai": "4.24.1",
|
||||
"papaparse": "5.4.1",
|
||||
"posthog-js": "1.77.1",
|
||||
"posthog-node": "3.1.1",
|
||||
|
||||
@@ -12,7 +12,10 @@ type Props = {
|
||||
onOptionsChange: (options: BlockOptions) => void
|
||||
}
|
||||
export const ForgedBlockSettings = ({ block, onOptionsChange }: Props) => {
|
||||
const { blockDef, blockSchema } = useForgedBlock(block.type)
|
||||
const { blockDef, blockSchema, actionDef } = useForgedBlock(
|
||||
block.type,
|
||||
block.options?.action
|
||||
)
|
||||
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||
|
||||
const updateCredentialsId = (credentialsId?: string) => {
|
||||
@@ -22,6 +25,34 @@ export const ForgedBlockSettings = ({ block, onOptionsChange }: Props) => {
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const resetOptionsAction = (updates: any) => {
|
||||
if (!actionDef) return
|
||||
const actionOptionsKeys = Object.keys(actionDef.options?.shape ?? [])
|
||||
const actionOptions = actionOptionsKeys.reduce(
|
||||
(acc, key) => ({
|
||||
...acc,
|
||||
[key]: undefined,
|
||||
}),
|
||||
{}
|
||||
)
|
||||
onOptionsChange({
|
||||
...updates,
|
||||
...actionOptions,
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const updateOptions = (updates: any) => {
|
||||
const isChangingAction =
|
||||
actionDef && updates?.action && updates.action !== block.options.action
|
||||
if (isChangingAction) {
|
||||
resetOptionsAction(updates)
|
||||
return
|
||||
}
|
||||
onOptionsChange(updates)
|
||||
}
|
||||
|
||||
if (!blockDef || !blockSchema) return null
|
||||
return (
|
||||
<Stack spacing={4}>
|
||||
@@ -57,7 +88,7 @@ export const ForgedBlockSettings = ({ block, onOptionsChange }: Props) => {
|
||||
schema={blockSchema.shape.options}
|
||||
blockDef={blockDef}
|
||||
blockOptions={block.options}
|
||||
onDataChange={onOptionsChange}
|
||||
onDataChange={updateOptions}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -33,6 +33,17 @@ Then you can give the OpenAI block access to this sequence of messages:
|
||||
/>
|
||||
</Frame>
|
||||
|
||||
## Ask assistant
|
||||
|
||||
This action allows you to talk with your [OpenAI assistant](https://platform.openai.com/assistants). All you have to do is to provide its ID.
|
||||
|
||||
<Frame>
|
||||
<img
|
||||
src="/images/blocks/integrations/openai/ask-assistant.png"
|
||||
alt="OpenAI ask assistant settings"
|
||||
/>
|
||||
</Frame>
|
||||
|
||||
## Create speech
|
||||
|
||||
This action allows you to transform a text input into an audio URL that you can reuse in your bot.
|
||||
|
||||
BIN
apps/docs/images/blocks/integrations/openai/ask-assistant.png
Normal file
BIN
apps/docs/images/blocks/integrations/openai/ask-assistant.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
@@ -26820,7 +26820,8 @@
|
||||
"openai",
|
||||
"zemantic-ai",
|
||||
"cal-com",
|
||||
"chat-node"
|
||||
"chat-node",
|
||||
"qr-code"
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
|
||||
@@ -10289,7 +10289,8 @@
|
||||
"openai",
|
||||
"zemantic-ai",
|
||||
"cal-com",
|
||||
"chat-node"
|
||||
"chat-node",
|
||||
"qr-code"
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"@typebot.io/js": "workspace:*",
|
||||
"@typebot.io/nextjs": "workspace:*",
|
||||
"@typebot.io/prisma": "workspace:*",
|
||||
"ai": "2.2.24",
|
||||
"ai": "2.2.31",
|
||||
"bot-engine": "workspace:*",
|
||||
"cors": "2.8.5",
|
||||
"google-spreadsheet": "4.0.2",
|
||||
@@ -28,7 +28,7 @@
|
||||
"next": "14.0.3",
|
||||
"nextjs-cors": "2.1.2",
|
||||
"nodemailer": "6.9.3",
|
||||
"openai": "4.19.0",
|
||||
"openai": "4.24.1",
|
||||
"qs": "6.11.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
Reference in New Issue
Block a user