hide params outside

This commit is contained in:
JzoNg 2025-02-08 19:53:47 +08:00
parent d51bd90394
commit 9f013d6590
6 changed files with 12 additions and 17 deletions

View File

@ -23,7 +23,6 @@ type Props = {
supportCollapse?: boolean supportCollapse?: boolean
scope?: string scope?: string
onChange: (value: ToolValue[]) => void onChange: (value: ToolValue[]) => void
supportVariables?: boolean
nodeOutputVars: NodeOutPutVar[], nodeOutputVars: NodeOutPutVar[],
availableNodes: Node[], availableNodes: Node[],
nodeId?: string nodeId?: string
@ -38,7 +37,6 @@ const MultipleToolSelector = ({
supportCollapse, supportCollapse,
scope, scope,
onChange, onChange,
supportVariables,
nodeOutputVars, nodeOutputVars,
availableNodes, availableNodes,
nodeId, nodeId,
@ -131,7 +129,6 @@ const MultipleToolSelector = ({
{!collapse && ( {!collapse && (
<> <>
<ToolSelector <ToolSelector
supportVariables={supportVariables}
nodeId={nodeId} nodeId={nodeId}
nodeOutputVars={nodeOutputVars} nodeOutputVars={nodeOutputVars}
availableNodes={availableNodes} availableNodes={availableNodes}
@ -154,7 +151,6 @@ const MultipleToolSelector = ({
{value.length > 0 && value.map((item, index) => ( {value.length > 0 && value.map((item, index) => (
<div className='mb-1' key={index}> <div className='mb-1' key={index}>
<ToolSelector <ToolSelector
supportVariables={supportVariables}
nodeId={nodeId} nodeId={nodeId}
nodeOutputVars={nodeOutputVars} nodeOutputVars={nodeOutputVars}
availableNodes={availableNodes} availableNodes={availableNodes}

View File

@ -70,7 +70,6 @@ type Props = {
onControlledStateChange?: (state: boolean) => void onControlledStateChange?: (state: boolean) => void
panelShowState?: boolean panelShowState?: boolean
onPanelShowStateChange?: (state: boolean) => void onPanelShowStateChange?: (state: boolean) => void
supportVariables?: boolean
nodeOutputVars: NodeOutPutVar[], nodeOutputVars: NodeOutPutVar[],
availableNodes: Node[], availableNodes: Node[],
nodeId?: string, nodeId?: string,
@ -346,7 +345,7 @@ const ToolSelector: FC<Props> = ({
<> <>
<Divider className='my-1 w-full' /> <Divider className='my-1 w-full' />
{/* tabs */} {/* tabs */}
{showTabSlider && ( {nodeId && showTabSlider && (
<TabSlider <TabSlider
className='shrink-0 mt-1 px-4' className='shrink-0 mt-1 px-4'
itemClassName='py-3' itemClassName='py-3'
@ -362,7 +361,7 @@ const ToolSelector: FC<Props> = ({
]} ]}
/> />
)} )}
{showTabSlider && currType === 'params' && ( {nodeId && showTabSlider && currType === 'params' && (
<div className='px-4 py-2'> <div className='px-4 py-2'>
<div className='text-text-tertiary system-xs-regular'>{t('plugin.detailPanel.toolSelector.paramsTip1')}</div> <div className='text-text-tertiary system-xs-regular'>{t('plugin.detailPanel.toolSelector.paramsTip1')}</div>
<div className='text-text-tertiary system-xs-regular'>{t('plugin.detailPanel.toolSelector.paramsTip2')}</div> <div className='text-text-tertiary system-xs-regular'>{t('plugin.detailPanel.toolSelector.paramsTip2')}</div>
@ -375,7 +374,7 @@ const ToolSelector: FC<Props> = ({
</div> </div>
)} )}
{/* reasoning config only */} {/* reasoning config only */}
{reasoningConfigOnly && ( {nodeId && reasoningConfigOnly && (
<div className='mb-1 p-4 pb-1'> <div className='mb-1 p-4 pb-1'>
<div className='text-text-primary system-sm-semibold-uppercase'>{t('plugin.detailPanel.toolSelector.params')}</div> <div className='text-text-primary system-sm-semibold-uppercase'>{t('plugin.detailPanel.toolSelector.params')}</div>
<div className='pb-1'> <div className='pb-1'>
@ -409,7 +408,7 @@ const ToolSelector: FC<Props> = ({
</div> </div>
)} )}
{/* reasoning config form */} {/* reasoning config form */}
{(currType === 'params' || reasoningConfigOnly) && ( {nodeId && (currType === 'params' || reasoningConfigOnly) && (
<ReasoningConfigForm <ReasoningConfigForm
value={value?.parameters || {}} value={value?.parameters || {}}
onChange={handleParamsFormChange} onChange={handleParamsFormChange}

View File

@ -62,18 +62,18 @@ const ReasoningConfigForm: React.FC<Props> = ({
// }) // })
// } // }
// }, []) // }, [])
const handleNotMixedTypeChange = useCallback((variable: string, toString = false) => { const handleNotMixedTypeChange = useCallback((variable: string) => {
return (varValue: ValueSelector | string, varKindType: VarKindType) => { return (varValue: ValueSelector | string, varKindType: VarKindType) => {
const newValue = produce(value, (draft: ToolVarInputs) => { const newValue = produce(value, (draft: ToolVarInputs) => {
const target = draft[variable].value const target = draft[variable].value
if (target) { if (target) {
target.type = varKindType target.type = varKindType
target.value = toString ? `${varValue}` : varValue target.value = varValue
} }
else { else {
draft[variable].value = { draft[variable].value = {
type: varKindType, type: varKindType,
value: toString ? `${varValue}` : varValue, value: varValue,
} }
} }
}) })
@ -170,7 +170,7 @@ const ReasoningConfigForm: React.FC<Props> = ({
{tooltipContent} {tooltipContent}
</div> </div>
<div className='flex items-center gap-1 px-2 py-1 rounded-[6px] border border-divider-subtle bg-background-default-lighter cursor-pointer hover:bg-state-base-hover' onClick={() => handleAutomatic(variable, !auto)}> <div className='flex items-center gap-1 px-2 py-1 rounded-[6px] border border-divider-subtle bg-background-default-lighter cursor-pointer hover:bg-state-base-hover' onClick={() => handleAutomatic(variable, !auto)}>
<span className='text-text-secondary system-xs-medium'>automatic</span> <span className='text-text-secondary system-xs-medium'>{t('plugin.detailPanel.toolSelector.auto')}</span>
<Switch <Switch
size='xs' size='xs'
defaultValue={!!auto} defaultValue={!!auto}
@ -198,8 +198,8 @@ const ReasoningConfigForm: React.FC<Props> = ({
readonly={false} readonly={false}
isShowNodeName isShowNodeName
nodeId={nodeId} nodeId={nodeId}
value={varInput?.value || []} value={varInput?.value || ''}
onChange={handleNotMixedTypeChange(variable, true)} onChange={handleNotMixedTypeChange(variable)}
defaultVarKindType={VarKindType.variable} defaultVarKindType={VarKindType.variable}
filterVar={(varPayload: Var) => varPayload.type === VarType.number || varPayload.type === VarType.secret || varPayload.type === VarType.string} filterVar={(varPayload: Var) => varPayload.type === VarType.number || varPayload.type === VarType.secret || varPayload.type === VarType.string}
/> />

View File

@ -155,7 +155,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
tooltip={schema.tooltip && renderI18nObject(schema.tooltip)} tooltip={schema.tooltip && renderI18nObject(schema.tooltip)}
> >
<ToolSelector <ToolSelector
supportVariables
nodeId={props.nodeId || ''} nodeId={props.nodeId || ''}
nodeOutputVars={props.nodeOutputVars || []} nodeOutputVars={props.nodeOutputVars || []}
availableNodes={props.availableNodes || []} availableNodes={props.availableNodes || []}
@ -174,7 +173,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
} }
return ( return (
<MultipleToolSelector <MultipleToolSelector
supportVariables
nodeId={props.nodeId || ''} nodeId={props.nodeId || ''}
nodeOutputVars={props.nodeOutputVars || []} nodeOutputVars={props.nodeOutputVars || []}
availableNodes={props.availableNodes || []} availableNodes={props.availableNodes || []}

View File

@ -82,6 +82,7 @@ const translation = {
params: 'REASONING CONFIG', params: 'REASONING CONFIG',
paramsTip1: 'Controls LLM inference parameters.', paramsTip1: 'Controls LLM inference parameters.',
paramsTip2: 'When \'Automatic\' is off, the default value is used.', paramsTip2: 'When \'Automatic\' is off, the default value is used.',
auto: 'Automatic',
empty: 'Click the \'+\' button to add tools. You can add multiple tools.', empty: 'Click the \'+\' button to add tools. You can add multiple tools.',
uninstalledTitle: 'Tool not installed', uninstalledTitle: 'Tool not installed',
uninstalledContent: 'This plugin is installed from the local/GitHub repository. Please use after installation.', uninstalledContent: 'This plugin is installed from the local/GitHub repository. Please use after installation.',

View File

@ -82,6 +82,7 @@ const translation = {
params: '推理配置', params: '推理配置',
paramsTip1: '控制 LLM 推理参数。', paramsTip1: '控制 LLM 推理参数。',
paramsTip2: '当“自动”关闭时,使用默认值。', paramsTip2: '当“自动”关闭时,使用默认值。',
auto: '自动',
empty: '点击 "+" 按钮添加工具。您可以添加多个工具。', empty: '点击 "+" 按钮添加工具。您可以添加多个工具。',
uninstalledTitle: '工具未安装', uninstalledTitle: '工具未安装',
uninstalledContent: '此插件安装自 本地 / GitHub 仓库,请安装后使用。', uninstalledContent: '此插件安装自 本地 / GitHub 仓库,请安装后使用。',