Skip to content

Commit 0f1caa0

Browse files
committed
fix: edit with ai review comment
1 parent cdf7262 commit 0f1caa0

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

packages/canvas/DesignCanvas/src/mcp/tools/addNode.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,13 @@ export const addNode = {
7575

7676
const { getMaterial } = useMaterial()
7777
const material = getMaterial(componentName)
78+
const isEmptyPlainObject =
79+
material &&
80+
typeof material === 'object' &&
81+
!Array.isArray(material) &&
82+
Object.keys(material as Record<string, unknown>).length === 0
7883

79-
if (!newNodeData.componentName || !Object.keys(material).length) {
84+
if (!newNodeData.componentName || isEmptyPlainObject) {
8085
return {
8186
isError: true,
8287
content: [

packages/layout/src/mcp/tools/switchPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const switchPluginPanel = {
3838
}
3939
}
4040

41-
if (operation === 'open' && pluginId) {
41+
if (operation === 'open') {
4242
await activePlugin(pluginId)
4343
} else {
4444
await closePlugin(true)

packages/plugins/page/src/composable/usePage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ const deletePage = async (id) => {
625625
} catch (error) {
626626
return {
627627
success: false,
628-
error: JSON.stringify(error?.message || error)
628+
error: JSON.stringify(error instanceof Error ? error.message : error)
629629
}
630630
}
631631
}
@@ -648,7 +648,7 @@ const updatePageById = async (id, params) => {
648648
} catch (error) {
649649
return {
650650
success: false,
651-
error: JSON.stringify(error?.message || error)
651+
error: JSON.stringify(error instanceof Error ? error.message : error)
652652
}
653653
}
654654
}

packages/plugins/page/src/mcp/tools/changePageBasicInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const inputSchema = z.object({
1818
.string()
1919
.optional()
2020
.describe(
21-
'The parent id of the page, if not provided, the page will be created at the root level. if provided, the page will be created at the specified parent id. if you don\'t know the parentId, you can use the tool "get_page_list" to get the page list.'
21+
'The parentId under which to place the page. If omitted, the page remains at its current level. Set to "0" to move it to the root. Use "get_page_list" to discover available parent IDs.'
2222
)
2323
})
2424

packages/plugins/page/src/mcp/tools/editSpecificPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const editSpecificPage = {
2020
const { id } = args
2121
const { switchPage } = usePage()
2222
const allPages = await getAllPages()
23-
const page = allPages.find((page) => page.id === id)
23+
const page = allPages.find((page) => String(page.id) === String(id))
2424

2525
if (!page) {
2626
return {

0 commit comments

Comments
 (0)