Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ apps/docs/build/
#build
firebaseServiceAccount.json
# tsbuildinfo file
tsconfig.tsbuildinfo
**/tsconfig.tsbuildinfo

.env.production

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const StepTypeLabel = ({ type }: Props) => {
case WOZStepType.MESSAGE:
return <Text>Envie mensagem com a IA</Text>
case WOZStepType.INTERPRET_DATA_WITH_AI:
return <Text>Interpretar informações com a IA</Text>
return <Text>Formate informações com a IA</Text>
case WOZStepType.ASSIGN:
return <Text>Direcione a conversa para o WOZ</Text>
case InputStepType.TEXT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,19 @@ export const InterpretDataWithAI = ({ step, onContentChange }: Props) => {
}

const placeholderInstructions = useMemo(() => {
return `Retorne ao cliente um resumo dos incidentes encontrados.
return `Ex: Retorne ao cliente a lista dos tickets encontrados.
\b\b
Use as variáveis: {{incident_count}}, {{date_range}}, {{service_name}}, {{incident_date}},
{{incident_title}}, {{incident_status}}. `
Use as variáveis: {{ numero-ticket }}, {{ status-ticket }},
{{ criado-em }}`
}, [])

const tooltipInstructions = useMemo(() => {
return `Descreva o formato da mensagem que a IA deve gerar. Escreva o texto que desejar e clique nas {{variáveis}} disponíveis abaixo para incluir informações dinâmicas. <br /><br />
Clique em 'Testar retorno' para ver como ficará na prática.`
return `Como instruir a IA?
<ol style="margin: 8px 0; padding-left: 20px; list-style-type: decimal;">
<li style="margin-bottom: 4px;">Digite quais dados você quer que apareça na resposta da conversa.</li>
<li style="margin-bottom: 4px;">Use o botão (+) para inserir as informações (variáveis) capturadas no passo anterior.</li>
<li style="margin-bottom: 4px;">Clique em 'Testar retorno' para ver um exemplo do que irá para a IA se basear e usar na conversa.</li>
</ol>`
}, [])

const responseKeys = useMemo(
Expand Down Expand Up @@ -177,8 +181,7 @@ Clique em 'Testar retorno' para ver como ficará na prática.`
return (
<Stack>
<Text>
A IA interpreta a entrada e devolve como mensagem natural, para ser
usado no próximo passo do fluxo.
Defina como a IA deve apresentar os dados coletados na conversa.
</Text>

<Stack direction="row" justifyContent="space-between" w="full">
Expand All @@ -201,26 +204,32 @@ Clique em 'Testar retorno' para ver como ficará na prática.`
</Stack>

<VStack gap={4} w="full">
<Box position="relative" w="full">
<Textarea
ref={textareaRef}
placeholder={placeholderInstructions}
resize="none"
maxLength={5000}
minLength={1}
value={step?.content?.systemMessage || ''}
onChange={(e) => handleInstructionsChange(e.target.value)}
rows={10}
paddingRight="45px"
className="scrollbar-custom"
/>

<Box position="absolute" bottom="14px" right="14px" zIndex={1}>
<VariablesMenu
variables={responseKeys || []}
onVariableSelect={handleVariableSelected}
<Box>
<Box position="relative" w="full">
<Textarea
ref={textareaRef}
placeholder={placeholderInstructions}
resize="none"
maxLength={5000}
minLength={1}
value={step?.content?.systemMessage || ''}
onChange={(e) => handleInstructionsChange(e.target.value)}
rows={10}
paddingRight="45px"
className="scrollbar-custom"
/>

<Box position="absolute" bottom="14px" right="14px" zIndex={1}>
<VariablesMenu
variables={responseKeys || []}
onVariableSelect={handleVariableSelected}
/>
</Box>
</Box>
<Text mt={2} fontSize="xs" color="gray.500">
A IA usará este texto como base. Não é necessário dar comandos de
comportamento aqui, apenas estruturar a informação.
</Text>
</Box>

{resultOfInterpretWithAi.length > 0 && (
Expand Down
6 changes: 4 additions & 2 deletions apps/builder/services/typebots/typebots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import {
stepTypeHasWebhook,
} from 'utils'
import { fetcher, toKebabCase } from '../utils'
import { sendMainBffRequest } from 'util/mainBffRequest'

export type TypebotInDashboard = Pick<
Typebot,
Expand Down Expand Up @@ -304,12 +305,13 @@ export const deleteTypebot = async (id: string) =>
method: 'DELETE',
})

export const updateTypebot = async (id: string, typebot: Typebot) =>
sendOctaRequest({
export const updateTypebot = async (id: string, typebot: Typebot) => {
return sendMainBffRequest({
url: `${id}`,
method: 'PUT',
body: { bot: typebot },
})
}

export const patchTypebot = async (id: string, typebot: Partial<Typebot>) =>
sendOctaRequest({
Expand Down
22 changes: 22 additions & 0 deletions apps/builder/util/mainBffRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { headers } from '@octadesk-tech/services'
import getBaseClient from 'services/api/getBaseClient'

const sendMainBffRequest = async (request: {
url: string
method: string
body?: unknown
}): Promise<any> => {
const client = await getBaseClient('mainBff')
const authorationHeaders = headers.getAuthorizedHeaders()

if (request.method === 'PUT' || request.method === 'PATCH')
return client.put(`/bots/${request.url}`, request.body, authorationHeaders)

if (request.method === 'POST')
return client.post(`/bots/${request.url}`, request.body, authorationHeaders)

if (request.method === 'DELETE')
return client.delete(`/bots/${request.url}`, authorationHeaders)
}

export { sendMainBffRequest }
Loading
Loading