From 3db3a18eff314be3a966c5095684e20995685aa2 Mon Sep 17 00:00:00 2001 From: twwu Date: Fri, 16 Jan 2026 13:47:34 +0800 Subject: [PATCH] refactor: move getButtonStyle function to utils for better code organization in human input form --- web/app/(humanInputLayout)/form/[token]/form.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx index 2a2e93475d..03640a0157 100644 --- a/web/app/(humanInputLayout)/form/[token]/form.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form.tsx @@ -12,9 +12,9 @@ import AppIcon from '@/app/components/base/app-icon' import Button from '@/app/components/base/button' import ContentItem from '@/app/components/base/chat/chat/answer/human-input-content/content-item' import ExpirationTime from '@/app/components/base/chat/chat/answer/human-input-content/expiration-time' +import { getButtonStyle } from '@/app/components/base/chat/chat/answer/human-input-content/utils' import Loading from '@/app/components/base/loading' import DifyLogo from '@/app/components/base/logo/dify-logo' -import { UserActionButtonType } from '@/app/components/workflow/nodes/human-input/types' import useDocumentTitle from '@/hooks/use-document-title' import { getHumanInputForm, submitHumanInputForm } from '@/service/share' import { asyncRunSafe } from '@/utils' @@ -46,17 +46,6 @@ const FormContent = () => { const site = formData?.site.site - const getButtonStyle = (style: UserActionButtonType) => { - if (style === UserActionButtonType.Primary) - return 'primary' - if (style === UserActionButtonType.Default) - return 'secondary' - if (style === UserActionButtonType.Accent) - return 'secondary-accent' - if (style === UserActionButtonType.Ghost) - return 'ghost' - } - const splitByOutputVar = (content: string): string[] => { const outputVarRegex = /(\{\{#\$output\.[^#]+#\}\})/g const parts = content.split(outputVarRegex)