fix: fix remove logo not work (#37435)

This commit is contained in:
wangxiaolei 2026-06-15 11:32:10 +08:00 committed by GitHub
parent cd3008e159
commit a685eba549
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 12 deletions

View File

@ -8,6 +8,7 @@ type FormStatusCardProps = {
title: ReactNode
subtitle?: ReactNode
submissionID?: string
removeWebappBrand?: boolean
}
const FormStatusCard = ({
@ -15,6 +16,7 @@ const FormStatusCard = ({
title,
subtitle,
submissionID,
removeWebappBrand,
}: FormStatusCardProps) => {
const { t } = useTranslation()
@ -37,12 +39,14 @@ const FormStatusCard = ({
</div>
)}
</div>
<div className="flex flex-row-reverse px-2 py-3">
<div className="flex shrink-0 items-center gap-1.5 px-1">
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
<DifyLogo size="small" />
{!removeWebappBrand && (
<div className="flex flex-row-reverse px-2 py-3">
<div className="flex shrink-0 items-center gap-1.5 px-1">
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
<DifyLogo size="small" />
</div>
</div>
</div>
)}
</div>
</div>
)

View File

@ -1,6 +1,6 @@
'use client'
import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types'
import type { SiteInfo } from '@/models/share'
import type { CustomConfigValueType, SiteInfo } from '@/models/share'
import type { HumanInputFormError } from '@/service/use-share'
import type { HumanInputResolvedValue } from '@/types/workflow'
import * as React from 'react'
@ -14,7 +14,10 @@ import LoadedFormContent from './loaded-form-content'
import { useFormSubmit } from './use-form-submit'
export type FormData = {
site: { site: SiteInfo }
site: {
site: SiteInfo
custom_config?: Record<string, CustomConfigValueType> | null
}
form_content: string
inputs: FormInputItem[]
resolved_default_values: Record<string, HumanInputResolvedValue>
@ -31,6 +34,8 @@ const FormContent = () => {
const { data: formData, isLoading, error } = useGetHumanInputForm(token)
const { isSubmitting, submit, success } = useFormSubmit(token)
const removeWebappBrand = formData?.site?.custom_config?.remove_webapp_brand === true
const expired = (error as HumanInputFormError | null)?.code === 'human_input_form_expired'
const submitted = (error as HumanInputFormError | null)?.code === 'human_input_form_submitted'
const rateLimitExceeded = (error as HumanInputFormError | null)?.code === 'web_form_rate_limit_exceeded'
@ -48,6 +53,7 @@ const FormContent = () => {
title={t('humanInput.thanks', { ns: 'share' })}
subtitle={t('humanInput.recorded', { ns: 'share' })}
submissionID={token}
removeWebappBrand={removeWebappBrand}
/>
)
}
@ -98,6 +104,7 @@ const FormContent = () => {
formData={formData}
isSubmitting={isSubmitting}
onSubmit={submit}
removeWebappBrand={removeWebappBrand}
/>
)
}

View File

@ -17,12 +17,14 @@ type LoadedFormContentProps = {
formData: FormData
isSubmitting: boolean
onSubmit: (inputs: Record<string, HumanInputFieldValue>, actionID: string, formInputs: FormData['inputs']) => void
removeWebappBrand?: boolean
}
const LoadedFormContent = ({
formData,
isSubmitting,
onSubmit,
removeWebappBrand,
}: LoadedFormContentProps) => {
const { t } = useTranslation()
const renderedFormInputs = getRenderedFormInputs(formData.inputs, formData.form_content)
@ -84,12 +86,14 @@ const LoadedFormContent = ({
</div>
<ExpirationTime expirationTime={formData.expiration_time * 1000} />
</div>
<div className="flex flex-row-reverse px-2 py-3">
<div className="flex shrink-0 items-center gap-1.5 px-1">
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
<DifyLogo size="small" />
{!removeWebappBrand && (
<div className="flex flex-row-reverse px-2 py-3">
<div className="flex shrink-0 items-center gap-1.5 px-1">
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
<DifyLogo size="small" />
</div>
</div>
</div>
)}
</div>
</div>
)