Files
BramandDavide Silvestri 0efdf44427 Added additional actions and email trigger to agents (#6866)
* Added additional actions and email trigger to agents

* Made delete row id required and share outcome

* Default formula handles text and html

* Made the email trigger and list rows labels a bit more generic

* Remove AI prompt and start workflow actions

* Added create, update, and delete permissions check

* Give correct action name to Kuma

* Add view, field and aggregation to tool call

* Prefetch query for row aggregate to reduce queries

* Implemented tool presentation for each type

* Made semantic search extend LocalBaserowAgentActionType

---------

Co-authored-by: Davide Silvestri <silvestri.eng@gmail.com>
2026-11-25 21:52:04 +01:00

43 lines
1.5 KiB
JavaScript

const ACTION_FIELD_LABELS = {
name: 'agent.actionName',
description: 'agent.actionDescription',
inputs: 'agent.actionInputs',
service: 'agent.actionConfiguration',
type: 'agent.actionFieldType',
integration_id: 'agent.actionFieldIntegration',
run_as: 'agent.workspaceAccess',
}
export const ACTION_ERROR_LABELS = {
required: 'agent.actionErrorRequired',
invalid: 'agent.actionErrorInvalid',
unavailable: 'agent.actionErrorUnavailable',
forbidden: 'agent.actionErrorForbidden',
fixed_host: 'agent.actionErrorFixedHost',
}
export const ACTION_INPUT_TYPE_LABELS = {
string: 'agent.actionInputTypeString',
email: 'agent.actionInputTypeEmail',
number: 'agent.actionInputTypeNumber',
boolean: 'agent.actionInputTypeBoolean',
}
/**
* Names a field of an action as its editor does: the label its service form
* shows, else the label of what every action has, else the field itself.
*
* @param {object} registry The application registry.
* @param {string} type The action's type, which is its service type.
* @param {string} field The field name, as the backend reports it.
* @param {Function} t The translate function.
* @returns {string} The label.
*/
export function actionFieldLabel(registry, type, field, t) {
const serviceLabels = registry.exists('toolPresentation', type)
? registry.get('toolPresentation', type).fieldLabels
: {}
const label = serviceLabels[field] || ACTION_FIELD_LABELS[field]
return label ? t(label) : field
}