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

View File

@ -70,7 +70,6 @@ type Props = {
onControlledStateChange?: (state: boolean) => void
panelShowState?: boolean
onPanelShowStateChange?: (state: boolean) => void
supportVariables?: boolean
nodeOutputVars: NodeOutPutVar[],
availableNodes: Node[],
nodeId?: string,
@ -346,7 +345,7 @@ const ToolSelector: FC<Props> = ({
<>
<Divider className='my-1 w-full' />
{/* tabs */}
{showTabSlider && (
{nodeId && showTabSlider && (
<TabSlider
className='shrink-0 mt-1 px-4'
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='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>
@ -375,7 +374,7 @@ const ToolSelector: FC<Props> = ({
</div>
)}
{/* reasoning config only */}
{reasoningConfigOnly && (
{nodeId && reasoningConfigOnly && (
<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='pb-1'>
@ -409,7 +408,7 @@ const ToolSelector: FC<Props> = ({
</div>
)}
{/* reasoning config form */}
{(currType === 'params' || reasoningConfigOnly) && (
{nodeId && (currType === 'params' || reasoningConfigOnly) && (
<ReasoningConfigForm
value={value?.parameters || {}}
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) => {
const newValue = produce(value, (draft: ToolVarInputs) => {
const target = draft[variable].value
if (target) {
target.type = varKindType
target.value = toString ? `${varValue}` : varValue
target.value = varValue
}
else {
draft[variable].value = {
type: varKindType,
value: toString ? `${varValue}` : varValue,
value: varValue,
}
}
})
@ -170,7 +170,7 @@ const ReasoningConfigForm: React.FC<Props> = ({
{tooltipContent}
</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)}>
<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
size='xs'
defaultValue={!!auto}
@ -198,8 +198,8 @@ const ReasoningConfigForm: React.FC<Props> = ({
readonly={false}
isShowNodeName
nodeId={nodeId}
value={varInput?.value || []}
onChange={handleNotMixedTypeChange(variable, true)}
value={varInput?.value || ''}
onChange={handleNotMixedTypeChange(variable)}
defaultVarKindType={VarKindType.variable}
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)}
>
<ToolSelector
supportVariables
nodeId={props.nodeId || ''}
nodeOutputVars={props.nodeOutputVars || []}
availableNodes={props.availableNodes || []}
@ -174,7 +173,6 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
}
return (
<MultipleToolSelector
supportVariables
nodeId={props.nodeId || ''}
nodeOutputVars={props.nodeOutputVars || []}
availableNodes={props.availableNodes || []}

View File

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

View File

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