@fudanda/workflow 0.0.0-stage → 2.20261024.1-beta.1
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/LICENSE +21 -0
- package/README.md +114 -3
- package/THIRD-PARTY-NOTICES.md +57 -0
- package/dist/ai-markdown-esl-I5ck.js +7 -0
- package/dist/chrome.d.ts +11 -0
- package/dist/chrome.js +358 -0
- package/dist/core.d.ts +11 -0
- package/dist/core.js +3 -0
- package/dist/coze/compat/base.d.ts +116 -0
- package/dist/coze/control-icon.d.ts +15 -0
- package/dist/coze/execution-panel.d.ts +8 -0
- package/dist/coze/schema-tree.d.ts +9 -0
- package/dist/coze/side-panel.d.ts +12 -0
- package/dist/coze/source/form-extensions/components/output-tree/components/custom-tree-node/constants.d.ts +13 -0
- package/dist/coze/source/form-extensions/components/output-tree/components/custom-tree-node/type.d.ts +34 -0
- package/dist/coze/start-form.d.ts +9 -0
- package/dist/coze/test-input.d.ts +9 -0
- package/dist/coze/test-run-button.d.ts +4 -0
- package/dist/coze/workflow-header.d.ts +5 -0
- package/dist/designer.d.ts +2 -0
- package/dist/flowgram-designer.d.ts +63 -0
- package/dist/graph-scope.d.ts +78 -0
- package/dist/header-shortcuts-BQZuNfpA.js +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8694 -0
- package/dist/input-fields.d.ts +4 -0
- package/dist/observation-types.d.ts +6 -0
- package/dist/panel-focus.d.ts +3 -0
- package/dist/prompt-kit.d.ts +47 -0
- package/dist/result-preview.d.ts +5 -0
- package/dist/schema-tree-CTM6hEdm.js +309 -0
- package/dist/start-form-L6xw9phk.js +9330 -0
- package/dist/styles.css +2 -0
- package/dist/templates.d.ts +1 -0
- package/dist/test-input-validation-CkORPCfm.js +55 -0
- package/dist/test-input-validation.d.ts +11 -0
- package/dist/theme.d.ts +17 -0
- package/package.json +103 -4
- package/vendor/coze/LICENSE-APACHE +177 -0
- package/vendor/coze/UPSTREAM.json +2247 -0
- package/vendor/coze/original/base-test-button.tsx +22 -0
- package/vendor/coze/original/comment-container.tsx +68 -0
- package/vendor/coze/original/condition-container.tsx +60 -0
- package/vendor/coze/original/condition-tag.tsx +58 -0
- package/vendor/coze/original/coze-global.less +234 -0
- package/vendor/coze/original/create-loop-function-json.ts +134 -0
- package/vendor/coze/original/create-loop-function.ts +56 -0
- package/vendor/coze/original/end-registry.ts +41 -0
- package/vendor/coze/original/execute-result-panel.less +97 -0
- package/vendor/coze/original/execute-result-panel.tsx +171 -0
- package/vendor/coze/original/form-item.less +39 -0
- package/vendor/coze/original/form-item.tsx +200 -0
- package/vendor/coze/original/http-api-field.tsx +42 -0
- package/vendor/coze/original/http-form-render.tsx +102 -0
- package/vendor/coze/original/icon-add.svg +3 -0
- package/vendor/coze/original/icon-arrow-left.svg +3 -0
- package/vendor/coze/original/icon-auto-layout.svg +18 -0
- package/vendor/coze/original/icon-batch.jpg +0 -0
- package/vendor/coze/original/icon-break.jpg +0 -0
- package/vendor/coze/original/icon-code.svg +13 -0
- package/vendor/coze/original/icon-condition.jpg +0 -0
- package/vendor/coze/original/icon-condition.svg +12 -0
- package/vendor/coze/original/icon-continue.jpg +0 -0
- package/vendor/coze/original/icon-database-query.jpg +0 -0
- package/vendor/coze/original/icon-database-update.jpg +0 -0
- package/vendor/coze/original/icon-database.svg +18 -0
- package/vendor/coze/original/icon-delete.svg +5 -0
- package/vendor/coze/original/icon-end.jpg +0 -0
- package/vendor/coze/original/icon-fullscreen.svg +9 -0
- package/vendor/coze/original/icon-http.jpg +0 -0
- package/vendor/coze/original/icon-intent.jpg +0 -0
- package/vendor/coze/original/icon-json-parser.jpg +0 -0
- package/vendor/coze/original/icon-json-stringify.jpg +0 -0
- package/vendor/coze/original/icon-llm.jpg +0 -0
- package/vendor/coze/original/icon-loop.jpg +0 -0
- package/vendor/coze/original/icon-more.svg +11 -0
- package/vendor/coze/original/icon-play-round-outlined.svg +8 -0
- package/vendor/coze/original/icon-plugin-tool.svg +6 -0
- package/vendor/coze/original/icon-standard-copy.svg +8 -0
- package/vendor/coze/original/icon-start.jpg +0 -0
- package/vendor/coze/original/icon-text.jpg +0 -0
- package/vendor/coze/original/icon-unknown.svg +7 -0
- package/vendor/coze/original/icon-var.svg +6 -0
- package/vendor/coze/original/icon-variable-assign.jpg +0 -0
- package/vendor/coze/original/icon-variable-merge.jpg +0 -0
- package/vendor/coze/original/icon-workflow-end.svg +5 -0
- package/vendor/coze/original/icon-workflow-start.svg +5 -0
- package/vendor/coze/original/icon-workflow.jpg +0 -0
- package/vendor/coze/original/icon-workflow.svg +21 -0
- package/vendor/coze/original/icon-workflows.svg +5 -0
- package/vendor/coze/original/if-form-meta.tsx +88 -0
- package/vendor/coze/original/logic-display.tsx +33 -0
- package/vendor/coze/original/mouse-icon.tsx +35 -0
- package/vendor/coze/original/mouse-pad-selector.tsx +180 -0
- package/vendor/coze/original/node-card.tsx +77 -0
- package/vendor/coze/original/node-category-panel.less +4 -0
- package/vendor/coze/original/node-category-panel.tsx +53 -0
- package/vendor/coze/original/node-config-form.tsx +67 -0
- package/vendor/coze/original/node-header.less +165 -0
- package/vendor/coze/original/node-header.tsx +552 -0
- package/vendor/coze/original/node-panel.less +183 -0
- package/vendor/coze/original/node-render.less +20 -0
- package/vendor/coze/original/node-side-sheet.less +57 -0
- package/vendor/coze/original/node-side-sheet.tsx +214 -0
- package/vendor/coze/original/node-wrapper.tsx +71 -0
- package/vendor/coze/original/pad-icon.tsx +45 -0
- package/vendor/coze/original/resizable-side-panel-constants.ts +18 -0
- package/vendor/coze/original/resizable-side-panel.tsx +42 -0
- package/vendor/coze/original/start-registry.ts +53 -0
- package/vendor/coze/original/sub-canvas-background.less +4 -0
- package/vendor/coze/original/sub-canvas-background.tsx +48 -0
- package/vendor/coze/original/sub-canvas-container.less +16 -0
- package/vendor/coze/original/sub-canvas-container.tsx +97 -0
- package/vendor/coze/original/sub-canvas-header.less +75 -0
- package/vendor/coze/original/sub-canvas-header.tsx +95 -0
- package/vendor/coze/original/test-form-sheet-header.tsx +82 -0
- package/vendor/coze/original/test-form-sheet.less +178 -0
- package/vendor/coze/original/toolbar-add-node.tsx +68 -0
- package/vendor/coze/original/toolbar-auto-layout.tsx +61 -0
- package/vendor/coze/original/toolbar-comment.tsx +121 -0
- package/vendor/coze/original/toolbar-container.tsx +42 -0
- package/vendor/coze/original/toolbar-interactive.tsx +98 -0
- package/vendor/coze/original/toolbar-minimap-switch.tsx +41 -0
- package/vendor/coze/original/toolbar-tools.less +46 -0
- package/vendor/coze/original/toolbar-tools.tsx +89 -0
- package/vendor/coze/original/toolbar-zoom.tsx +134 -0
- package/vendor/coze/original/tree-variable-selector.less +292 -0
- package/vendor/coze/original/tree-variable-selector.tsx +298 -0
- package/vendor/coze/original/workflow-document-custom-options.ts +151 -0
- package/vendor/coze/original/workflow-header.less +65 -0
- package/vendor/coze/original/workflow-header.tsx +85 -0
- package/vendor/coze/source/agent-models/model-option/index.module.less +19 -0
- package/vendor/coze/source/agent-models/model-option/index.tsx +321 -0
- package/vendor/coze/source/agent-models/model-option-avatar/index.tsx +175 -0
- package/vendor/coze/source/agent-models/model-option-group/index.tsx +87 -0
- package/vendor/coze/source/agent-models/model-option-thumb/index.tsx +41 -0
- package/vendor/coze/source/agent-models/model-select-ui/index.tsx +238 -0
- package/vendor/coze/source/agent-models/popover-model-list-view/index.tsx +146 -0
- package/vendor/coze/source/components/code-editor/text-editor.tsx +71 -0
- package/vendor/coze/source/components/comment/components/editor/block.tsx +117 -0
- package/vendor/coze/source/components/comment/components/editor/leaf.tsx +64 -0
- package/vendor/coze/source/components/comment/components/toolbar.tsx +366 -0
- package/vendor/coze/source/components/comment/constant.ts +94 -0
- package/vendor/coze/source/components/editor-container/expand-editor/index.module.less +107 -0
- package/vendor/coze/source/components/editor-container/expand-editor/index.tsx +117 -0
- package/vendor/coze/source/components/model-select/components/model-setting.tsx +300 -0
- package/vendor/coze/source/components/model-select/components/settings.tsx +144 -0
- package/vendor/coze/source/components/model-select/index.module.less +34 -0
- package/vendor/coze/source/components/model-select/utils/index.tsx +100 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/constants.tsx +79 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/field-empty.module.less +12 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/field-empty.tsx +37 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/field.module.less +19 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/field.tsx +52 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/http-api-field/index.tsx +42 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/overflow-tag-list.module.less +47 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/overflow-tag-list.tsx +162 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/variable-tag-list.module.less +48 -0
- package/vendor/coze/source/components/node-render/node-render-new/fields/variable-tag-list.tsx +126 -0
- package/vendor/coze/source/components/node-wrapper/execute-result-panel/index.module.less +97 -0
- package/vendor/coze/source/components/node-wrapper/execute-result-panel/index.tsx +171 -0
- package/vendor/coze/source/components/sub-canvas/components/background/index.module.less +4 -0
- package/vendor/coze/source/components/sub-canvas/components/header/index.module.less +75 -0
- package/vendor/coze/source/components/test-run/test-run-button/single-node.tsx +158 -0
- package/vendor/coze/source/execution-panel/panel.module.less +48 -0
- package/vendor/coze/source/execution-panel/panel.tsx +99 -0
- package/vendor/coze/source/execution-panel/use-resize.ts +79 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/constants.ts +28 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/context/context.ts +21 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/context/create-store.ts +48 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/context/index.ts +19 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/context/provider.tsx +50 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/data-viewer.module.less +26 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/data-viewer.tsx +79 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/hooks/index.ts +18 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/hooks/use-data-viewer-store.ts +29 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/hooks/use-expand.ts +35 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/hooks/use-value.tsx +66 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/index.tsx +21 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/json-field/index.tsx +186 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/json-field/json-field.module.less +79 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/types.ts +50 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/utils/big-number.ts +35 -0
- package/vendor/coze/source/external/features/log/components/data-viewer/utils/generate-field.ts +104 -0
- package/vendor/coze/source/external/features/log/components/log-parser/log-wrap.module.less +27 -0
- package/vendor/coze/source/external/features/log/components/log-parser/log-wrap.tsx +109 -0
- package/vendor/coze/source/external/features/log/components/node-status-bar/node-status-bar.module.less +52 -0
- package/vendor/coze/source/external/features/log/components/node-status-bar/node-status-bar.tsx +113 -0
- package/vendor/coze/source/form/components/field-empty.tsx +45 -0
- package/vendor/coze/source/form/components/section.tsx +91 -0
- package/vendor/coze/source/form-extensions/components/add-item-button/index.tsx +64 -0
- package/vendor/coze/source/form-extensions/components/form-card/index.module.less +131 -0
- package/vendor/coze/source/form-extensions/components/form-card/index.tsx +309 -0
- package/vendor/coze/source/form-extensions/components/form-item/index.module.less +39 -0
- package/vendor/coze/source/form-extensions/components/form-item/index.tsx +200 -0
- package/vendor/coze/source/form-extensions/components/form-item-feedback/index.module.less +7 -0
- package/vendor/coze/source/form-extensions/components/form-item-feedback/index.tsx +39 -0
- package/vendor/coze/source/form-extensions/components/level-line/index.module.less +346 -0
- package/vendor/coze/source/form-extensions/components/level-line/index.ts +17 -0
- package/vendor/coze/source/form-extensions/components/level-line/level-line.tsx +460 -0
- package/vendor/coze/source/form-extensions/components/level-line/types.ts +38 -0
- package/vendor/coze/source/form-extensions/components/level-line/utils.ts +60 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/constants.ts +61 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/input-boolean.tsx +80 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/input-integer.tsx +68 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/input-number.tsx +62 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/input-select.tsx +59 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/input-string.tsx +55 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/literal-value-input.tsx +35 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/styles.module.less +46 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/type.ts +61 -0
- package/vendor/coze/source/form-extensions/components/literal-value-input/utils.tsx +117 -0
- package/vendor/coze/source/form-extensions/components/node-header/components/close-button.tsx +44 -0
- package/vendor/coze/source/form-extensions/components/node-header/description-display.tsx +52 -0
- package/vendor/coze/source/form-extensions/components/node-header/description.tsx +131 -0
- package/vendor/coze/source/form-extensions/components/node-header/index.module.less +165 -0
- package/vendor/coze/source/form-extensions/components/node-header/index.tsx +552 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/expand-btn/index.tsx +43 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/expand-content/default-value-input.tsx +276 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/expand-content/index.module.less +124 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/expand-content/index.tsx +131 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/expand-content/types.ts +32 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-name/index.module.less +38 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-name/index.tsx +101 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-operator/index.module.less +51 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-operator/index.tsx +107 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-required/index.module.less +17 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-required/index.tsx +53 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-type/constants.tsx +77 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-type/index.module.less +97 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/components/param-type/index.tsx +155 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/constants.ts +38 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/index.module.less +138 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/index.tsx +360 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/custom-tree-node/type.ts +88 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/header/index.module.less +36 -0
- package/vendor/coze/source/form-extensions/components/output-tree/components/header/index.tsx +104 -0
- package/vendor/coze/source/form-extensions/components/output-tree/constants.ts +22 -0
- package/vendor/coze/source/form-extensions/components/output-tree/context.ts +28 -0
- package/vendor/coze/source/form-extensions/components/output-tree/hooks/use-columns-style.ts +39 -0
- package/vendor/coze/source/form-extensions/components/output-tree/index.module.less +83 -0
- package/vendor/coze/source/form-extensions/components/output-tree/index.tsx +692 -0
- package/vendor/coze/source/form-extensions/components/output-tree/utils.ts +185 -0
- package/vendor/coze/source/form-extensions/components/setting-on-error/components/process-type/index.tsx +97 -0
- package/vendor/coze/source/form-extensions/components/setting-on-error/components/process-type/option-item.tsx +30 -0
- package/vendor/coze/source/form-extensions/components/setting-on-error/components/process-type/types.ts +23 -0
- package/vendor/coze/source/form-extensions/components/setting-on-error/components/retry-times/index.tsx +45 -0
- package/vendor/coze/source/form-extensions/components/setting-on-error/components/timeout/index.tsx +102 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/composite-select-option.tsx +167 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/composite-select-tree-panel.tsx +165 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/composite-select.module.less +96 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/composite-select.tsx +265 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/context.tsx +42 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/expand-icon.tsx +30 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/index.module.less +292 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/node-variable-tree.module.less +49 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/node-variable-tree.tsx +149 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/utils.tsx +500 -0
- package/vendor/coze/source/form-extensions/components/tree-variable-selector/value-display.tsx +130 -0
- package/vendor/coze/source/form-extensions/components/value-expression-input/const.ts +68 -0
- package/vendor/coze/source/form-extensions/components/value-expression-input/context.ts +27 -0
- package/vendor/coze/source/form-extensions/components/value-expression-input/index.module.less +144 -0
- package/vendor/coze/source/form-extensions/components/value-expression-input/value-expression-input.tsx +418 -0
- package/vendor/coze/source/form-extensions/components/variable-type-selector/constants.tsx +77 -0
- package/vendor/coze/source/form-extensions/components/variable-type-selector/index.module.less +31 -0
- package/vendor/coze/source/form-extensions/components/variable-type-selector/index.tsx +17 -0
- package/vendor/coze/source/form-extensions/components/variable-type-selector/utils.tsx +298 -0
- package/vendor/coze/source/form-extensions/components/variable-type-selector/variable-type-selector.tsx +235 -0
- package/vendor/coze/source/form-extensions/components/variable-type-tag/index.tsx +54 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-branch.module.less +9 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-branch.tsx +249 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-header.tsx +50 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-item-logic.module.less +13 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-item-logic.tsx +73 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/delete/index.module.less +10 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/delete/index.tsx +42 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/index.module.less +9 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/index.tsx +254 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/operator/index.module.less +7 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/operator/index.tsx +144 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/condition-params-item/value-expression-with-state/index.tsx +69 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/context.ts +36 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/draggable/condition-branch-preview.tsx +44 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/draggable/condition-branch.tsx +152 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/draggable/container.tsx +19 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/draggable/custom-drag-layer.tsx +117 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/draggable/types.ts +18 -0
- package/vendor/coze/source/form-extensions/setters/condition/multi-condition/types.ts +58 -0
- package/vendor/coze/source/node-registries/end/components/terminate-plan-field.tsx +29 -0
- package/vendor/coze/source/node-registries/end/constants.ts +34 -0
- package/vendor/coze/source/node-registries/end/form.tsx +66 -0
- package/vendor/coze/source/node-registries/end/types.ts +45 -0
- package/vendor/coze/source/node-registries/http/components/base-editor/raw-text-editor.tsx +80 -0
- package/vendor/coze/source/node-registries/http/constants.ts +80 -0
- package/vendor/coze/source/node-registries/http/fields/json-import-editor/index.module.less +191 -0
- package/vendor/coze/source/node-registries/http/fields/json-import-editor/json-import-components/json-expand-editor.tsx +141 -0
- package/vendor/coze/source/node-registries/http/fields/json-import-editor/json-import-components/json-import.tsx +99 -0
- package/vendor/coze/source/node-registries/http/form-render.tsx +102 -0
- package/vendor/coze/source/node-registries/http/setters/api/curl-expand-editor.tsx +161 -0
- package/vendor/coze/source/node-registries/http/setters/api/curl-import.tsx +96 -0
- package/vendor/coze/source/node-registries/http/setters/api/index.module.less +199 -0
- package/vendor/coze/source/node-registries/http/setters/api/index.tsx +149 -0
- package/vendor/coze/source/node-registries/http/setters/api/utils.ts +41 -0
- package/vendor/coze/source/node-registries/http/setters/body/index.tsx +201 -0
- package/vendor/coze/source/node-registries/http/setters/constants.ts +83 -0
- package/vendor/coze/source/node-registries/if/components/else/index.tsx +41 -0
- package/vendor/coze/source/node-registries/intent/components/intents/index.module.less +15 -0
- package/vendor/coze/source/node-registries/intent/components/intents/option-item/index.tsx +189 -0
- package/vendor/coze/source/node-registries/json-stringify/constants.ts +32 -0
- package/vendor/coze/source/node-registries/json-stringify/form.tsx +46 -0
- package/vendor/coze/source/node-registries/loop/constants.ts +43 -0
- package/vendor/coze/source/node-registries/loop/loop-fields/loop-settings-section/index.tsx +48 -0
- package/vendor/coze/source/node-registries/loop/loop-fields/loop-type/index.tsx +81 -0
- package/vendor/coze/source/node-registries/loop/loop-fields/loop-type/options.ts +34 -0
- package/vendor/coze/source/node-registries/start/form.tsx +209 -0
- package/vendor/coze/source/node-registries/text-process/components/method-selector/index.tsx +46 -0
- package/vendor/coze/source/node-registries/text-process/constants.ts +132 -0
- package/vendor/coze/source/nodes-v2/components/form-item-feedback/index.module.less +7 -0
- package/vendor/coze/source/nodes-v2/components/form-item-feedback/index.tsx +47 -0
- package/vendor/coze/source/nodes-v2/components/system-prompt/index.module.less +66 -0
- package/vendor/coze/source/nodes-v2/components/system-prompt/prompt-kit-bar.tsx +129 -0
- package/vendor/coze/source/nodes-v2/components/system-prompt/system-prompt-editor.tsx +110 -0
- package/vendor/coze/source/nodes-v2/llm/user-prompt/index.tsx +64 -0
- package/vendor/coze/source/prompt-kit/input-config-popover/index.tsx +80 -0
- package/vendor/coze/source/prompt-kit/input-slot-widget/index.css +34 -0
- package/vendor/coze/source/prompt-kit/input-slot-widget/index.ts +169 -0
- package/vendor/coze/source/prompt-kit/library-item.tsx +141 -0
- package/vendor/coze/source/prompt-kit/prompt-info-input.tsx +90 -0
- package/vendor/coze/source/ui-components/add-operation/index.module.less +19 -0
- package/vendor/coze/source/ui-components/add-operation/index.tsx +67 -0
- package/vendor/coze/source/ui-components/auto-size-tooltip/index.module.less +39 -0
- package/vendor/coze/source/ui-components/auto-size-tooltip/index.tsx +74 -0
- package/vendor/coze/source/ui-components/workflow-sl-input/index.module.less +36 -0
- package/vendor/coze/source/ui-components/workflow-sl-input/index.tsx +194 -0
- package/vendor/coze/source/utils/create-slots/index.tsx +126 -0
- package/vendor/coze/source/utils/create-slots/use-force-update.ts +23 -0
package/vendor/coze/source/components/node-render/node-render-new/fields/overflow-tag-list.tsx
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 coze-dev Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, {
|
|
18
|
+
type ReactNode,
|
|
19
|
+
useLayoutEffect,
|
|
20
|
+
useRef,
|
|
21
|
+
useState,
|
|
22
|
+
} from 'react';
|
|
23
|
+
|
|
24
|
+
import classnames from 'classnames';
|
|
25
|
+
import { IconCozMore } from '@coze-arch/coze-design/icons';
|
|
26
|
+
import { Tooltip, IconButton } from '@coze-arch/coze-design';
|
|
27
|
+
import { Dropdown } from '@coze-arch/bot-semi';
|
|
28
|
+
|
|
29
|
+
import s from './overflow-tag-list.module.less';
|
|
30
|
+
|
|
31
|
+
export interface TagProps {
|
|
32
|
+
key?: string;
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
label?: ReactNode;
|
|
35
|
+
tooltip?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface OverflowTagListProps<T extends TagProps = TagProps> {
|
|
39
|
+
/* tag list */
|
|
40
|
+
value?: T[];
|
|
41
|
+
enableTooltip?: boolean;
|
|
42
|
+
tagItemRenderer?: (tagData: T) => ReactNode;
|
|
43
|
+
dropdownClassName?: string;
|
|
44
|
+
disableMore?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const TAG_ITEM_IDENTIFIER_CLASS = 'tag-item-wrapper';
|
|
48
|
+
|
|
49
|
+
const defaultTagItemRenderer = (tag: TagProps): ReactNode => {
|
|
50
|
+
const { icon, label = '' } = tag;
|
|
51
|
+
return (
|
|
52
|
+
<div className={classnames(s.tagItem, s.limitWidth, 'gap-[4px]')}>
|
|
53
|
+
{icon ? (
|
|
54
|
+
<span className={classnames(s.tagItemIcon, 'text-lg', 'coz-fg-dim')}>
|
|
55
|
+
{icon}
|
|
56
|
+
</span>
|
|
57
|
+
) : null}
|
|
58
|
+
<span className={s.tagItemLabel}>{label}</span>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function OverflowTagList<T extends TagProps = TagProps>({
|
|
64
|
+
value = [],
|
|
65
|
+
enableTooltip,
|
|
66
|
+
tagItemRenderer,
|
|
67
|
+
dropdownClassName,
|
|
68
|
+
disableMore,
|
|
69
|
+
}: OverflowTagListProps<T>) {
|
|
70
|
+
const renderTags = (tags: T[]) =>
|
|
71
|
+
tags.map(tag => {
|
|
72
|
+
const { tooltip, key } = tag;
|
|
73
|
+
const tagItemContent =
|
|
74
|
+
tagItemRenderer?.(tag) || defaultTagItemRenderer(tag);
|
|
75
|
+
const tagItem = (
|
|
76
|
+
<div
|
|
77
|
+
key={key}
|
|
78
|
+
className={classnames(TAG_ITEM_IDENTIFIER_CLASS, 'max-w-full')}
|
|
79
|
+
>
|
|
80
|
+
{tagItemContent}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
if (!tooltip || !enableTooltip) {
|
|
84
|
+
return tagItem;
|
|
85
|
+
}
|
|
86
|
+
return (
|
|
87
|
+
<Tooltip
|
|
88
|
+
key={key ? `tooltip-${key}` : undefined}
|
|
89
|
+
content={<span className="coz-fg-primary text-lg">{tooltip}</span>}
|
|
90
|
+
style={{ backgroundColor: 'rgba(var(--coze-bg-3), 1)' }}
|
|
91
|
+
>
|
|
92
|
+
{tagItem}
|
|
93
|
+
</Tooltip>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const tagListRef = useRef<HTMLDivElement | null>(null);
|
|
98
|
+
const [showOverlay, setShowOverlay] = useState(false);
|
|
99
|
+
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
if (!tagListRef.current) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const listWidth = tagListRef.current?.clientWidth ?? 0;
|
|
105
|
+
const tags = Array.from(
|
|
106
|
+
tagListRef.current.getElementsByClassName(TAG_ITEM_IDENTIFIER_CLASS),
|
|
107
|
+
) as HTMLElement[];
|
|
108
|
+
if (!tags?.length) {
|
|
109
|
+
setShowOverlay(false);
|
|
110
|
+
} else {
|
|
111
|
+
const lastTag = tags[tags.length - 1];
|
|
112
|
+
const right = lastTag.offsetWidth + lastTag.offsetLeft;
|
|
113
|
+
setShowOverlay(right > listWidth);
|
|
114
|
+
}
|
|
115
|
+
}, [value]);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
ref={tagListRef}
|
|
120
|
+
className={classnames(s.overflowTagList, 'flex gap-1.5 items-center')}
|
|
121
|
+
>
|
|
122
|
+
{renderTags(value)}
|
|
123
|
+
{showOverlay ? (
|
|
124
|
+
<div key="overlay" className={s.overlay}>
|
|
125
|
+
<div className={s.overlayMask}></div>
|
|
126
|
+
{!disableMore && (
|
|
127
|
+
<Dropdown
|
|
128
|
+
position="bottomRight"
|
|
129
|
+
render={
|
|
130
|
+
<div
|
|
131
|
+
className={classnames(
|
|
132
|
+
'w-[230px] p-1.5 gap-1.5 flex flex-row flex-wrap',
|
|
133
|
+
{
|
|
134
|
+
[dropdownClassName as string]: dropdownClassName,
|
|
135
|
+
},
|
|
136
|
+
)}
|
|
137
|
+
>
|
|
138
|
+
{renderTags(value)}
|
|
139
|
+
</div>
|
|
140
|
+
}
|
|
141
|
+
>
|
|
142
|
+
<IconButton
|
|
143
|
+
className={classnames('w-full', 'h-full')}
|
|
144
|
+
wrapperClass={classnames(
|
|
145
|
+
'pointer-events-auto',
|
|
146
|
+
'text-[0px]',
|
|
147
|
+
'coz-bg-plus',
|
|
148
|
+
'w-[22px]',
|
|
149
|
+
'h-[20px]',
|
|
150
|
+
)}
|
|
151
|
+
style={{ height: '100%' }}
|
|
152
|
+
size="mini"
|
|
153
|
+
iconSize="small"
|
|
154
|
+
icon={<IconCozMore />}
|
|
155
|
+
/>
|
|
156
|
+
</Dropdown>
|
|
157
|
+
)}
|
|
158
|
+
</div>
|
|
159
|
+
) : null}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
.variable-tag {
|
|
3
|
+
@apply flex items-center coz-mg-primary rounded-mini cursor-pointer coz-fg-secondary font-medium;
|
|
4
|
+
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
|
|
7
|
+
.variable-tag-label {
|
|
8
|
+
@apply leading-4 text-base coz-fg-primary;
|
|
9
|
+
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.variable-tag-icon {
|
|
16
|
+
@apply flex grow shrink-0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.variable-tag_default {
|
|
20
|
+
&:hover {
|
|
21
|
+
@apply coz-mg-primary-pressed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.variable-tag_warning {
|
|
26
|
+
@apply coz-fg-hglt-yellow coz-mg-hglt-yellow;
|
|
27
|
+
|
|
28
|
+
.variable-tag-label {
|
|
29
|
+
@apply coz-fg-hglt-yellow;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.variable-tag-icon {
|
|
33
|
+
@apply coz-fg-hglt-yellow-dim;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.variable-tag_success {
|
|
38
|
+
@apply coz-fg-hglt-green coz-mg-hglt-green;
|
|
39
|
+
|
|
40
|
+
.variable-tag-label {
|
|
41
|
+
@apply coz-fg-hglt-green;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.variable-tag-icon {
|
|
45
|
+
@apply coz-fg-hglt-green-dim;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/vendor/coze/source/components/node-render/node-render-new/fields/variable-tag-list.tsx
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 coze-dev Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { type ReactNode, useMemo } from 'react';
|
|
18
|
+
|
|
19
|
+
import classnames from 'classnames';
|
|
20
|
+
import {
|
|
21
|
+
type ViewVariableType,
|
|
22
|
+
VARIABLE_TYPE_ALIAS_MAP,
|
|
23
|
+
} from '@coze-workflow/base';
|
|
24
|
+
import { I18n } from '@coze-arch/i18n';
|
|
25
|
+
import { IconCozWarningCircle } from '@coze-arch/coze-design/icons';
|
|
26
|
+
|
|
27
|
+
import { OverflowTagList, type TagProps } from './overflow-tag-list';
|
|
28
|
+
import { VARIABLE_TYPE_ICON_MAP } from './constants';
|
|
29
|
+
|
|
30
|
+
import s from './variable-tag-list.module.less';
|
|
31
|
+
|
|
32
|
+
// state
|
|
33
|
+
export enum VariableTagStatus {
|
|
34
|
+
Success = 'success',
|
|
35
|
+
Warning = 'warning',
|
|
36
|
+
Default = 'default',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface VariableTagProps {
|
|
40
|
+
key?: string;
|
|
41
|
+
/* Variable type */
|
|
42
|
+
type?: ViewVariableType;
|
|
43
|
+
/* Variable name, when empty, is displayed as Undefined/Undefined */
|
|
44
|
+
label?: ReactNode;
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
status?: VariableTagStatus;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface VariableTagListProps {
|
|
50
|
+
/* tag list */
|
|
51
|
+
value?: VariableTagProps[];
|
|
52
|
+
/**
|
|
53
|
+
* The maximum width of each tag, the default is the width of the parent container
|
|
54
|
+
*/
|
|
55
|
+
maxTagWidth?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface VariableTagRenderProps extends TagProps {
|
|
59
|
+
invalid?: boolean;
|
|
60
|
+
status?: VariableTagStatus;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const VariableTagList: React.FC<VariableTagListProps> = ({
|
|
64
|
+
value = [],
|
|
65
|
+
maxTagWidth,
|
|
66
|
+
}) => {
|
|
67
|
+
const renderTag = ({
|
|
68
|
+
icon,
|
|
69
|
+
label,
|
|
70
|
+
invalid,
|
|
71
|
+
status,
|
|
72
|
+
}: VariableTagRenderProps) => {
|
|
73
|
+
if (!status && invalid) {
|
|
74
|
+
status = VariableTagStatus.Warning;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
className={classnames(
|
|
80
|
+
s.variableTag,
|
|
81
|
+
'px-1 py-0.5 gap-0.5',
|
|
82
|
+
s[`variable-tag_${status || 'default'}`],
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
<span
|
|
86
|
+
className={classnames(s.variableTagIcon, 'text-lg', 'coz-fg-dim')}
|
|
87
|
+
>
|
|
88
|
+
{icon}
|
|
89
|
+
</span>
|
|
90
|
+
<span className={s.variableTagLabel} style={{ maxWidth: maxTagWidth }}>
|
|
91
|
+
{label}
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const formattedValue = useMemo<VariableTagRenderProps[]>(
|
|
98
|
+
() =>
|
|
99
|
+
value.map(v => {
|
|
100
|
+
const label = v.label || I18n.t('workflow_variable_undefined');
|
|
101
|
+
const icon = v.type ? (
|
|
102
|
+
VARIABLE_TYPE_ICON_MAP[v.type] || <IconCozWarningCircle />
|
|
103
|
+
) : (
|
|
104
|
+
<IconCozWarningCircle />
|
|
105
|
+
);
|
|
106
|
+
const invalid = v.invalid || !v.label || !v.type;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
key: v.key,
|
|
110
|
+
label,
|
|
111
|
+
icon,
|
|
112
|
+
invalid,
|
|
113
|
+
tooltip: v.type ? VARIABLE_TYPE_ALIAS_MAP[v.type] : undefined,
|
|
114
|
+
status: v.status,
|
|
115
|
+
};
|
|
116
|
+
}),
|
|
117
|
+
[value],
|
|
118
|
+
);
|
|
119
|
+
return (
|
|
120
|
+
<OverflowTagList<VariableTagRenderProps>
|
|
121
|
+
value={formattedValue}
|
|
122
|
+
enableTooltip
|
|
123
|
+
tagItemRenderer={renderTag}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.font-normal {
|
|
2
|
+
color: var(--light-usage-text-color-text-0, #1D1C23);
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: 600;
|
|
6
|
+
line-height: 22px;
|
|
7
|
+
/* 157.143% */
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.container {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: -46px;
|
|
13
|
+
left: calc(100% + 16px);
|
|
14
|
+
width: 380px;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
background: var(--light-color-grey-grey-0, #F7F7FA);
|
|
17
|
+
box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.30), 0px 4px 68px 3px rgba(0, 0, 0, 0.14);
|
|
18
|
+
|
|
19
|
+
.wrapper {
|
|
20
|
+
position: relative;
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding: 24px;
|
|
23
|
+
|
|
24
|
+
.delete-icon {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 16px;
|
|
29
|
+
right: 16px;
|
|
30
|
+
padding: 4px;
|
|
31
|
+
|
|
32
|
+
.icon {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 16px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
|
|
37
|
+
&>span {
|
|
38
|
+
width: 16px;
|
|
39
|
+
height: 16px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title {
|
|
45
|
+
display: block;
|
|
46
|
+
.font-normal();
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
color: var(--light-usage-text-color-text-0, #1C1F23);
|
|
49
|
+
font-size: 18px;
|
|
50
|
+
line-height: 24px;
|
|
51
|
+
/* 133.333% */
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.content {
|
|
55
|
+
margin-top: 32px;
|
|
56
|
+
|
|
57
|
+
.icon-config {
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
color: rgba(107, 109, 117, 1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.block-item {
|
|
63
|
+
margin-top: 12px;
|
|
64
|
+
|
|
65
|
+
&:first-child {
|
|
66
|
+
margin-top: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.info {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
|
|
73
|
+
.label {
|
|
74
|
+
.font-normal();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.copy {
|
|
78
|
+
margin-left: 8px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.code {
|
|
83
|
+
max-height: 280px;
|
|
84
|
+
border-radius: 8px;
|
|
85
|
+
border: 1px solid var(--light-usage-border-color-border, rgba(29, 28, 35, 0.08));
|
|
86
|
+
background: var(--light-usage-disabled-color-disabled-fill, rgba(46, 46, 56, 0.04));
|
|
87
|
+
margin-top: 12px;
|
|
88
|
+
padding: 6px 16px;
|
|
89
|
+
overflow-y: auto;
|
|
90
|
+
user-select: text;
|
|
91
|
+
cursor: text;
|
|
92
|
+
white-space: break-spaces;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 coze-dev Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { useCallback } from 'react';
|
|
18
|
+
|
|
19
|
+
import copy from 'copy-to-clipboard';
|
|
20
|
+
import classNames from 'classnames';
|
|
21
|
+
import { FlowNodeFormData } from '@flowgram-adapter/free-layout-editor';
|
|
22
|
+
import { type FlowNodeEntity } from '@flowgram-adapter/free-layout-editor';
|
|
23
|
+
import { DEFAULT_NODE_META_PATH } from '@coze-workflow/nodes';
|
|
24
|
+
import { StandardNodeType } from '@coze-workflow/base';
|
|
25
|
+
import { REPORT_EVENTS } from '@coze-arch/report-events';
|
|
26
|
+
import { I18n } from '@coze-arch/i18n';
|
|
27
|
+
import { safeJSONParse } from '@coze-arch/bot-utils';
|
|
28
|
+
import { UIIconButton } from '@coze-arch/bot-semi';
|
|
29
|
+
import { IconCopy, IconWorkflowRunResultClose } from '@coze-arch/bot-icons';
|
|
30
|
+
import { CustomError } from '@coze-arch/bot-error';
|
|
31
|
+
import { Toast, Tooltip } from '@coze-arch/coze-design';
|
|
32
|
+
|
|
33
|
+
import { useExecStateEntity } from '../../../hooks';
|
|
34
|
+
|
|
35
|
+
import styles from './index.module.less';
|
|
36
|
+
|
|
37
|
+
type ExecuteResultPanelProps = React.PropsWithChildren<{
|
|
38
|
+
id: string;
|
|
39
|
+
node: FlowNodeEntity;
|
|
40
|
+
showResult: boolean;
|
|
41
|
+
onClose?: () => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
style?: React.CSSProperties;
|
|
44
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
45
|
+
}>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* raw_output could be a JSON string or a native string
|
|
49
|
+
*/
|
|
50
|
+
const getSafeOutput = (
|
|
51
|
+
type?: StandardNodeType,
|
|
52
|
+
output?: string,
|
|
53
|
+
rawOutput?: string,
|
|
54
|
+
errorInfo?: string,
|
|
55
|
+
// eslint-disable-next-line max-params
|
|
56
|
+
) => {
|
|
57
|
+
let safeOutput = safeJSONParse(output, output) || {};
|
|
58
|
+
// The LLM CODE node needs to use the output package separately
|
|
59
|
+
if (type === StandardNodeType.LLM || type === StandardNodeType.Code) {
|
|
60
|
+
safeOutput = {
|
|
61
|
+
output: safeOutput,
|
|
62
|
+
};
|
|
63
|
+
if (safeOutput && rawOutput) {
|
|
64
|
+
safeOutput.raw_output = safeJSONParse(rawOutput, rawOutput);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (errorInfo) {
|
|
68
|
+
safeOutput.errorInfo = errorInfo;
|
|
69
|
+
}
|
|
70
|
+
return safeOutput;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const JSON_STRINGIFY_FORMAT_CODE = 2;
|
|
74
|
+
|
|
75
|
+
export default function ExecuteResultPanel({
|
|
76
|
+
id,
|
|
77
|
+
node,
|
|
78
|
+
showResult,
|
|
79
|
+
onClose,
|
|
80
|
+
className,
|
|
81
|
+
style,
|
|
82
|
+
onClick,
|
|
83
|
+
}: ExecuteResultPanelProps) {
|
|
84
|
+
const entity = useExecStateEntity();
|
|
85
|
+
|
|
86
|
+
const executeResult = entity.getNodeExecResult(id);
|
|
87
|
+
const type = node.flowNodeType as StandardNodeType;
|
|
88
|
+
const formData = node.getData(FlowNodeFormData);
|
|
89
|
+
const title = formData?.formModel.getFormItemValueByPath(
|
|
90
|
+
node.getNodeMeta().nodeMetaPath || DEFAULT_NODE_META_PATH,
|
|
91
|
+
)?.title;
|
|
92
|
+
|
|
93
|
+
const safeOutput = getSafeOutput(
|
|
94
|
+
type,
|
|
95
|
+
executeResult?.output,
|
|
96
|
+
executeResult?.raw_output,
|
|
97
|
+
executeResult?.errorInfo,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const onCopy = useCallback((text: string) => {
|
|
101
|
+
const res = copy(text);
|
|
102
|
+
if (!res) {
|
|
103
|
+
throw new CustomError(REPORT_EVENTS.parmasValidation, 'empty copy');
|
|
104
|
+
}
|
|
105
|
+
Toast.success({
|
|
106
|
+
content: I18n.t('copy_success'),
|
|
107
|
+
showClose: false,
|
|
108
|
+
});
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
111
|
+
const ShowValueOptions = [
|
|
112
|
+
{
|
|
113
|
+
label: I18n.t('workflow_detail_node_input'),
|
|
114
|
+
code: JSON.stringify(
|
|
115
|
+
safeJSONParse(executeResult?.input) ?? '{}',
|
|
116
|
+
undefined,
|
|
117
|
+
JSON_STRINGIFY_FORMAT_CODE,
|
|
118
|
+
),
|
|
119
|
+
copyTip: I18n.t('workflow_detail_title_testrun_copyinput'),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: I18n.t('workflow_detail_node_output'),
|
|
123
|
+
code: JSON.stringify(safeOutput, undefined, JSON_STRINGIFY_FORMAT_CODE),
|
|
124
|
+
copyTip: I18n.t('workflow_detail_title_testrun_copyoutput'),
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
if (!showResult) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return (
|
|
132
|
+
<div
|
|
133
|
+
className={classNames(styles.container, className, 'flow-move-hot-zone')}
|
|
134
|
+
style={style}
|
|
135
|
+
onClick={onClick}
|
|
136
|
+
data-testid="workflow.detail.node.testrun.result-panel"
|
|
137
|
+
>
|
|
138
|
+
<div className={styles.wrapper}>
|
|
139
|
+
<div className={styles['delete-icon']} onClick={onClose}>
|
|
140
|
+
<IconWorkflowRunResultClose className={styles.icon} />
|
|
141
|
+
</div>
|
|
142
|
+
<span className={styles.title}>
|
|
143
|
+
{title} {I18n.t('workflow_detail_title_testrun_process')}
|
|
144
|
+
</span>
|
|
145
|
+
<div className={styles.content}>
|
|
146
|
+
{ShowValueOptions.map(item => (
|
|
147
|
+
<div className={styles['block-item']} key={item.label}>
|
|
148
|
+
<div className={styles.info}>
|
|
149
|
+
<span className={styles.label}>{item.label}</span>
|
|
150
|
+
<Tooltip content={item.copyTip}>
|
|
151
|
+
<UIIconButton
|
|
152
|
+
iconSize="small"
|
|
153
|
+
className={styles.copy}
|
|
154
|
+
icon={<IconCopy className={styles['icon-config']} />}
|
|
155
|
+
onClick={() => onCopy(item.code)}
|
|
156
|
+
/>
|
|
157
|
+
</Tooltip>
|
|
158
|
+
</div>
|
|
159
|
+
<pre
|
|
160
|
+
className={classNames(styles.code, 'nowheel')}
|
|
161
|
+
data-testid="workflow.detail.node.testrun.result-item"
|
|
162
|
+
>
|
|
163
|
+
{item.code}
|
|
164
|
+
</pre>
|
|
165
|
+
</div>
|
|
166
|
+
))}
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.sub-canvas-header {
|
|
2
|
+
cursor: move;
|
|
3
|
+
|
|
4
|
+
z-index: 0;
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 48px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
|
|
15
|
+
border-radius: 8px 8px 0 0;
|
|
16
|
+
|
|
17
|
+
.sub-canvas-logo {
|
|
18
|
+
position: relative;
|
|
19
|
+
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
|
|
22
|
+
width: 24px;
|
|
23
|
+
height: 24px;
|
|
24
|
+
|
|
25
|
+
border-radius: 4px;
|
|
26
|
+
|
|
27
|
+
&::after {
|
|
28
|
+
content: '';
|
|
29
|
+
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
|
|
34
|
+
display: block;
|
|
35
|
+
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
box-shadow: inset 0 0 0 1px var(--coz-stroke-plus);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
> img {
|
|
44
|
+
width: 24px;
|
|
45
|
+
height: 24px;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sub-canvas-title {
|
|
51
|
+
margin: 0;
|
|
52
|
+
padding: 0;
|
|
53
|
+
|
|
54
|
+
font-size: 16px;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
line-height: 22px;
|
|
58
|
+
color: var(--coz-fg-primary, rgba(6, 7, 9, 80%));
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.sub-canvas-tooltip {
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sub-canvas-tooltip-icon {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
|
|
70
|
+
width: 16px;
|
|
71
|
+
height: 100%;
|
|
72
|
+
|
|
73
|
+
color: #A7A9B0;
|
|
74
|
+
}
|
|
75
|
+
}
|