import { InputNumber, Typography } from 'antd' import { getConfigDisplayLabel } from '../api/configCodes' import { BOOST_MAX, BOOST_MIN, getDefaultBoostForCode, type RankingParams, } from '../utils/scoring' const { Text } = Typography interface Props { boostCodes: string[] configCodes: Record rankingParams: RankingParams onChange: (next: RankingParams) => void } export default function DimensionBoostRow({ boostCodes, configCodes, rankingParams, onChange, }: Props) { if (boostCodes.length === 0) return null return (
维度 Boost {boostCodes.map((code) => { const defaultVal = getDefaultBoostForCode(code) const val = rankingParams.boostsByCode?.[code] ?? defaultVal const isCustom = code in (rankingParams.boostsByCode ?? {}) return (
{getConfigDisplayLabel(code, configCodes)} { const next = { ...rankingParams.boostsByCode } if (typeof v === 'number' && v !== defaultVal) { next[code] = v } else { delete next[code] } onChange({ ...rankingParams, boostsByCode: next }) }} style={{ width: 68 }} />
) })}
) }