Skip to content

Commit

Permalink
📝 Add breaking changes and OpenAI block improvements docs
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Nov 9, 2023
1 parent 60829b4 commit df57841
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
20 changes: 15 additions & 5 deletions apps/builder/src/features/publish/components/PublishButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { useToast } from '@/hooks/useToast'
import { parseDefaultPublicId } from '../helpers/parseDefaultPublicId'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { ConfirmModal } from '@/components/ConfirmModal'
import { TextLink } from '@/components/TextLink'

type Props = ButtonProps & {
isMoreMenuDisabled?: boolean
Expand Down Expand Up @@ -138,22 +139,31 @@ export const PublishButton = ({
onClose={onClose}
type={t('billing.limitMessage.fileInput')}
/>
{publishedTypebotVersion !== typebot?.version && (
{publishedTypebot && publishedTypebotVersion !== typebot?.version && (
<ConfirmModal
isOpen={isNewEngineWarningOpen}
onConfirm={handlePublishClick}
onClose={onNewEngineWarningClose}
confirmButtonColor="blue"
title="⚠️ New engine version"
message={
<Stack>
<Stack spacing="3">
<Text>
You are about to a deploy a version of your bot with an updated
engine.
engine. (Typebot V6).
</Text>
<Text fontWeight="bold">
Make sure to test it thoroughly in preview mode before
publishing.
Make sure to check out all the{' '}
<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>
</Stack>
}
Expand Down
13 changes: 13 additions & 0 deletions apps/docs/docs/breaking-changes.md
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 9 additions & 9 deletions apps/docs/docs/editor/blocks/integrations/openai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ With the OpenAI block, you can create a chat completion based on your user queri
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
src="/img/blocks/integrations/openai/messages-sequence.png"
width="600"
src="/img/blocks/integrations/openai/append-to-history.png"
alt="OpenAI messages sequence"
/>

:::note
Under the hood, **Messages sequence ✨** will convert the provided variables into lists if it's not already the case.
:::
Then you can give the OpenAI block access to this sequence of messages:

<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

Expand Down Expand Up @@ -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:

- You have selected an OpenAI account
- You have at least 1 **user** message or a **Message sequence ✨**.
- If you have a **Message sequence ✨**, make sure your user messages variable contains at least 1 message.
- You have at least 1 **user** message or a **Dialogue** message set up.

### It returns an empty message

Expand Down
22 changes: 22 additions & 0 deletions apps/docs/docs/editor/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

## 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

Here is a quick video that showcases advanced concepts about variables:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

2 comments on commit df57841

@vercel
Copy link

@vercel vercel bot commented on df57841 Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on df57841 Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

Please sign in to comment.