refactor(presets): render presets in array order and prioritize partners

Remove the category-based grouping logic from ProviderPresetSelector,
letting the array position in each preset config file be the single
source of truth for display order. Move partner presets (PatewayAI,
火山Agentplan, BytePlus, DouBaoSeed) right after Shengsuanyun across
all 6 config files so they appear earlier in the UI.
This commit is contained in:
Jason
2026-05-15 23:28:59 +08:00
parent 9050442b65
commit ec8afd63ea
11 changed files with 653 additions and 547 deletions
@@ -395,25 +395,6 @@ export function ClaudeDesktopProviderForm({
[],
);
const groupedPresets = useMemo(
() =>
presetEntries.reduce<Record<string, PresetEntry[]>>((acc, entry) => {
const cat = entry.preset.category ?? "others";
if (!acc[cat]) acc[cat] = [];
acc[cat].push(entry);
return acc;
}, {}),
[presetEntries],
);
const categoryKeys = useMemo(
() =>
Object.keys(groupedPresets).filter(
(key) => key !== "custom" && groupedPresets[key]?.length,
),
[groupedPresets],
);
const presetCategoryLabels: Record<string, string> = useMemo(
() => ({
official: t("providerForm.categoryOfficial", { defaultValue: "官方" }),
@@ -777,8 +758,7 @@ export function ClaudeDesktopProviderForm({
{!initialData && (
<ProviderPresetSelector
selectedPresetId={selectedPresetId}
groupedPresets={groupedPresets}
categoryKeys={categoryKeys}
presetEntries={presetEntries}
presetCategoryLabels={presetCategoryLabels}
onPresetChange={handlePresetChange}
category={activePreset?.category}