feat(comfy-cloud): Comfy Cloud 预设移到首位 + 新增站点默认选中

预设数组把 comfy-cloud 排第一;站点管理 openAdd 默认选 Comfy Cloud 预设
(预填 url+platform,只需贴 X-API-Key)。detect-race 测试补平台重置以保留竞态覆盖。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
boos
2026-06-18 00:38:32 +08:00
parent d850da64c3
commit 8ca6c2ad4f
4 changed files with 42 additions and 22 deletions
+9 -2
View File
@@ -960,8 +960,15 @@ export default function Sites() {
return;
}
setEditor({ mode: 'add' });
setForm(createEmptySiteForm());
setSelectedInitializationPresetId(null);
const base = createEmptySiteForm();
const comfyPreset = getSiteInitializationPreset('comfy-cloud');
if (comfyPreset) {
setForm({ ...base, platform: comfyPreset.platform, url: comfyPreset.defaultUrl });
setSelectedInitializationPresetId(comfyPreset.id);
} else {
setForm(base);
setSelectedInitializationPresetId(null);
}
scrollToEditorTop();
};
+13
View File
@@ -110,6 +110,13 @@ describe('Sites detect race handling', () => {
});
await flushMicrotasks();
// 新增表单现在默认预选 Comfy Cloud 预设;本用例测试空平台下的检测竞态,
// 先把平台重置为空(等价于操作员清空平台选择),恢复检测前置条件。
await act(async () => {
findPlatformSelect(root).props.onChange('');
});
await flushMicrotasks();
const urlInput = findPrimarySiteUrlInput(root);
await act(async () => {
urlInput.props.onChange({ target: { value: 'https://stale.example.com/v1' } });
@@ -190,6 +197,12 @@ describe('Sites detect race handling', () => {
});
await flushMicrotasks();
// 重置默认 Comfy Cloud 预选,恢复空平台检测前置条件。
await act(async () => {
findPlatformSelect(root).props.onChange('');
});
await flushMicrotasks();
const urlInput = findPrimarySiteUrlInput(root);
await act(async () => {
urlInput.props.onChange({ target: { value: 'https://blur.example.com/v1' } });