fix(desktop): ConfigMigrationWizard PUT 使用 config item ID 替代布尔值
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
M7-02: exists 是 boolean,不能用作 URL 路径参数。 改为使用 saasConfigs.find() 获取完整对象, 用 existing.id 作为 PUT 路径参数。
This commit is contained in:
@@ -102,8 +102,8 @@ export function ConfigMigrationWizard({ onDone }: { onDone: () => void }) {
|
|||||||
if (direction === 'local-to-saas' && localModels.length > 0) {
|
if (direction === 'local-to-saas' && localModels.length > 0) {
|
||||||
// Push local models as config items
|
// Push local models as config items
|
||||||
for (const model of localModels) {
|
for (const model of localModels) {
|
||||||
const exists = saasConfigs.some((c) => c.key_path === `models.${model.id}`);
|
const existing = saasConfigs.find((c) => c.key_path === `models.${model.id}`);
|
||||||
if (exists && !selectedKeys.has(model.id)) continue;
|
if (existing && !selectedKeys.has(model.id)) continue;
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
category: 'model',
|
category: 'model',
|
||||||
@@ -114,8 +114,8 @@ export function ConfigMigrationWizard({ onDone }: { onDone: () => void }) {
|
|||||||
description: `从桌面端同步: ${model.name}`,
|
description: `从桌面端同步: ${model.name}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (exists) {
|
if (existing) {
|
||||||
await saasClient.request<unknown>('PUT', `/api/v1/config/items/${exists}`, body);
|
await saasClient.request<unknown>('PUT', `/api/v1/config/items/${existing.id}`, body);
|
||||||
} else {
|
} else {
|
||||||
await saasClient.request<unknown>('POST', '/api/v1/config/items', body);
|
await saasClient.request<unknown>('POST', '/api/v1/config/items', body);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user