fix: allow all fileds and not allow model set to auto

This commit is contained in:
Joel
2026-01-16 17:20:11 +08:00
parent f79df6982d
commit 148f92f92d
2 changed files with 18 additions and 25 deletions

View File

@ -64,6 +64,8 @@ const ReasoningConfigForm: React.FC<Props> = ({
}
const handleAutomatic = (key: string, val: any, type: FormTypeEnum) => {
if (type === FormTypeEnum.modelSelector)
return
onChange({
...value,
[key]: {
@ -151,7 +153,8 @@ const ReasoningConfigForm: React.FC<Props> = ({
placeholder,
options,
} = schema
const auto = value[variable]?.auto
const canUseAuto = type !== FormTypeEnum.modelSelector
const auto = canUseAuto ? value[variable]?.auto : 0
const tooltipContent = (tooltip && (
<Tooltip
popupContent={(
@ -241,14 +244,16 @@ const ReasoningConfigForm: React.FC<Props> = ({
)}
</div>
<div className="flex cursor-pointer items-center gap-1 rounded-[6px] border border-divider-subtle bg-background-default-lighter px-2 py-1 hover:bg-state-base-hover" onClick={() => handleAutomatic(variable, !auto, type)}>
<span className="system-xs-medium text-text-secondary">{t('detailPanel.toolSelector.auto', { ns: 'plugin' })}</span>
<Switch
size="xs"
defaultValue={!!auto}
onChange={val => handleAutomatic(variable, val, type)}
/>
</div>
{canUseAuto && (
<div className="flex cursor-pointer items-center gap-1 rounded-[6px] border border-divider-subtle bg-background-default-lighter px-2 py-1 hover:bg-state-base-hover" onClick={() => handleAutomatic(variable, !auto, type)}>
<span className="system-xs-medium text-text-secondary">{t('detailPanel.toolSelector.auto', { ns: 'plugin' })}</span>
<Switch
size="xs"
defaultValue={!!auto}
onChange={val => handleAutomatic(variable, val, type)}
/>
</div>
)}
</div>
{auto === 0 && (
<div className={cn('gap-1', !(isShowJSONEditor && isConstant) && 'flex')}>

View File

@ -45,7 +45,6 @@ const ToolSettingsSection: FC<ToolSettingsSectionProps> = ({
const settingsFormSchemas = useMemo(() => toolParametersToFormSchemas(currentToolSettings), [currentToolSettings])
const paramsFormSchemas = useMemo(() => toolParametersToFormSchemas(currentToolParams), [currentToolParams])
const allowReasoning = !!safeNodeId
const handleSettingsFormChange = (v: Record<string, any>) => {
if (!value || !onChange)
return
@ -71,7 +70,7 @@ const ToolSettingsSection: FC<ToolSettingsSectionProps> = ({
return null
const showSettingsSection = currentToolSettings.length > 0
const showParamsSection = allowReasoning && currentToolParams.length > 0
const showParamsSection = currentToolParams.length > 0
const getVarKindType = (type: FormTypeEnum) => {
if (type === FormTypeEnum.file || type === FormTypeEnum.files)
return VarKindType.variable
@ -109,20 +108,9 @@ const ToolSettingsSection: FC<ToolSettingsSectionProps> = ({
return (
<>
<Divider className="my-1 w-full" />
{showSettingsSection && (
<div className="p-4 pb-1">
<div className="system-sm-semibold-uppercase text-text-primary">{t('detailPanel.toolSelector.settings', { ns: 'plugin' })}</div>
</div>
)}
{showParamsSection && (
<div className="mb-1 p-4 pb-1">
<div className="system-sm-semibold-uppercase text-text-primary">{t('detailPanel.toolSelector.params', { ns: 'plugin' })}</div>
<div className="pb-1">
<div className="system-xs-regular text-text-tertiary">{t('detailPanel.toolSelector.paramsTip1', { ns: 'plugin' })}</div>
<div className="system-xs-regular text-text-tertiary">{t('detailPanel.toolSelector.paramsTip2', { ns: 'plugin' })}</div>
</div>
</div>
)}
<div className="p-4 pb-1">
<div className="system-sm-semibold-uppercase text-text-primary">{t('detailPanel.toolSelector.settings', { ns: 'plugin' })}</div>
</div>
{showSettingsSection && (
<ReasoningConfigForm
value={getSafeConfigValue(value?.settings, settingsFormSchemas)}