{`#${selectedOperationIndex + 1}`}
{getOperationSummary(
selectedOperation,
selectedOperationIndex,
)}
}
aria-label={t('删除规则')}
onClick={() =>
removeOperation(selectedOperation.id)
}
/>
{t('操作类型')}
{MODE_DESCRIPTIONS[mode] || ''}
{t('规则描述(可选)')}
updateOperation(selectedOperation.id, {
description: nextValue || '',
})
}
maxLength={180}
showClear
/>
{`${String(selectedOperation.description || '').length}/180`}
{meta.value ? (
mode === 'return_error' && returnErrorDraft ? (
{t('自定义错误响应')}
{t('模式')}
{t('错误消息(必填)')}
) : mode === 'prune_objects' && pruneObjectsDraft ? (
{t('对象清理规则')}
{t('模式')}
{t('类型(常用)')}
updatePruneObjectsDraft(
selectedOperation.id,
{ typeText: nextValue },
)
}
/>
{pruneObjectsDraft.simpleMode ? (
{t(
'简洁模式:按 type 全量清理对象,例如 redacted_thinking。',
)}
) : (
<>
{t('逻辑')}
{t('附加条件')}
}
onClick={() =>
addPruneRule(selectedOperation.id)
}
>
{t('新增条件')}
{(pruneObjectsDraft.rules || []).length === 0 ? (
{t(
'未添加附加条件时,仅使用上方 type 进行清理。',
)}
) : (
{(pruneObjectsDraft.rules || []).map(
(rule, ruleIndex) => (
{`R${ruleIndex + 1}`}
}
onClick={() =>
removePruneRule(
selectedOperation.id,
rule.id,
)
}
>
{t('删除条件')}
{t('字段路径')}
updatePruneRule(
selectedOperation.id,
rule.id,
{ path: nextValue },
)
}
/>
{t('匹配方式')}
),
)}
)}
>
)}
) : (
{t(getModeValueLabel(mode))}
{mode === 'set_header' ? (
) : null}
{mode === 'set_header' ? (
{t('纯字符串会直接覆盖整条请求头,或者点击“查看 JSON 示例”按 token 规则处理。')}
) : null}
)
) : null}
{meta.keepOrigin ? (
updateOperation(selectedOperation.id, {
keep_origin: nextValue,
})
}
/>
{t('保留原值(目标已有值时不覆盖)')}
) : null}
{mode === 'sync_fields' ? (
{t('同步端点')}
{t('来源端点')}
{t('目标端点')}
updateOperation(selectedOperation.id, {
from: 'header:session_id',
to: 'json:prompt_cache_key',
})
}
>
{
'header:session_id -> json:prompt_cache_key'
}
updateOperation(selectedOperation.id, {
from: 'json:prompt_cache_key',
to: 'header:session_id',
})
}
>
{
'json:prompt_cache_key -> header:session_id'
}
) : meta.from || meta.to === false || meta.to ? (
{meta.from || meta.to === false ? (
{t(getModeFromLabel(mode))}
updateOperation(selectedOperation.id, {
from: nextValue,
})
}
/>
) : null}
{meta.to || meta.to === false ? (
{t(getModeToLabel(mode))}
updateOperation(selectedOperation.id, {
to: nextValue,
})
}
/>
) : null}
) : null}
{t('条件规则')}
}
size='small'
onClick={() =>
addCondition(selectedOperation.id)
}
>
{t('新增条件')}
{conditions.length === 0 ? (
{t('没有条件时,默认总是执行该操作。')}
) : (
handleConditionCollapseChange(
selectedOperation.id,
activeKeys,
)
}
>
{conditions.map(
(condition, conditionIndex) => (
{`C${conditionIndex + 1}`}
{condition.path ||
t('未设置路径')}
}
>
{t('条件项设置')}
}
size='small'
onClick={() =>
removeCondition(
selectedOperation.id,
condition.id,
)
}
>
{t('删除条件')}
{t('字段路径')}
updateCondition(
selectedOperation.id,
condition.id,
{ path: nextValue },
)
}
/>
{t('匹配方式')}
{t('条件取反')}
updateCondition(
selectedOperation.id,
condition.id,
{ invert: nextValue },
)
}
/>
{t('字段缺失视为命中')}
updateCondition(
selectedOperation.id,
condition.id,
{
pass_missing_key: nextValue,
},
)
}
/>
),
)}
)}
);
})()
) : (