From 8bdaab96b1f99e2af3d87e349b731c47b8c58f9f Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Thu, 21 Mar 2024 14:24:40 +0800 Subject: [PATCH] fix --- .../line/communication/chat-bot-slim.svg | 9 +++ .../line/communication/ChatBotSlim.json | 68 +++++++++++++++++++ .../vender/line/communication/ChatBotSlim.tsx | 16 +++++ .../src/vender/line/communication/index.ts | 1 + web/app/components/workflow/index.tsx | 4 +- .../panel/debug-and-preview/chat-wrapper.tsx | 21 +++--- .../panel/debug-and-preview/empty.tsx | 19 ++++++ web/i18n/en-US/workflow.ts | 1 + web/i18n/zh-Hans/workflow.ts | 1 + 9 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 web/app/components/base/icons/assets/vender/line/communication/chat-bot-slim.svg create mode 100644 web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.json create mode 100644 web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.tsx create mode 100644 web/app/components/workflow/panel/debug-and-preview/empty.tsx diff --git a/web/app/components/base/icons/assets/vender/line/communication/chat-bot-slim.svg b/web/app/components/base/icons/assets/vender/line/communication/chat-bot-slim.svg new file mode 100644 index 0000000000..daceae728f --- /dev/null +++ b/web/app/components/base/icons/assets/vender/line/communication/chat-bot-slim.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.json b/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.json new file mode 100644 index 0000000000..07f6cda56b --- /dev/null +++ b/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.json @@ -0,0 +1,68 @@ +{ + "icon": { + "type": "element", + "isRootNode": true, + "name": "svg", + "attributes": { + "width": "48", + "height": "48", + "viewBox": "0 0 48 48", + "fill": "none", + "xmlns": "http://www.w3.org/2000/svg" + }, + "children": [ + { + "type": "element", + "name": "g", + "attributes": { + "id": "chat-bot" + }, + "children": [ + { + "type": "element", + "name": "g", + "attributes": { + "id": "Vector" + }, + "children": [ + { + "type": "element", + "name": "path", + "attributes": { + "d": "M13.0909 11.2727C14.0951 11.2727 14.9091 10.4587 14.9091 9.45455C14.9091 8.45039 14.0951 7.63636 13.0909 7.63636C12.0868 7.63636 11.2727 8.45039 11.2727 9.45455C11.2727 10.4587 12.0868 11.2727 13.0909 11.2727Z", + "fill": "currentColor" + }, + "children": [] + }, + { + "type": "element", + "name": "path", + "attributes": { + "d": "M20.3636 22.1818H7.63636C5.62727 22.1818 4 23.8091 4 25.8182V40.3636C4 42.3727 5.62727 44 7.63636 44H33.0909C35.1 44 36.7273 42.3727 36.7273 40.3636V25.8182M13.0909 15.9998V11.2727M13.0909 11.2727C14.0951 11.2727 14.9091 10.4587 14.9091 9.45455C14.9091 8.45039 14.0951 7.63636 13.0909 7.63636C12.0868 7.63636 11.2727 8.45039 11.2727 9.45455C11.2727 10.4587 12.0868 11.2727 13.0909 11.2727ZM27.6364 5.81818C27.6364 4.81455 28.4509 4 29.4545 4H42.1818C43.1855 4 44 4.81455 44 5.81818V14.9091C44 15.9127 43.1855 16.7273 42.1818 16.7273H33.0909L27.6364 20.3636V5.81818Z", + "stroke": "currentColor", + "stroke-width": "2", + "stroke-linecap": "round", + "stroke-linejoin": "round" + }, + "children": [] + } + ] + }, + { + "type": "element", + "name": "path", + "attributes": { + "id": "Vector_2", + "d": "M15.7275 30.364C15.7275 31.3179 14.9542 32.0913 14.0002 32.0913C13.0463 32.0913 12.2729 31.3179 12.2729 30.364C12.2729 29.41 13.0463 28.6367 14.0002 28.6367C14.9542 28.6367 15.7275 29.41 15.7275 30.364ZM28.4548 30.364C28.4548 31.3179 27.6814 32.0913 26.7275 32.0913C25.7735 32.0913 25.0002 31.3179 25.0002 30.364C25.0002 29.41 25.7735 28.6367 26.7275 28.6367C27.6814 28.6367 28.4548 29.41 28.4548 30.364Z", + "fill": "currentColor", + "stroke": "currentColor", + "stroke-width": "2" + }, + "children": [] + } + ] + } + ] + }, + "name": "ChatBotSlim" +} \ No newline at end of file diff --git a/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.tsx b/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.tsx new file mode 100644 index 0000000000..bcac97e291 --- /dev/null +++ b/web/app/components/base/icons/src/vender/line/communication/ChatBotSlim.tsx @@ -0,0 +1,16 @@ +// GENERATE BY script +// DON NOT EDIT IT MANUALLY + +import * as React from 'react' +import data from './ChatBotSlim.json' +import IconBase from '@/app/components/base/icons/IconBase' +import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase' + +const Icon = React.forwardRef, Omit>(( + props, + ref, +) => ) + +Icon.displayName = 'ChatBotSlim' + +export default Icon diff --git a/web/app/components/base/icons/src/vender/line/communication/index.ts b/web/app/components/base/icons/src/vender/line/communication/index.ts index 1c8c7b6293..3ab20e8bb4 100644 --- a/web/app/components/base/icons/src/vender/line/communication/index.ts +++ b/web/app/components/base/icons/src/vender/line/communication/index.ts @@ -1,4 +1,5 @@ export { default as AiText } from './AiText' +export { default as ChatBotSlim } from './ChatBotSlim' export { default as ChatBot } from './ChatBot' export { default as CuteRobot } from './CuteRobot' export { default as MessageCheckRemove } from './MessageCheckRemove' diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx index 97964628ed..ad83beed16 100644 --- a/web/app/components/workflow/index.tsx +++ b/web/app/components/workflow/index.tsx @@ -122,8 +122,8 @@ const Workflow: FC = memo(({ ((_, ref) => { const workflowStore = useWorkflowStore() const featuresStore = useFeaturesStore() const inputs = useStore(s => s.inputs) - const { handleStopRun } = useWorkflowRun() const features = featuresStore!.getState().features const config = useMemo(() => { @@ -81,11 +80,6 @@ const ChatWrapper = forwardRef((_, ref) => { ) }, [conversationId, handleSend, workflowStore, appDetail]) - const doStop = useCallback(() => { - handleStop() - handleStopRun(workflowStore.getState().workflowRunningData?.task_id || '') - }, [handleStop, handleStopRun, workflowStore]) - useImperativeHandle(ref, () => { return { handleRestart, @@ -105,8 +99,17 @@ const ChatWrapper = forwardRef((_, ref) => { chatFooterClassName='px-4 rounded-bl-2xl' chatFooterInnerClassName='pb-4' onSend={doSend} - onStopResponding={doStop} - chatNode={} + onStopResponding={handleStop} + chatNode={( + <> + + { + !chatList.length && ( + + ) + } + + )} suggestedQuestions={suggestedQuestions} showPromptLog /> diff --git a/web/app/components/workflow/panel/debug-and-preview/empty.tsx b/web/app/components/workflow/panel/debug-and-preview/empty.tsx new file mode 100644 index 0000000000..61c7c6f3a1 --- /dev/null +++ b/web/app/components/workflow/panel/debug-and-preview/empty.tsx @@ -0,0 +1,19 @@ +import { useTranslation } from 'react-i18next' +import { ChatBotSlim } from '@/app/components/base/icons/src/vender/line/communication' + +const Empty = () => { + const { t } = useTranslation() + + return ( +
+
+ +
+
+ {t('workflow.common.previewPlaceholder')} +
+
+ ) +} + +export default Empty diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index cbcbd6f3fc..7e851aa3de 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -30,6 +30,7 @@ const translation = { maxTreeDepth: 'Maximum limit of {{depth}} nodes per branch', workflowProcess: 'Workflow Process', notRunning: 'Not running yet', + previewPlaceholder: 'Enter content in the box below to start debugging the Chatbot', }, errorMsg: { fieldRequired: '{{field}} is required', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 30f2739f7c..0a65357af3 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -30,6 +30,7 @@ const translation = { maxTreeDepth: '每个分支最大限制 {{depth}} 个节点', workflowProcess: '工作流', notRunning: '尚未运行', + previewPlaceholder: '在下面的框中输入内容开始调试聊天机器人', }, errorMsg: { fieldRequired: '{{field}} 不能为空',