i18n - docs translations (#21865)
Created by Github action Co-authored-by: github-actions <github-actions@twenty.com>
This commit is contained in:
committed by
GitHub
parent
9695d77252
commit
4e64a38e1e
@@ -348,6 +348,32 @@ export default defineLogicFunction({
|
||||
});
|
||||
```
|
||||
|
||||
Para declarar seus parâmetros **uma vez** e atender a ambas as superfícies, defina um único JSON Schema (`InputJsonSchema`) e converta-o para a ação de workflow com `jsonSchemaToInputSchema` de `twenty-sdk/logic-function`. `toolTriggerSettings.inputSchema` recebe o JSON Schema diretamente, enquanto `workflowActionTriggerSettings.inputSchema` espera o `InputSchema` da Twenty:
|
||||
|
||||
```ts
|
||||
import { defineLogicFunction } from 'twenty-sdk/define';
|
||||
import { jsonSchemaToInputSchema, type InputJsonSchema } from 'twenty-sdk/logic-function';
|
||||
|
||||
const inputSchema: InputJsonSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
companyName: { type: 'string', label: 'Company name' },
|
||||
domain: { type: 'string', label: 'Domain' },
|
||||
},
|
||||
required: ['companyName'],
|
||||
};
|
||||
|
||||
export default defineLogicFunction({
|
||||
...,
|
||||
toolTriggerSettings: { inputSchema },
|
||||
workflowActionTriggerSettings: {
|
||||
label: 'Enrich Company',
|
||||
icon: 'IconBuilding',
|
||||
inputSchema: jsonSchemaToInputSchema(inputSchema),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
<Note>
|
||||
**Escreva uma boa `description`.** Os agentes de IA dependem do campo `description` da função para decidir quando usar a ferramenta. Seja específico sobre o que a ferramenta faz e quando ela deve ser chamada.
|
||||
</Note>
|
||||
@@ -355,6 +381,20 @@ export default defineLogicFunction({
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
<Note>
|
||||
**Auxiliares de runtime.** `twenty-sdk/utils` reexporta pequenos auxiliares de runtime para que os handlers nunca importem diretamente de `twenty-shared`. Por exemplo, `isDefined(value)` retorna `false` tanto para `null` quanto para `undefined` — use-o para restringir com segurança entradas opcionais de handlers, que podem chegar como `null` em tempo de execução mesmo quando tipadas como `T | undefined`:
|
||||
|
||||
```ts
|
||||
import { isDefined } from 'twenty-sdk/utils';
|
||||
|
||||
const handler = async (params: { parentMessageId?: string }) => {
|
||||
if (isDefined(params.parentMessageId)) {
|
||||
// params.parentMessageId is narrowed to string here
|
||||
}
|
||||
};
|
||||
```
|
||||
</Note>
|
||||
|
||||
<Note>
|
||||
**Hooks de instalação** — manipuladores de pré-instalação e pós-instalação — compartilham esse ambiente de execução, mas são declarados com suas próprias funções de definição e não usam configurações de gatilho. Veja [Hooks de instalação](/l/pt/developers/extend/apps/config/install-hooks) para `definePreInstallLogicFunction` e `definePostInstallLogicFunction`.
|
||||
</Note>
|
||||
|
||||
Reference in New Issue
Block a user