2
0

📝 Add breaking changes and OpenAI block improvements docs

This commit is contained in:
Baptiste Arnaud
2023-11-09 16:04:40 +01:00
parent 60829b4d0a
commit df578417aa
6 changed files with 59 additions and 14 deletions

View File

@ -31,6 +31,7 @@ import { useToast } from '@/hooks/useToast'
import { parseDefaultPublicId } from '../helpers/parseDefaultPublicId' import { parseDefaultPublicId } from '../helpers/parseDefaultPublicId'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { ConfirmModal } from '@/components/ConfirmModal' import { ConfirmModal } from '@/components/ConfirmModal'
import { TextLink } from '@/components/TextLink'
type Props = ButtonProps & { type Props = ButtonProps & {
isMoreMenuDisabled?: boolean isMoreMenuDisabled?: boolean
@ -138,7 +139,7 @@ export const PublishButton = ({
onClose={onClose} onClose={onClose}
type={t('billing.limitMessage.fileInput')} type={t('billing.limitMessage.fileInput')}
/> />
{publishedTypebotVersion !== typebot?.version && ( {publishedTypebot && publishedTypebotVersion !== typebot?.version && (
<ConfirmModal <ConfirmModal
isOpen={isNewEngineWarningOpen} isOpen={isNewEngineWarningOpen}
onConfirm={handlePublishClick} onConfirm={handlePublishClick}
@ -146,14 +147,23 @@ export const PublishButton = ({
confirmButtonColor="blue" confirmButtonColor="blue"
title="⚠️ New engine version" title="⚠️ New engine version"
message={ message={
<Stack> <Stack spacing="3">
<Text> <Text>
You are about to a deploy a version of your bot with an updated You are about to a deploy a version of your bot with an updated
engine. engine. (Typebot V6).
</Text> </Text>
<Text fontWeight="bold"> <Text fontWeight="bold">
Make sure to test it thoroughly in preview mode before Make sure to check out all the{' '}
publishing. <TextLink
href="https://docs.typebot.io/breaking-changes#typebot-v6"
isExternal
>
associated breaking changes
</TextLink>
</Text>
<Text>
{' '}
Then test, the bot thoroughly in preview mode before publishing.
</Text> </Text>
</Stack> </Stack>
} }

View File

@ -0,0 +1,13 @@
# Breaking changes
## Typebot v6
- List variables now don't automatically display the last item when inserted into a bubble. It was too "magical". Now you can leverage the inline code feature to easily get the last element of a list:
```
{{={{List var}}.at(-1)=}}
```
Check out the new [Inline variable formatting section](./editor/variables) for more information.
- Input prefill is now disabled by default. You can still enable it in the [Settings](./editor/settings) tab of your bot.

View File

@ -10,19 +10,20 @@ With the OpenAI block, you can create a chat completion based on your user queri
alt="OpenAI block" alt="OpenAI block"
/> />
This integration comes with a convenient message type called **Messages sequence ✨**. It allows you to directly pass a sequence of saved assistant / user messages: This integration comes with a convenient message type called **Dialogue**. It allows you to easily pass a sequence of saved assistant / user messages history to OpenAI:
<img <img
src="/img/blocks/integrations/openai/messages-sequence.png" src="/img/blocks/integrations/openai/append-to-history.png"
width="600"
alt="OpenAI messages sequence" alt="OpenAI messages sequence"
/> />
:::note Then you can give the OpenAI block access to this sequence of messages:
Under the hood, **Messages sequence ✨** will convert the provided variables into lists if it's not already the case.
:::
<YoutubeEmbed videoId="v167drfHFzk" /> <img
src="/img/blocks/integrations/openai/dialogue-usage.png"
width="600"
alt="OpenAI messages sequence"
/>
## Using Multiple Open AI Blocks: Tips and Tricks ## Using Multiple Open AI Blocks: Tips and Tricks
@ -62,8 +63,7 @@ I also demonstrate how formatting can be affected by the presence of text before
It means your OpenAI block is not configured properly. Please check the following: It means your OpenAI block is not configured properly. Please check the following:
- You have selected an OpenAI account - You have selected an OpenAI account
- You have at least 1 **user** message or a **Message sequence ✨**. - You have at least 1 **user** message or a **Dialogue** message set up.
- If you have a **Message sequence ✨**, make sure your user messages variable contains at least 1 message.
### It returns an empty message ### It returns an empty message

View File

@ -10,6 +10,28 @@ You can tell your input step to save the answer into a variable and reuse then i
<img src="/img/variables/question.png" width="800" alt="Iframe preview" /> <img src="/img/variables/question.png" width="800" alt="Iframe preview" />
## Use variables
Once your variables are declared you can use theme **anywhere** in your bot. For example you can display it in a text bubble with the following syntax:
`{{My variable}}` where "My variable" is the name of your variable.
## Inline variable formatting
You can also decide to format your variable directly in the text bubble. For example if you want to display the variable "First name" in uppercase you can use the following syntax:
`{{={{My variable}}.toUpperCase()=}}`
When you insert `{{= ... =}}`, it means what's inside will be evaluated as JavaScript. So you can use any JavaScript inline function inside. The behavior is similar to the custom value in the Set variable block.
If you would like to get the first item of a list:
`{{={{My variable}}[0]=}}` or `{{={{My variable}}.at(0)=}}`
Likewise for last item:
`{{={{My variable}}.at(-1)=}}`
## Advanced concepts ## Advanced concepts
Here is a quick video that showcases advanced concepts about variables: Here is a quick video that showcases advanced concepts about variables:

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB