From a644988ca36f1d3cb4de83901da6f9de2c3a51a5 Mon Sep 17 00:00:00 2001 From: iven Date: Sat, 4 Apr 2026 18:27:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20ConfigMigrationWizard=20PUT=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20config=20item=20ID=20=E6=9B=BF=E4=BB=A3?= =?UTF-8?q?=E5=B8=83=E5=B0=94=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M7-02: exists 是 boolean,不能用作 URL 路径参数。 改为使用 saasConfigs.find() 获取完整对象, 用 existing.id 作为 PUT 路径参数。 --- desktop/src/components/SaaS/ConfigMigrationWizard.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/src/components/SaaS/ConfigMigrationWizard.tsx b/desktop/src/components/SaaS/ConfigMigrationWizard.tsx index b7da48c..ac8b640 100644 --- a/desktop/src/components/SaaS/ConfigMigrationWizard.tsx +++ b/desktop/src/components/SaaS/ConfigMigrationWizard.tsx @@ -102,8 +102,8 @@ export function ConfigMigrationWizard({ onDone }: { onDone: () => void }) { if (direction === 'local-to-saas' && localModels.length > 0) { // Push local models as config items for (const model of localModels) { - const exists = saasConfigs.some((c) => c.key_path === `models.${model.id}`); - if (exists && !selectedKeys.has(model.id)) continue; + const existing = saasConfigs.find((c) => c.key_path === `models.${model.id}`); + if (existing && !selectedKeys.has(model.id)) continue; const body = { category: 'model', @@ -114,8 +114,8 @@ export function ConfigMigrationWizard({ onDone }: { onDone: () => void }) { description: `从桌面端同步: ${model.name}`, }; - if (exists) { - await saasClient.request('PUT', `/api/v1/config/items/${exists}`, body); + if (existing) { + await saasClient.request('PUT', `/api/v1/config/items/${existing.id}`, body); } else { await saasClient.request('POST', '/api/v1/config/items', body); }