Merge branch 'main' into feat/queue-based-graph-engine

This commit is contained in:
-LAN-
2025-09-09 13:33:17 +08:00
committed by GitHub
19 changed files with 1385 additions and 58 deletions

View File

@ -215,7 +215,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
}
}
if (item.number) {
const convertedNumber = Number(initInputs[item.number.variable]) ?? undefined
const convertedNumber = Number(initInputs[item.number.variable])
return {
...item.number,
default: convertedNumber || item.default || item.number.default,

View File

@ -188,7 +188,7 @@ export const useEmbeddedChatbot = () => {
}
}
if (item.number) {
const convertedNumber = Number(initInputs[item.number.variable]) ?? undefined
const convertedNumber = Number(initInputs[item.number.variable])
return {
...item.number,
default: convertedNumber || item.default || item.number.default,

View File

@ -9,17 +9,34 @@ import { isValidUrl } from './utils'
const Link = ({ node, children, ...props }: any) => {
const { onSend } = useChatContext()
const commonClassName = 'cursor-pointer underline !decoration-primary-700 decoration-dashed'
if (node.properties?.href && node.properties.href?.toString().startsWith('abbr')) {
const hidden_text = decodeURIComponent(node.properties.href.toString().split('abbr:')[1])
return <abbr className="cursor-pointer underline !decoration-primary-700 decoration-dashed" onClick={() => onSend?.(hidden_text)} title={node.children[0]?.value || ''}>{node.children[0]?.value || ''}</abbr>
return <abbr className={commonClassName} onClick={() => onSend?.(hidden_text)} title={node.children[0]?.value || ''}>{node.children[0]?.value || ''}</abbr>
}
else {
const href = props.href || node.properties?.href
if(!href || !isValidUrl(href))
if (href && /^#[a-zA-Z0-9_\-]+$/.test(href.toString())) {
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
e.preventDefault()
// scroll to target element if exists within the answer container
const answerContainer = e.currentTarget.closest('.chat-answer-container')
if (answerContainer) {
const targetId = CSS.escape(href.toString().substring(1))
const targetElement = answerContainer.querySelector(`[id="${targetId}"]`)
if (targetElement)
targetElement.scrollIntoView({ behavior: 'smooth' })
}
}
return <a href={href} onClick={handleClick} className={commonClassName}>{children || 'ScrollView'}</a>
}
if (!href || !isValidUrl(href))
return <span>{children}</span>
return <a href={href} target="_blank" className="cursor-pointer underline !decoration-primary-700 decoration-dashed">{children || 'Download'}</a>
return <a href={href} target="_blank" rel="noopener noreferrer" className={commonClassName}>{children || 'Download'}</a>
}
}

View File

@ -186,12 +186,12 @@ const ParameterItem: FC<ParameterItemProps> = ({
if (parameterRule.type === 'boolean') {
return (
<Radio.Group
className='flex w-[178px] items-center'
className='flex w-[150px] items-center'
value={renderValue as boolean}
onChange={handleRadioChange}
>
<Radio value={true} className='w-[83px]'>True</Radio>
<Radio value={false} className='w-[83px]'>False</Radio>
<Radio value={true} className='w-[70px] px-[18px]'>True</Radio>
<Radio value={false} className='w-[70px] px-[18px]'>False</Radio>
</Radio.Group>
)
}
@ -199,7 +199,7 @@ const ParameterItem: FC<ParameterItemProps> = ({
if (parameterRule.type === 'string' && !parameterRule.options?.length) {
return (
<input
className={cn(isInWorkflow ? 'w-[178px]' : 'w-full', 'system-sm-regular ml-4 flex h-8 appearance-none items-center rounded-lg bg-components-input-bg-normal px-3 text-components-input-text-filled outline-none')}
className={cn(isInWorkflow ? 'w-[150px]' : 'w-full', 'system-sm-regular ml-4 flex h-8 appearance-none items-center rounded-lg bg-components-input-bg-normal px-3 text-components-input-text-filled outline-none')}
value={renderValue as string}
onChange={handleStringInputChange}
/>
@ -270,7 +270,7 @@ const ParameterItem: FC<ParameterItemProps> = ({
parameterRule.help && (
<Tooltip
popupContent={(
<div className='w-[178px] whitespace-pre-wrap'>{parameterRule.help[language] || parameterRule.help.en_US}</div>
<div className='w-[150px] whitespace-pre-wrap'>{parameterRule.help[language] || parameterRule.help.en_US}</div>
)}
popupClassName='mr-1'
triggerClassName='mr-1 w-4 h-4 shrink-0'
@ -280,7 +280,7 @@ const ParameterItem: FC<ParameterItemProps> = ({
</div>
{
parameterRule.type === 'tag' && (
<div className={cn(!isInWorkflow && 'w-[178px]', 'system-xs-regular text-text-tertiary')}>
<div className={cn(!isInWorkflow && 'w-[150px]', 'system-xs-regular text-text-tertiary')}>
{parameterRule?.tagPlaceholder?.[language]}
</div>
)

View File

@ -51,7 +51,7 @@ const nodeDefault: NodeDefault<ListFilterNodeType> = {
if (!errorMessages && !filter_by.conditions[0]?.comparison_operator)
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.listFilter.filterConditionComparisonOperator') })
if (!errorMessages && !comparisonOperatorNotRequireValue(filter_by.conditions[0]?.comparison_operator) && (item_var_type === VarType.boolean ? !filter_by.conditions[0]?.value === undefined : !filter_by.conditions[0]?.value))
if (!errorMessages && !comparisonOperatorNotRequireValue(filter_by.conditions[0]?.comparison_operator) && (item_var_type === VarType.boolean ? filter_by.conditions[0]?.value === undefined : !filter_by.conditions[0]?.value))
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.listFilter.filterConditionComparisonValue') })
}