@nyaruka/temba-components 0.129.9 → 0.129.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/demo/data/flows/sample-flow.json +96 -56
- package/demo/test-colorpicker.html +30 -0
- package/dist/temba-components.js +896 -934
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +9 -6
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/config.js +2 -8
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +101 -0
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +4 -89
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +123 -3
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +115 -13
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +160 -12
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +45 -56
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/BaseListEditor.js +4 -3
- package/out-tsc/src/form/BaseListEditor.js.map +1 -1
- package/out-tsc/src/form/Checkbox.js +77 -24
- package/out-tsc/src/form/Checkbox.js.map +1 -1
- package/out-tsc/src/form/ColorPicker.js +28 -40
- package/out-tsc/src/form/ColorPicker.js.map +1 -1
- package/out-tsc/src/form/Completion.js +44 -53
- package/out-tsc/src/form/Completion.js.map +1 -1
- package/out-tsc/src/form/Compose.js +7 -8
- package/out-tsc/src/form/Compose.js.map +1 -1
- package/out-tsc/src/form/ContactSearch.js +3 -4
- package/out-tsc/src/form/ContactSearch.js.map +1 -1
- package/out-tsc/src/form/DatePicker.js +29 -36
- package/out-tsc/src/form/DatePicker.js.map +1 -1
- package/out-tsc/src/form/{FormField.js → FieldElement.js} +78 -50
- package/out-tsc/src/form/FieldElement.js.map +1 -0
- package/out-tsc/src/form/FieldRenderer.js +2 -1
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/form/ImagePicker.js +122 -126
- package/out-tsc/src/form/ImagePicker.js.map +1 -1
- package/out-tsc/src/form/KeyValueEditor.js +41 -37
- package/out-tsc/src/form/KeyValueEditor.js.map +1 -1
- package/out-tsc/src/form/MessageEditor.js +55 -63
- package/out-tsc/src/form/MessageEditor.js.map +1 -1
- package/out-tsc/src/form/TembaSlider.js +3 -3
- package/out-tsc/src/form/TembaSlider.js.map +1 -1
- package/out-tsc/src/form/TemplateEditor.js +3 -3
- package/out-tsc/src/form/TemplateEditor.js.map +1 -1
- package/out-tsc/src/form/TextInput.js +22 -26
- package/out-tsc/src/form/TextInput.js.map +1 -1
- package/out-tsc/src/form/select/Select.js +9 -15
- package/out-tsc/src/form/select/Select.js.map +1 -1
- package/out-tsc/src/form/select/UserSelect.js +8 -9
- package/out-tsc/src/form/select/UserSelect.js.map +1 -1
- package/out-tsc/src/form/select/WorkspaceSelect.js +7 -8
- package/out-tsc/src/form/select/WorkspaceSelect.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +73 -99
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/live/ContactFieldEditor.js.map +1 -1
- package/out-tsc/src/utils.js +115 -0
- package/out-tsc/src/utils.js.map +1 -1
- package/out-tsc/temba-modules.js +3 -2
- package/out-tsc/temba-modules.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +174 -0
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -0
- package/out-tsc/test/temba-checkbox.test.js +16 -0
- package/out-tsc/test/temba-checkbox.test.js.map +1 -1
- package/out-tsc/test/temba-integration-markdown.test.js +2 -4
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -1
- package/out-tsc/test/temba-slider.test.js +0 -1
- package/out-tsc/test/temba-slider.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-no-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/colorpicker/default.png +0 -0
- package/screenshots/truth/colorpicker/focused.png +0 -0
- package/screenshots/truth/colorpicker/initialized.png +0 -0
- package/screenshots/truth/colorpicker/selected.png +0 -0
- package/screenshots/truth/compose/attachments-tab.png +0 -0
- package/screenshots/truth/compose/attachments-with-files.png +0 -0
- package/screenshots/truth/compose/intial-text.png +0 -0
- package/screenshots/truth/compose/no-counter.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
- package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
- package/screenshots/truth/contacts/chat-failure.png +0 -0
- package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
- package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
- package/screenshots/truth/counter/summary.png +0 -0
- package/screenshots/truth/counter/text.png +0 -0
- package/screenshots/truth/counter/unicode-variables.png +0 -0
- package/screenshots/truth/counter/unicode.png +0 -0
- package/screenshots/truth/counter/variable.png +0 -0
- package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
- package/screenshots/truth/datepicker/date.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/range-picker-editing-start.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
- package/screenshots/truth/dialog/focused.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/context-comparison.png +0 -0
- package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
- package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
- package/screenshots/truth/field-renderer/select-multi.png +0 -0
- package/screenshots/truth/field-renderer/select-no-label.png +0 -0
- package/screenshots/truth/field-renderer/select-with-label.png +0 -0
- package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/text-no-label.png +0 -0
- package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/text-with-label.png +0 -0
- package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/fields-filtered.png +0 -0
- package/screenshots/truth/list/fields-hovered.png +0 -0
- package/screenshots/truth/list/fields.png +0 -0
- package/screenshots/truth/list/items-selected.png +0 -0
- package/screenshots/truth/list/items-updated.png +0 -0
- package/screenshots/truth/list/items.png +0 -0
- package/screenshots/truth/menu/menu-focused-with items.png +0 -0
- package/screenshots/truth/menu/menu-refresh-1.png +0 -0
- package/screenshots/truth/menu/menu-refresh-2.png +0 -0
- package/screenshots/truth/menu/menu-submenu.png +0 -0
- package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
- package/screenshots/truth/menu/menu-tasks.png +0 -0
- package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
- package/screenshots/truth/message-editor/default.png +0 -0
- package/screenshots/truth/message-editor/drag-highlight.png +0 -0
- package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
- package/screenshots/truth/message-editor/with-completion.png +0 -0
- package/screenshots/truth/message-editor/with-properties.png +0 -0
- package/screenshots/truth/modax/form.png +0 -0
- package/screenshots/truth/modax/simple.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/omnibox/selected.png +0 -0
- package/screenshots/truth/options/block.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/select/disabled-multi-selection.png +0 -0
- package/screenshots/truth/select/disabled-selection.png +0 -0
- package/screenshots/truth/select/disabled.png +0 -0
- package/screenshots/truth/select/embedded.png +0 -0
- package/screenshots/truth/select/empty-options.png +0 -0
- package/screenshots/truth/select/expression-selected.png +0 -0
- package/screenshots/truth/select/expressions.png +0 -0
- package/screenshots/truth/select/functions.png +0 -0
- package/screenshots/truth/select/local-options.png +0 -0
- package/screenshots/truth/select/multi-with-endpoint.png +0 -0
- package/screenshots/truth/select/multiple-initial-values.png +0 -0
- package/screenshots/truth/select/remote-options.png +0 -0
- package/screenshots/truth/select/search-enabled.png +0 -0
- package/screenshots/truth/select/search-multi-no-matches.png +0 -0
- package/screenshots/truth/select/search-selected-focus.png +0 -0
- package/screenshots/truth/select/search-selected.png +0 -0
- package/screenshots/truth/select/search-with-selected.png +0 -0
- package/screenshots/truth/select/searching.png +0 -0
- package/screenshots/truth/select/selected-multi-maxitems-reached.png +0 -0
- package/screenshots/truth/select/selected-multi.png +0 -0
- package/screenshots/truth/select/selected-single.png +0 -0
- package/screenshots/truth/select/selection-clearable.png +0 -0
- package/screenshots/truth/select/static-initial-value.png +0 -0
- package/screenshots/truth/select/static-initial-via-selected.png +0 -0
- package/screenshots/truth/select/truncated-selection.png +0 -0
- package/screenshots/truth/select/with-placeholder.png +0 -0
- package/screenshots/truth/select/without-placeholder.png +0 -0
- package/screenshots/truth/slider/update-slider-on-circle-dragged.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/templates/unapproved.png +0 -0
- package/screenshots/truth/textinput/autogrow-initial.png +0 -0
- package/screenshots/truth/textinput/input-disabled.png +0 -0
- package/screenshots/truth/textinput/input-focused.png +0 -0
- package/screenshots/truth/textinput/input-form.png +0 -0
- package/screenshots/truth/textinput/input-inserted.png +0 -0
- package/screenshots/truth/textinput/input-placeholder.png +0 -0
- package/screenshots/truth/textinput/input-updated.png +0 -0
- package/screenshots/truth/textinput/input.png +0 -0
- package/screenshots/truth/textinput/textarea-focused.png +0 -0
- package/screenshots/truth/textinput/textarea.png +0 -0
- package/src/events.ts +9 -8
- package/src/flow/Editor.ts +6 -3
- package/src/flow/actions/set_contact_channel.ts +1 -1
- package/src/flow/actions/set_contact_field.ts +1 -1
- package/src/flow/actions/set_contact_language.ts +1 -1
- package/src/flow/actions/set_contact_status.ts +1 -1
- package/src/flow/config.ts +2 -8
- package/src/flow/nodes/split_by_llm.ts +119 -0
- package/src/flow/nodes/split_by_llm_categorize.ts +13 -116
- package/src/flow/nodes/split_by_subflow.ts +153 -3
- package/src/flow/nodes/split_by_ticket.ts +135 -12
- package/src/flow/nodes/split_by_webhook.ts +187 -12
- package/src/form/ArrayEditor.ts +45 -57
- package/src/form/BaseListEditor.ts +4 -4
- package/src/form/Checkbox.ts +81 -24
- package/src/form/ColorPicker.ts +31 -43
- package/src/form/Completion.ts +49 -56
- package/src/form/Compose.ts +8 -8
- package/src/form/ContactSearch.ts +3 -4
- package/src/form/DatePicker.ts +32 -38
- package/src/form/{FormField.ts → FieldElement.ts} +105 -52
- package/src/form/FieldRenderer.ts +2 -1
- package/src/form/ImagePicker.ts +107 -110
- package/src/form/KeyValueEditor.ts +43 -39
- package/src/form/MessageEditor.ts +61 -67
- package/src/form/TembaSlider.ts +3 -3
- package/src/form/TemplateEditor.ts +3 -3
- package/src/form/TextInput.ts +25 -28
- package/src/form/select/Select.ts +12 -17
- package/src/form/select/UserSelect.ts +10 -11
- package/src/form/select/WorkspaceSelect.ts +9 -10
- package/src/live/ContactChat.ts +81 -92
- package/src/live/ContactFieldEditor.ts +2 -2
- package/src/store/flow-definition.d.ts +2 -1
- package/src/utils.ts +192 -0
- package/temba-modules.ts +3 -2
- package/test/nodes/split_by_llm.test.ts +232 -0
- package/test/temba-checkbox.test.ts +26 -0
- package/test/temba-integration-markdown.test.ts +2 -4
- package/test/temba-slider.test.ts +0 -1
- package/test-assets/contacts/history.json +7 -20
- package/test-assets/style.css +36 -234
- package/web-dev-server.config.mjs +26 -0
- package/web-test-runner.config.mjs +1 -1
- package/out-tsc/src/flow/actions/call_llm.js +0 -64
- package/out-tsc/src/flow/actions/call_llm.js.map +0 -1
- package/out-tsc/src/flow/actions/call_webhook.js +0 -131
- package/out-tsc/src/flow/actions/call_webhook.js.map +0 -1
- package/out-tsc/src/flow/actions/enter_flow.js +0 -14
- package/out-tsc/src/flow/actions/enter_flow.js.map +0 -1
- package/out-tsc/src/flow/actions/open_ticket.js +0 -73
- package/out-tsc/src/flow/actions/open_ticket.js.map +0 -1
- package/out-tsc/src/form/FormElement.js +0 -67
- package/out-tsc/src/form/FormElement.js.map +0 -1
- package/out-tsc/src/form/FormField.js.map +0 -1
- package/out-tsc/test/actions/call_llm.test.js +0 -103
- package/out-tsc/test/actions/call_llm.test.js.map +0 -1
- package/out-tsc/test/temba-formfield.test.js +0 -94
- package/out-tsc/test/temba-formfield.test.js.map +0 -1
- package/src/flow/actions/call_llm.ts +0 -66
- package/src/flow/actions/call_webhook.ts +0 -143
- package/src/flow/actions/enter_flow.ts +0 -15
- package/src/flow/actions/open_ticket.ts +0 -83
- package/src/form/FormElement.ts +0 -69
- package/test/actions/call_llm.test.ts +0 -137
- package/test/temba-formfield.test.ts +0 -121
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const call_llm = {
|
|
4
|
-
name: 'Call AI',
|
|
5
|
-
color: COLORS.call,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div
|
|
8
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; max-width: 180px; max-height: 100px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;"
|
|
9
|
-
>
|
|
10
|
-
${action.instructions}
|
|
11
|
-
</div>`;
|
|
12
|
-
},
|
|
13
|
-
form: {
|
|
14
|
-
llm: {
|
|
15
|
-
type: 'select',
|
|
16
|
-
required: true,
|
|
17
|
-
options: [],
|
|
18
|
-
endpoint: '/test-assets/select/llms.json',
|
|
19
|
-
searchable: true,
|
|
20
|
-
valueKey: 'uuid',
|
|
21
|
-
nameKey: 'name'
|
|
22
|
-
},
|
|
23
|
-
input: {
|
|
24
|
-
type: 'text',
|
|
25
|
-
required: true,
|
|
26
|
-
label: 'The input the AI will process',
|
|
27
|
-
evaluated: true,
|
|
28
|
-
placeholder: '@input'
|
|
29
|
-
},
|
|
30
|
-
instructions: {
|
|
31
|
-
type: 'textarea',
|
|
32
|
-
required: true,
|
|
33
|
-
label: 'Tell the AI what to do with the input',
|
|
34
|
-
evaluated: true,
|
|
35
|
-
placeholder: 'Enter instructions for the AI model...',
|
|
36
|
-
minHeight: 130,
|
|
37
|
-
helpText: 'The result can be referenced as **`@locals._llm_output`**'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
layout: ['llm', 'input', 'instructions'],
|
|
41
|
-
toFormData: (action) => {
|
|
42
|
-
return {
|
|
43
|
-
uuid: action.uuid,
|
|
44
|
-
llm: action.llm
|
|
45
|
-
? [{ value: action.llm.uuid, name: action.llm.name }]
|
|
46
|
-
: [],
|
|
47
|
-
input: action.input || '@input',
|
|
48
|
-
instructions: action.instructions || ''
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
fromFormData: (data) => {
|
|
52
|
-
const llmSelection = Array.isArray(data.llm) && data.llm.length > 0 ? data.llm[0] : null;
|
|
53
|
-
return {
|
|
54
|
-
uuid: data.uuid,
|
|
55
|
-
type: 'call_llm',
|
|
56
|
-
input: data.input || '@input',
|
|
57
|
-
llm: llmSelection
|
|
58
|
-
? { uuid: llmSelection.value, name: llmSelection.name }
|
|
59
|
-
: { uuid: '', name: '' },
|
|
60
|
-
instructions: data.instructions || ''
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=call_llm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_llm.js","sourceRoot":"","sources":["../../../../src/flow/actions/call_llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAe,EAAE,EAAE;QACvC,OAAO,IAAI,CAAA;;;QAGP,MAAM,CAAC,YAAY;WAChB,CAAC;IACV,CAAC;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AC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACtE,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,QAAQ;YAC7B,GAAG,EAAE,YAAY;gBACf,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE;gBACvD,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;SAC3B,CAAC;IACf,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, CallLLM } from '../../store/flow-definition';\n\nexport const call_llm: ActionConfig = {\n name: 'Call AI',\n color: COLORS.call,\n render: (_node: Node, action: CallLLM) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; max-width: 180px; max-height: 100px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;\"\n >\n ${action.instructions}\n </div>`;\n },\n form: {\n llm: {\n type: 'select',\n required: true,\n options: [],\n endpoint: '/test-assets/select/llms.json',\n searchable: true,\n valueKey: 'uuid',\n nameKey: 'name'\n },\n input: {\n type: 'text',\n required: true,\n label: 'The input the AI will process',\n evaluated: true,\n placeholder: '@input'\n },\n instructions: {\n type: 'textarea',\n required: true,\n label: 'Tell the AI what to do with the input',\n evaluated: true,\n placeholder: 'Enter instructions for the AI model...',\n minHeight: 130,\n helpText: 'The result can be referenced as **`@locals._llm_output`**'\n }\n },\n layout: ['llm', 'input', 'instructions'],\n toFormData: (action: CallLLM) => {\n return {\n uuid: action.uuid,\n llm: action.llm\n ? [{ value: action.llm.uuid, name: action.llm.name }]\n : [],\n input: action.input || '@input',\n instructions: action.instructions || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n const llmSelection =\n Array.isArray(data.llm) && data.llm.length > 0 ? data.llm[0] : null;\n return {\n uuid: data.uuid,\n type: 'call_llm',\n input: data.input || '@input',\n llm: llmSelection\n ? { uuid: llmSelection.value, name: llmSelection.name }\n : { uuid: '', name: '' },\n instructions: data.instructions || ''\n } as CallLLM;\n }\n};\n"]}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
const defaultPost = `@(json(object(
|
|
4
|
-
"contact", object(
|
|
5
|
-
"uuid", contact.uuid,
|
|
6
|
-
"name", contact.name,
|
|
7
|
-
"urn", contact.urn
|
|
8
|
-
),
|
|
9
|
-
"flow", object(
|
|
10
|
-
"uuid", run.flow.uuid,
|
|
11
|
-
"name", run.flow.name
|
|
12
|
-
),
|
|
13
|
-
"results", foreach_value(results, extract_object, "value", "category")
|
|
14
|
-
)))`;
|
|
15
|
-
export const call_webhook = {
|
|
16
|
-
name: 'Call Webhook',
|
|
17
|
-
color: COLORS.call,
|
|
18
|
-
render: (_node, action) => {
|
|
19
|
-
return html `<div
|
|
20
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
21
|
-
>
|
|
22
|
-
${action.url}
|
|
23
|
-
</div>`;
|
|
24
|
-
},
|
|
25
|
-
evaluated: ['url', 'headers', 'body'], // keep for backward compatibility
|
|
26
|
-
form: {
|
|
27
|
-
method: {
|
|
28
|
-
type: 'select',
|
|
29
|
-
required: true,
|
|
30
|
-
options: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'PATCH'],
|
|
31
|
-
maxWidth: '120px',
|
|
32
|
-
searchable: false
|
|
33
|
-
},
|
|
34
|
-
url: {
|
|
35
|
-
type: 'text',
|
|
36
|
-
required: true,
|
|
37
|
-
evaluated: true,
|
|
38
|
-
placeholder: 'https://example.com/webhook'
|
|
39
|
-
},
|
|
40
|
-
headers: {
|
|
41
|
-
type: 'key-value',
|
|
42
|
-
sortable: true,
|
|
43
|
-
keyPlaceholder: 'Header name',
|
|
44
|
-
valuePlaceholder: 'Header value',
|
|
45
|
-
minRows: 0
|
|
46
|
-
},
|
|
47
|
-
body: {
|
|
48
|
-
type: 'textarea',
|
|
49
|
-
evaluated: true,
|
|
50
|
-
placeholder: 'Request body content (JSON, XML, etc.)',
|
|
51
|
-
minHeight: 200,
|
|
52
|
-
dependsOn: ['method'],
|
|
53
|
-
computeValue: (values, currentValue, originalValues) => {
|
|
54
|
-
// Check if method is POST (handle both string and select object formats)
|
|
55
|
-
const method = Array.isArray(values.method) && values.method.length > 0
|
|
56
|
-
? values.method[0].value || values.method[0].name
|
|
57
|
-
: values.method;
|
|
58
|
-
if (method === 'POST') {
|
|
59
|
-
// For POST, provide the template if body is empty or was never set by user
|
|
60
|
-
if (!currentValue || currentValue.trim() === '') {
|
|
61
|
-
return defaultPost;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// For non-POST methods, clear the body if it was auto-generated or empty
|
|
66
|
-
// Check if the original body was empty (user never specified a body)
|
|
67
|
-
const originalBody = (originalValues === null || originalValues === void 0 ? void 0 : originalValues.body) || '';
|
|
68
|
-
const isOriginallyEmpty = !originalBody || originalBody.trim() === '';
|
|
69
|
-
// Clear if: originally empty, contains default template, or is currently empty
|
|
70
|
-
if (isOriginallyEmpty ||
|
|
71
|
-
!currentValue ||
|
|
72
|
-
currentValue.trim() === '' ||
|
|
73
|
-
currentValue.trim() === defaultPost.trim()) {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return currentValue; // Keep existing value if user has customized it
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
layout: [
|
|
82
|
-
// Row with method and URL side by side
|
|
83
|
-
{ type: 'row', items: ['method', 'url'] },
|
|
84
|
-
// Advanced group with nested layouts
|
|
85
|
-
{
|
|
86
|
-
type: 'group',
|
|
87
|
-
label: 'Headers',
|
|
88
|
-
items: ['headers'],
|
|
89
|
-
collapsible: true,
|
|
90
|
-
collapsed: true,
|
|
91
|
-
helpText: 'Configure authentication or custom headers',
|
|
92
|
-
getGroupValueCount: (formData) => {
|
|
93
|
-
var _a;
|
|
94
|
-
return ((_a = formData.headers) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'group',
|
|
99
|
-
label: 'Body',
|
|
100
|
-
items: ['body'],
|
|
101
|
-
collapsible: true,
|
|
102
|
-
collapsed: true,
|
|
103
|
-
helpText: 'Configure the request payload',
|
|
104
|
-
getGroupValueCount: (formData) => {
|
|
105
|
-
return !!(formData.body &&
|
|
106
|
-
formData.body.trim() !== '' &&
|
|
107
|
-
formData.body !== defaultPost);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
toFormData: (action) => {
|
|
112
|
-
return {
|
|
113
|
-
uuid: action.uuid,
|
|
114
|
-
url: action.url || '',
|
|
115
|
-
method: [{ value: action.method, name: action.method }],
|
|
116
|
-
headers: action.headers || [],
|
|
117
|
-
body: action.body || ''
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
fromFormData: (data) => {
|
|
121
|
-
return {
|
|
122
|
-
uuid: data.uuid,
|
|
123
|
-
type: 'call_webhook',
|
|
124
|
-
url: data.url,
|
|
125
|
-
method: data.method[0].value,
|
|
126
|
-
headers: data.headers || [],
|
|
127
|
-
body: data.body || ''
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
//# sourceMappingURL=call_webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_webhook.js","sourceRoot":"","sources":["../../../../src/flow/actions/call_webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE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AAC,OAAO,0CAAE,MAAM,KAAI,CAAC,CAAC;YACvC,CAAC;SACF;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,CAAC,MAAM,CAAC;YACf,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,+BAA+B;YACzC,kBAAkB,EAAE,CAAC,QAAa,EAAE,EAAE;gBACpC,OAAO,CAAC,CAAC,CACP,QAAQ,CAAC,IAAI;oBACb,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;oBAC3B,QAAQ,CAAC,IAAI,KAAK,WAAW,CAC9B,CAAC;YACJ,CAAC;SACF;KACF;IACD,UAAU,EAAE,CAAC,MAAmB,EAAE,EAAE;QAClC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE;YACrB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;YACvD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;SACxB,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,IAAyB,EAAE,EAAE;QAC1C,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,cAAc;YACpB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;YAC5B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;SACP,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, CallWebhook } from '../../store/flow-definition';\n\nconst defaultPost = `@(json(object(\n \"contact\", object(\n \"uuid\", contact.uuid, \n \"name\", contact.name, \n \"urn\", contact.urn\n ),\n \"flow\", object(\n \"uuid\", run.flow.uuid, \n \"name\", run.flow.name\n ),\n \"results\", foreach_value(results, extract_object, \"value\", \"category\")\n)))`;\n\nexport const call_webhook: ActionConfig = {\n name: 'Call Webhook',\n color: COLORS.call,\n render: (_node: Node, action: CallWebhook) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;\"\n >\n ${action.url}\n </div>`;\n },\n evaluated: ['url', 'headers', 'body'], // keep for backward compatibility\n form: {\n method: {\n type: 'select',\n required: true,\n options: ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'PATCH'],\n maxWidth: '120px',\n searchable: false\n },\n url: {\n type: 'text',\n required: true,\n evaluated: true,\n placeholder: 'https://example.com/webhook'\n },\n headers: {\n type: 'key-value',\n sortable: true,\n keyPlaceholder: 'Header name',\n valuePlaceholder: 'Header value',\n minRows: 0\n },\n body: {\n type: 'textarea',\n evaluated: true,\n placeholder: 'Request body content (JSON, XML, etc.)',\n minHeight: 200,\n dependsOn: ['method'],\n computeValue: (\n values: Record<string, any>,\n currentValue: any,\n originalValues?: Record<string, any>\n ) => {\n // Check if method is POST (handle both string and select object formats)\n const method =\n Array.isArray(values.method) && values.method.length > 0\n ? values.method[0].value || values.method[0].name\n : values.method;\n\n if (method === 'POST') {\n // For POST, provide the template if body is empty or was never set by user\n if (!currentValue || currentValue.trim() === '') {\n return defaultPost;\n }\n } else {\n // For non-POST methods, clear the body if it was auto-generated or empty\n // Check if the original body was empty (user never specified a body)\n const originalBody = originalValues?.body || '';\n const isOriginallyEmpty = !originalBody || originalBody.trim() === '';\n\n // Clear if: originally empty, contains default template, or is currently empty\n if (\n isOriginallyEmpty ||\n !currentValue ||\n currentValue.trim() === '' ||\n currentValue.trim() === defaultPost.trim()\n ) {\n return '';\n }\n }\n\n return currentValue; // Keep existing value if user has customized it\n }\n }\n },\n layout: [\n // Row with method and URL side by side\n { type: 'row', items: ['method', 'url'] },\n // Advanced group with nested layouts\n {\n type: 'group',\n label: 'Headers',\n items: ['headers'],\n collapsible: true,\n collapsed: true,\n helpText: 'Configure authentication or custom headers',\n getGroupValueCount: (formData: any) => {\n return formData.headers?.length || 0;\n }\n },\n {\n type: 'group',\n label: 'Body',\n items: ['body'],\n collapsible: true,\n collapsed: true,\n helpText: 'Configure the request payload',\n getGroupValueCount: (formData: any) => {\n return !!(\n formData.body &&\n formData.body.trim() !== '' &&\n formData.body !== defaultPost\n );\n }\n }\n ],\n toFormData: (action: CallWebhook) => {\n return {\n uuid: action.uuid,\n url: action.url || '',\n method: [{ value: action.method, name: action.method }],\n headers: action.headers || [],\n body: action.body || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n return {\n uuid: data.uuid,\n type: 'call_webhook',\n url: data.url,\n method: data.method[0].value,\n headers: data.headers || [],\n body: data.body || ''\n } as CallWebhook;\n }\n};\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const enter_flow = {
|
|
4
|
-
name: 'Enter a Flow',
|
|
5
|
-
color: COLORS.execute,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div
|
|
8
|
-
style="word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
|
|
9
|
-
>
|
|
10
|
-
Enter <b>${action.flow.name}</b>
|
|
11
|
-
</div>`;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=enter_flow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enter_flow.js","sourceRoot":"","sources":["../../../../src/flow/actions/enter_flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAiB,EAAE,EAAE;QACzC,OAAO,IAAI,CAAA;;;iBAGE,MAAM,CAAC,IAAI,CAAC,IAAI;WACtB,CAAC;IACV,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, EnterFlow } from '../../store/flow-definition';\n\nexport const enter_flow: ActionConfig = {\n name: 'Enter a Flow',\n color: COLORS.execute,\n render: (_node: Node, action: EnterFlow) => {\n return html`<div\n style=\"word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;\"\n >\n Enter <b>${action.flow.name}</b>\n </div>`;\n }\n};\n"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-html';
|
|
2
|
-
import { COLORS } from '../types';
|
|
3
|
-
export const open_ticket = {
|
|
4
|
-
name: 'Open Ticket',
|
|
5
|
-
color: COLORS.create,
|
|
6
|
-
render: (_node, action) => {
|
|
7
|
-
return html `<div>${action.topic.name}</div>`;
|
|
8
|
-
},
|
|
9
|
-
form: {
|
|
10
|
-
topic: {
|
|
11
|
-
type: 'select',
|
|
12
|
-
required: true,
|
|
13
|
-
placeholder: 'Select a topic',
|
|
14
|
-
options: [],
|
|
15
|
-
endpoint: '/api/v2/topics.json',
|
|
16
|
-
valueKey: 'uuid',
|
|
17
|
-
nameKey: 'name',
|
|
18
|
-
maxWidth: '200px'
|
|
19
|
-
},
|
|
20
|
-
assignee: {
|
|
21
|
-
type: 'select',
|
|
22
|
-
required: false,
|
|
23
|
-
placeholder: 'Select an agent (optional)',
|
|
24
|
-
options: [],
|
|
25
|
-
endpoint: '/api/v2/users.json',
|
|
26
|
-
valueKey: 'uuid',
|
|
27
|
-
getName: (item) => {
|
|
28
|
-
return item.name || [item.first_name, item.last_name].join(' ');
|
|
29
|
-
},
|
|
30
|
-
clearable: true
|
|
31
|
-
},
|
|
32
|
-
note: {
|
|
33
|
-
type: 'textarea',
|
|
34
|
-
required: false,
|
|
35
|
-
placeholder: 'Enter a note for the ticket (optional)',
|
|
36
|
-
minHeight: 100
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],
|
|
40
|
-
toFormData: (action) => {
|
|
41
|
-
return {
|
|
42
|
-
uuid: action.uuid,
|
|
43
|
-
topic: action.topic
|
|
44
|
-
? [{ uuid: action.topic.uuid, name: action.topic.name }]
|
|
45
|
-
: [],
|
|
46
|
-
assignee: action.assignee
|
|
47
|
-
? [{ uuid: action.assignee.uuid, name: action.assignee.name }]
|
|
48
|
-
: [],
|
|
49
|
-
note: action.note || ''
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
fromFormData: (data) => {
|
|
53
|
-
return {
|
|
54
|
-
uuid: data.uuid,
|
|
55
|
-
type: 'open_ticket',
|
|
56
|
-
topic: data.topic && data.topic.length > 0
|
|
57
|
-
? {
|
|
58
|
-
uuid: data.topic[0].uuid,
|
|
59
|
-
name: data.topic[0].name
|
|
60
|
-
}
|
|
61
|
-
: undefined,
|
|
62
|
-
assignee: data.assignee && data.assignee.length > 0
|
|
63
|
-
? {
|
|
64
|
-
uuid: data.assignee[0].uuid,
|
|
65
|
-
name: data.assignee[0].name ||
|
|
66
|
-
[data.assignee[0].first_name, data.assignee[0].last_name].join(' ')
|
|
67
|
-
}
|
|
68
|
-
: undefined,
|
|
69
|
-
note: data.note || ''
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=open_ticket.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open_ticket.js","sourceRoot":"","sources":["../../../../src/flow/actions/open_ticket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OA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5D,GAAG,CACJ;iBACJ;gBACH,CAAC,CAAC,SAAS;YACf,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;SACR,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, OpenTicket } from '../../store/flow-definition';\n\nexport const open_ticket: ActionConfig = {\n name: 'Open Ticket',\n color: COLORS.create,\n render: (_node: Node, action: OpenTicket) => {\n return html`<div>${action.topic.name}</div>`;\n },\n form: {\n topic: {\n type: 'select',\n required: true,\n placeholder: 'Select a topic',\n options: [],\n endpoint: '/api/v2/topics.json',\n valueKey: 'uuid',\n nameKey: 'name',\n maxWidth: '200px'\n },\n assignee: {\n type: 'select',\n required: false,\n placeholder: 'Select an agent (optional)',\n options: [],\n endpoint: '/api/v2/users.json',\n valueKey: 'uuid',\n getName: (item: {\n first_name?: string;\n last_name?: string;\n name?: string;\n }) => {\n return item.name || [item.first_name, item.last_name].join(' ');\n },\n clearable: true\n },\n note: {\n type: 'textarea',\n required: false,\n placeholder: 'Enter a note for the ticket (optional)',\n minHeight: 100\n }\n },\n layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],\n toFormData: (action: OpenTicket) => {\n return {\n uuid: action.uuid,\n topic: action.topic\n ? [{ uuid: action.topic.uuid, name: action.topic.name }]\n : [],\n assignee: action.assignee\n ? [{ uuid: action.assignee.uuid, name: action.assignee.name }]\n : [],\n note: action.note || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n return {\n uuid: data.uuid,\n type: 'open_ticket',\n topic:\n data.topic && data.topic.length > 0\n ? {\n uuid: data.topic[0].uuid,\n name: data.topic[0].name\n }\n : undefined,\n assignee:\n data.assignee && data.assignee.length > 0\n ? {\n uuid: data.assignee[0].uuid,\n name:\n data.assignee[0].name ||\n [data.assignee[0].first_name, data.assignee[0].last_name].join(\n ' '\n )\n }\n : undefined,\n note: data.note || ''\n } as OpenTicket;\n }\n};\n"]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { RapidElement } from '../RapidElement';
|
|
3
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
-
/**
|
|
5
|
-
* FormElement is a component that appends a hidden input (outside of
|
|
6
|
-
* its own shadow) with its value to be included in forms.
|
|
7
|
-
*/
|
|
8
|
-
export class FormElement extends RapidElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.name = '';
|
|
12
|
-
this.value = null;
|
|
13
|
-
this.inputRoot = this;
|
|
14
|
-
this.disabled = false;
|
|
15
|
-
this.internals = this.attachInternals();
|
|
16
|
-
}
|
|
17
|
-
updated(changedProperties) {
|
|
18
|
-
super.updated(changedProperties);
|
|
19
|
-
if (changedProperties.has('value')) {
|
|
20
|
-
this.internals.setFormValue(this.value);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
get form() {
|
|
24
|
-
return this.internals.form;
|
|
25
|
-
}
|
|
26
|
-
setValue(value) {
|
|
27
|
-
this.value = this.serializeValue(value);
|
|
28
|
-
}
|
|
29
|
-
getDeserializedValue() {
|
|
30
|
-
return JSON.parse(this.value);
|
|
31
|
-
}
|
|
32
|
-
serializeValue(value) {
|
|
33
|
-
return JSON.stringify(value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
FormElement.formAssociated = true;
|
|
37
|
-
__decorate([
|
|
38
|
-
property({ type: String })
|
|
39
|
-
], FormElement.prototype, "name", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
property({ type: String, attribute: 'help_text' })
|
|
42
|
-
], FormElement.prototype, "helpText", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
property({ type: Boolean, attribute: 'help_always' })
|
|
45
|
-
], FormElement.prototype, "helpAlways", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
property({ type: Boolean, attribute: 'widget_only' })
|
|
48
|
-
], FormElement.prototype, "widgetOnly", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
property({ type: Boolean, attribute: 'hide_label' })
|
|
51
|
-
], FormElement.prototype, "hideLabel", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
property({ type: String })
|
|
54
|
-
], FormElement.prototype, "label", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
property({ type: Array })
|
|
57
|
-
], FormElement.prototype, "errors", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
property({ type: String })
|
|
60
|
-
], FormElement.prototype, "value", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
property({ attribute: false })
|
|
63
|
-
], FormElement.prototype, "inputRoot", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
property({ type: Boolean })
|
|
66
|
-
], FormElement.prototype, "disabled", void 0);
|
|
67
|
-
//# sourceMappingURL=FormElement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormElement.js","sourceRoot":"","sources":["../../../src/form/FormElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAkC3C;QACE,KAAK,EAAE,CAAC;QAjCV,SAAI,GAAG,EAAE,CAAC;QAqBV,UAAK,GAAG,IAAI,CAAC;QAGb,cAAS,GAAgB,IAAI,CAAC;QAG9B,aAAQ,GAAG,KAAK,CAAC;QAOf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;IAEM,OAAO,CAAC,iBAAmC;QAChD,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACjC,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC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it/decorators.js';\n\n/**\n * FormElement is a component that appends a hidden input (outside of\n * its own shadow) with its value to be included in forms.\n */\nexport class FormElement extends RapidElement {\n @property({ type: String })\n name = '';\n\n @property({ type: String, attribute: 'help_text' })\n helpText: string;\n\n @property({ type: Boolean, attribute: 'help_always' })\n helpAlways: boolean;\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly: boolean;\n\n @property({ type: Boolean, attribute: 'hide_label' })\n hideLabel: boolean;\n\n @property({ type: String })\n label: string;\n\n @property({ type: Array })\n errors: string[];\n\n @property({ type: String })\n value = null;\n\n @property({ attribute: false })\n inputRoot: HTMLElement = this;\n\n @property({ type: Boolean })\n disabled = false;\n static formAssociated = true;\n\n protected internals: ElementInternals;\n\n constructor() {\n super();\n this.internals = this.attachInternals();\n }\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n if (changedProperties.has('value')) {\n this.internals.setFormValue(this.value);\n }\n }\n\n get form() {\n return this.internals.form;\n }\n\n public setValue(value: any) {\n this.value = this.serializeValue(value);\n }\n\n public getDeserializedValue(): any {\n return JSON.parse(this.value);\n }\n\n public serializeValue(value: any): string {\n return JSON.stringify(value);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/form/FormField.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QAkJE,cAAS,GAAG,KAAK,CAAC;QAGlB,eAAU,GAAG,KAAK,CAAC;QAGnB,WAAM,GAAa,EAAE,CAAC;QAGtB,eAAU,GAAG,KAAK,CAAC;QAGnB,aAAQ,GAAG,EAAE,CA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,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6CACpC;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAChB;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACX","sourcesContent":["import { TemplateResult, html, css, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { renderMarkdownInline } from '../markdown';\n\n/**\n * A small wrapper to display labels and help text in a smartmin style.\n * This exists so we can display things consistently before restyling.\n */\nexport class FormField extends LitElement {\n static get styles() {\n return css`\n :host {\n font-family: var(--font-family);\n }\n\n label {\n margin-bottom: 5px;\n margin-left: 4px;\n display: block;\n font-weight: 400;\n font-size: var(--label-size);\n letter-spacing: 0.05em;\n line-height: normal;\n color: var(--color-label, #777);\n }\n\n .help-text {\n font-size: var(--help-text-size);\n line-height: normal;\n color: var(--color-text-help);\n margin-left: var(--help-text-margin-left);\n margin-top: -16px;\n opacity: 0;\n transition: opacity ease-in-out 100ms, margin-top ease-in-out 200ms;\n pointer-events: none;\n }\n\n .help-text.help-always {\n opacity: 1;\n margin-top: 6px;\n margin-left: var(--help-text-margin-left);\n }\n\n .field:focus-within .help-text {\n margin-top: 6px;\n opacity: 1;\n }\n\n .alert-error {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 1000;\n background: white;\n border: 1px solid var(--color-error);\n color: var(--color-error);\n padding: 8px 12px;\n margin: 2px 0 0 0;\n border-radius: var(--curvature);\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),\n 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n font-size: 0.85em;\n line-height: 1.2;\n opacity: 0;\n visibility: hidden;\n transform: translateY(-12px);\n transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,\n transform 0.2s ease-in-out;\n }\n\n .field:hover .alert-error {\n opacity: 1;\n visibility: visible;\n transform: translateY(2px);\n }\n\n /* Hide error popup when widget is focused */\n .field:focus-within .alert-error {\n opacity: 0;\n visibility: hidden;\n transform: translateY(-4px);\n }\n\n .field.has-error {\n position: relative;\n /* Set CSS custom properties that form components can use */\n --color-widget-border: var(--color-error);\n --widget-box-shadow-focused: var(\n --widget-box-shadow-focused-error,\n 0 0 0 3px rgba(255, 99, 71, 0.3)\n );\n --color-focus: var(--color-error);\n }\n\n .field.has-error .widget {\n border-radius: var(--curvature-widget);\n position: relative;\n }\n\n /* Force error styling with higher specificity */\n :host(.has-error) .field.has-error .widget .input-container,\n :host(.has-error) .field.has-error .widget .select-container,\n :host(.has-error) .field.has-error .widget .comp-container,\n :host(.has-error) .field.has-error .widget .checkbox-container,\n :host(.has-error) .field.has-error .widget .container,\n :host(.has-error) .field.has-error .widget .range-container,\n .field.has-error .widget .input-container,\n .field.has-error .widget .select-container,\n .field.has-error .widget .comp-container,\n .field.has-error .widget .checkbox-container,\n .field.has-error .widget .container,\n .field.has-error .widget .range-container {\n border-color: var(--color-error) !important;\n }\n\n /* When error field is focused, use error-colored focus ring */\n :host(.has-error) .field.has-error .widget .input-container:focus-within,\n :host(.has-error) .field.has-error .widget .select-container:focus-within,\n :host(.has-error) .field.has-error .widget .select-container.focused,\n :host(.has-error) .field.has-error .widget .comp-container:focus-within,\n :host(.has-error)\n .field.has-error\n .widget\n .checkbox-container:focus-within,\n :host(.has-error) .field.has-error .widget .container:focus-within,\n :host(.has-error) .field.has-error .widget .range-container:focus-within,\n .field.has-error .widget .input-container:focus-within,\n .field.has-error .widget .select-container:focus-within,\n .field.has-error .widget .select-container.focused,\n .field.has-error .widget .comp-container:focus-within,\n .field.has-error .widget .checkbox-container:focus-within,\n .field.has-error .widget .container:focus-within,\n .field.has-error .widget .range-container:focus-within {\n border-color: var(--color-error) !important;\n box-shadow: var(\n --widget-box-shadow-focused-error,\n 0 0 0 3px rgba(255, 99, 71, 0.3)\n ) !important;\n }\n\n .alert-error p {\n margin: 0;\n padding: 0;\n }\n\n .disabled {\n opacity: var(--disabled-opacity) !important;\n pointer-events: none !important;\n }\n `;\n }\n\n @property({ type: Boolean, attribute: 'hide_label' })\n hideLabel = false;\n\n @property({ type: Boolean, attribute: 'widget_only' })\n widgetOnly = false;\n\n @property({ type: Array, attribute: false })\n errors: string[] = [];\n\n @property({ type: Boolean })\n hideErrors = false;\n\n @property({ type: String, attribute: 'help_text' })\n helpText = '';\n\n @property({ type: Boolean, attribute: 'help_always' })\n helpAlways = true;\n\n @property({ type: String })\n label = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: Boolean })\n disabled = false;\n\n updated(changedProperties: Map<string | number | symbol, unknown>): void {\n super.updated(changedProperties);\n\n if (\n changedProperties.has('errors') ||\n changedProperties.has('hideErrors')\n ) {\n const hasErrors =\n !this.hideErrors && this.errors && this.errors.length > 0;\n this.classList.toggle('has-error', hasErrors);\n }\n }\n\n public render(): TemplateResult {\n const hasErrors = !this.hideErrors && this.errors && this.errors.length > 0;\n const errors = hasErrors\n ? this.errors.map((error: string) => {\n return html`\n <div class=\"alert-error\">${renderMarkdownInline(error)}</div>\n `;\n })\n : [];\n\n if (this.widgetOnly) {\n return html`\n <div class=\"${this.disabled ? 'disabled' : ''}\"><slot></slot></div>\n ${errors}\n `;\n }\n\n return html`\n <div\n class=\"field ${this.disabled ? 'disabled' : ''} ${hasErrors\n ? 'has-error'\n : ''}\"\n >\n ${!!this.name && !this.hideLabel && !!this.label\n ? html`\n <label class=\"control-label\" for=\"${this.name}\"\n >${this.label}</label\n >\n `\n : null}\n <div class=\"widget\">\n <slot></slot>\n ${errors}\n </div>\n ${this.helpText && this.helpText !== 'None'\n ? html`\n <div class=\"help-text ${this.helpAlways ? 'help-always' : null}\">\n ${renderMarkdownInline(this.helpText)}\n </div>\n `\n : null}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import { call_llm } from '../../src/flow/actions/call_llm';
|
|
3
|
-
import { ActionTest } from '../ActionHelper';
|
|
4
|
-
/**
|
|
5
|
-
* Test suite for the call_llm action configuration.
|
|
6
|
-
*/
|
|
7
|
-
describe('call_llm action config', () => {
|
|
8
|
-
const helper = new ActionTest(call_llm, 'call_llm');
|
|
9
|
-
describe('basic properties', () => {
|
|
10
|
-
helper.testBasicProperties();
|
|
11
|
-
it('has correct name', () => {
|
|
12
|
-
expect(call_llm.name).to.equal('Call AI');
|
|
13
|
-
});
|
|
14
|
-
it('has form configuration', () => {
|
|
15
|
-
expect(call_llm.form).to.exist;
|
|
16
|
-
expect(call_llm.form.llm).to.exist;
|
|
17
|
-
expect(call_llm.form.instructions).to.exist;
|
|
18
|
-
expect(call_llm.form.input).to.exist;
|
|
19
|
-
});
|
|
20
|
-
it('has layout configuration', () => {
|
|
21
|
-
expect(call_llm.layout).to.exist;
|
|
22
|
-
expect(call_llm.layout).to.deep.equal(['llm', 'input', 'instructions']);
|
|
23
|
-
});
|
|
24
|
-
it('has data transformation functions', () => {
|
|
25
|
-
expect(call_llm.toFormData).to.be.a('function');
|
|
26
|
-
expect(call_llm.fromFormData).to.be.a('function');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe('data transformations', () => {
|
|
30
|
-
it('converts action to form data correctly', () => {
|
|
31
|
-
const action = {
|
|
32
|
-
uuid: 'test-llm-1',
|
|
33
|
-
type: 'call_llm',
|
|
34
|
-
input: '@input',
|
|
35
|
-
llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
|
|
36
|
-
instructions: 'Translate to French',
|
|
37
|
-
result_name: 'translated_text'
|
|
38
|
-
};
|
|
39
|
-
const formData = call_llm.toFormData(action);
|
|
40
|
-
expect(formData.uuid).to.equal('test-llm-1');
|
|
41
|
-
expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);
|
|
42
|
-
expect(formData.instructions).to.equal('Translate to French');
|
|
43
|
-
expect(formData.input).to.equal('@input');
|
|
44
|
-
});
|
|
45
|
-
it('converts form data to action correctly', () => {
|
|
46
|
-
const formData = {
|
|
47
|
-
uuid: 'test-llm-2',
|
|
48
|
-
llm: [{ value: 'gpt-5', name: 'GPT 5' }],
|
|
49
|
-
instructions: 'Summarize the following text',
|
|
50
|
-
input: '@input'
|
|
51
|
-
};
|
|
52
|
-
const action = call_llm.fromFormData(formData);
|
|
53
|
-
expect(action.uuid).to.equal('test-llm-2');
|
|
54
|
-
expect(action.type).to.equal('call_llm');
|
|
55
|
-
expect(action.llm).to.deep.equal({ uuid: 'gpt-5', name: 'GPT 5' });
|
|
56
|
-
expect(action.instructions).to.equal('Summarize the following text');
|
|
57
|
-
expect(action.input).to.equal('@input');
|
|
58
|
-
});
|
|
59
|
-
it('handles empty form data', () => {
|
|
60
|
-
const formData = {
|
|
61
|
-
uuid: 'test-llm-3',
|
|
62
|
-
llm: [],
|
|
63
|
-
instructions: '',
|
|
64
|
-
input: ''
|
|
65
|
-
};
|
|
66
|
-
const action = call_llm.fromFormData(formData);
|
|
67
|
-
expect(action.llm).to.deep.equal({ uuid: '', name: '' });
|
|
68
|
-
expect(action.instructions).to.equal('');
|
|
69
|
-
expect(action.input).to.equal('@input');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe('action scenarios', () => {
|
|
73
|
-
helper.testAction({
|
|
74
|
-
uuid: 'test-action-1',
|
|
75
|
-
type: 'call_llm',
|
|
76
|
-
llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
|
|
77
|
-
instructions: 'Translate to French',
|
|
78
|
-
input: '@input'
|
|
79
|
-
}, 'translation-task');
|
|
80
|
-
helper.testAction({
|
|
81
|
-
uuid: 'test-action-2',
|
|
82
|
-
type: 'call_llm',
|
|
83
|
-
llm: { uuid: 'gpt-5', name: 'GPT 5' },
|
|
84
|
-
instructions: 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.',
|
|
85
|
-
input: '@input'
|
|
86
|
-
}, 'sentiment-analysis');
|
|
87
|
-
helper.testAction({
|
|
88
|
-
uuid: 'test-action-3',
|
|
89
|
-
type: 'call_llm',
|
|
90
|
-
llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
|
|
91
|
-
instructions: 'Summarize the key points from the conversation above in bullet format.',
|
|
92
|
-
input: '@input'
|
|
93
|
-
}, 'summarization');
|
|
94
|
-
helper.testAction({
|
|
95
|
-
uuid: 'test-action-4',
|
|
96
|
-
type: 'call_llm',
|
|
97
|
-
llm: { uuid: 'gpt-5', name: 'GPT 5' },
|
|
98
|
-
instructions: 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.',
|
|
99
|
-
input: '@input'
|
|
100
|
-
}, 'information-extraction');
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
//# sourceMappingURL=call_llm.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_llm.test.js","sourceRoot":"","sources":["../../../test/actions/call_llm.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAEpD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAE7B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YA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IAAI,EAAE,OAAO,EAAE;YACrC,YAAY,EACV,wJAAwJ;YAC1J,KAAK,EAAE,QAAQ;SACL,EACZ,oBAAoB,CACrB,CAAC;QAEF,MAAM,CAAC,UAAU,CACf;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YACvC,YAAY,EACV,wEAAwE;YAC1E,KAAK,EAAE,QAAQ;SACL,EACZ,eAAe,CAChB,CAAC;QAEF,MAAM,CAAC,UAAU,CACf;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;YACrC,YAAY,EACV,kHAAkH;YACpH,KAAK,EAAE,QAAQ;SACL,EACZ,wBAAwB,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { call_llm } from '../../src/flow/actions/call_llm';\nimport { CallLLM } from '../../src/store/flow-definition';\nimport { ActionTest } from '../ActionHelper';\n\n/**\n * Test suite for the call_llm action configuration.\n */\ndescribe('call_llm action config', () => {\n const helper = new ActionTest(call_llm, 'call_llm');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(call_llm.name).to.equal('Call AI');\n });\n\n it('has form configuration', () => {\n expect(call_llm.form).to.exist;\n expect(call_llm.form.llm).to.exist;\n expect(call_llm.form.instructions).to.exist;\n expect(call_llm.form.input).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(call_llm.layout).to.exist;\n expect(call_llm.layout).to.deep.equal(['llm', 'input', 'instructions']);\n });\n\n it('has data transformation functions', () => {\n expect(call_llm.toFormData).to.be.a('function');\n expect(call_llm.fromFormData).to.be.a('function');\n });\n });\n\n describe('data transformations', () => {\n it('converts action to form data correctly', () => {\n const action: CallLLM = {\n uuid: 'test-llm-1',\n type: 'call_llm',\n input: '@input',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions: 'Translate to French',\n result_name: 'translated_text'\n };\n\n const formData = call_llm.toFormData(action);\n\n expect(formData.uuid).to.equal('test-llm-1');\n expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);\n expect(formData.instructions).to.equal('Translate to French');\n expect(formData.input).to.equal('@input');\n });\n\n it('converts form data to action correctly', () => {\n const formData = {\n uuid: 'test-llm-2',\n llm: [{ value: 'gpt-5', name: 'GPT 5' }],\n instructions: 'Summarize the following text',\n input: '@input'\n };\n\n const action = call_llm.fromFormData(formData) as CallLLM;\n\n expect(action.uuid).to.equal('test-llm-2');\n expect(action.type).to.equal('call_llm');\n expect(action.llm).to.deep.equal({ uuid: 'gpt-5', name: 'GPT 5' });\n expect(action.instructions).to.equal('Summarize the following text');\n expect(action.input).to.equal('@input');\n });\n\n it('handles empty form data', () => {\n const formData = {\n uuid: 'test-llm-3',\n llm: [],\n instructions: '',\n input: ''\n };\n\n const action = call_llm.fromFormData(formData) as CallLLM;\n\n expect(action.llm).to.deep.equal({ uuid: '', name: '' });\n expect(action.instructions).to.equal('');\n expect(action.input).to.equal('@input');\n });\n });\n\n describe('action scenarios', () => {\n helper.testAction(\n {\n uuid: 'test-action-1',\n type: 'call_llm',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions: 'Translate to French',\n input: '@input'\n } as CallLLM,\n 'translation-task'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-2',\n type: 'call_llm',\n llm: { uuid: 'gpt-5', name: 'GPT 5' },\n instructions:\n 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.',\n input: '@input'\n } as CallLLM,\n 'sentiment-analysis'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-3',\n type: 'call_llm',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions:\n 'Summarize the key points from the conversation above in bullet format.',\n input: '@input'\n } as CallLLM,\n 'summarization'\n );\n\n helper.testAction(\n {\n uuid: 'test-action-4',\n type: 'call_llm',\n llm: { uuid: 'gpt-5', name: 'GPT 5' },\n instructions:\n 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.',\n input: '@input'\n } as CallLLM,\n 'information-extraction'\n );\n });\n});\n"]}
|