Skip to content

Commit c13ba64

Browse files
authored
Merge branch 'opentiny:develop' into develop
2 parents 1f222b1 + 3e61fcd commit c13ba64

File tree

188 files changed

+2678
-653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+2678
-653
lines changed

designer-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "designer-demo",
33
"private": true,
4-
"version": "2.7.0",
4+
"version": "2.8.0",
55
"type": "module",
66
"scripts": {
77
"dev": "cross-env vite",

designer-demo/src/composable/http/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const preResponse = (res) => {
4646
return Promise.reject(res.data.error)
4747
}
4848

49-
return res.data?.data
49+
return res.data?.data || res.data
5050
}
5151

5252
const openLogin = () => {

docs/advanced-features/new-ai-plugin-usage.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ MCP工具管理面板允许用户:
6161
[META_APP.Robot]: {
6262
options: {
6363
customCompatibleAIModels: [
64-
{ label: 'SiliconFlow:DeepSeek-V3', value: 'deepseek-ai/DeepSeek-V3', manufacturer: 'siliconflow' },
65-
{ label: 'Qwen:qwen-max', value: 'qwen-max', manufacturer: 'qwen' },
64+
{
65+
label: 'DeepSeek',
66+
value: 'https://api.deepseek.com/v1',
67+
model: [
68+
{ label: 'deepseek-chat', value: 'deepseek-chat', maxTokens: 64000 },
69+
{ label: 'deepseek-reasoner', value: 'deepseek-reasoner', maxTokens: 64000 }
70+
]
71+
}
6672
]
6773
}
6874
},

docs/extension-capabilities-tutorial/mcpService.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,22 @@ mcpService.setOptions(remoteConfig)
430430

431431
### 高级配置
432432

433-
```typescript
433+
<pre>
434+
<code>
434435
import { getMetaApi } from '@opentiny/tiny-engine-meta-register'
435436

436437
const mcpService = getMetaApi('engine.service.mcp')
437438

438439
const advancedConfig = {
439-
proxyUrl: process.env.MCP_PROXY_URL || 'http://localhost:3000/mcp',
440-
connectToAgentServer: process.env.NODE_ENV === 'production',
440+
proxyUrl: process<wbr>.env.MCP_PROXY_URL || 'http://localhost:3000/mcp',
441+
connectToAgentServer: process<wbr>.env.NODE_ENV === 'production',
441442
reconnectAttempts: 5,
442443
reconnectInterval: 2000
443444
}
444445

445446
mcpService.setOptions(advancedConfig)
446-
```
447+
</code>
448+
</pre>
447449

448450
## 最佳实践
449451

mockServer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-engine-mock",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/block-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-engine-block-compiler",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"publishConfig": {
55
"access": "public"
66
},

packages/build/vite-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-engine-vite-config",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"description": "",
55
"type": "module",
66
"main": "./index.js",

packages/build/vite-plugin-meta-comments/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-engine-vite-plugin-meta-comments",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"description": "",
55
"type": "module",
66
"main": "dist/index.cjs",

packages/builtinComponent/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-engine-builtin-component",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"description": "",
55
"main": "dist/index.mjs",
66
"module": "dist/index.mjs",

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

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
import { z } from 'zod'
2-
import { useCanvas } from '@opentiny/tiny-engine-meta-register'
2+
import { useCanvas, useMaterial } from '@opentiny/tiny-engine-meta-register'
33
import { utils } from '@opentiny/tiny-engine-utils'
44

55
const { validateParams } = utils
66

7-
type NodeSchema = z.ZodObject<{
8-
componentName: z.ZodString
9-
props: z.ZodObject<Record<string, z.ZodTypeAny>, 'strip', z.ZodTypeAny>
10-
children: z.ZodArray<z.ZodLazy<any>, 'many'>
11-
}>
12-
13-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
14-
const nodeArraySchema = z.lazy(() => nodeSchema)
15-
16-
const nodeSchema: NodeSchema = z.object({
17-
componentName: z.string().describe('The name of the component.'),
18-
props: z.object({}).describe('The props of the component.'),
19-
children: z.array(z.lazy(() => nodeArraySchema)).describe('The children of the component')
20-
})
21-
227
const inputSchema = z.object({
238
parentId: z
249
.string()
2510
.optional()
2611
.describe(
2712
'The id of the parent node. If not provided, the new node will be added to the root. if you don\'t know the parentId, you can use the tool "get_page_schema" to get the page schema. if you want to add to page root, just don\'t provide the parentId.'
2813
),
29-
newNodeData: z.lazy(() => nodeSchema).describe('The new node data.'),
14+
newNodeData: z.object({
15+
componentName: z.string().describe('The name of the component.'),
16+
props: z.record(z.string(), z.any()).describe('The props of the component.'),
17+
children: z
18+
.array(z.record(z.string(), z.any()))
19+
.describe('Array of child nodes; each child has the same shape as newNodeData (recursive tree).')
20+
}),
3021
position: z
3122
.enum(['before', 'after'])
3223
.optional()
@@ -60,11 +51,6 @@ export const addNode = {
6051
const { props = {}, children = [] } = newNodeData
6152

6253
const validateResult = validateParams(args, {
63-
componentName: {
64-
required: true,
65-
message:
66-
'Component name is required, if you don\'t know the component name, you can use the tool "get_component_list" to get the component detail.'
67-
},
6854
parentId: {
6955
validator: (value: string) => {
7056
const parentNode = useCanvas().getNodeById(value)
@@ -87,27 +73,55 @@ export const addNode = {
8773
return validateResult.error
8874
}
8975

76+
const { getMaterial } = useMaterial()
77+
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
83+
84+
if (!newNodeData.componentName || isEmptyPlainObject) {
85+
return {
86+
isError: true,
87+
content: [
88+
{
89+
type: 'text',
90+
text: JSON.stringify({
91+
status: 'error',
92+
errorCode: 'COMPONENT_NAME_REQUIRED',
93+
reason: 'Component name is required',
94+
userMessage: 'Component name is required. Fetch the available component list.',
95+
next_action: {
96+
type: 'tool_call',
97+
name: 'get_component_list',
98+
args: {}
99+
}
100+
})
101+
}
102+
]
103+
}
104+
}
105+
106+
const insertData = {
107+
componentName,
108+
props,
109+
children
110+
}
111+
90112
useCanvas().operateNode({
91113
type: 'insert',
92114
parentId: parentId!,
93115
// @ts-ignore
94-
newNodeData: {
95-
componentName,
96-
props,
97-
children
98-
},
116+
newNodeData: insertData,
99117
position: position!,
100118
referTargetNodeId
101119
})
102120

103121
const res = {
104122
status: 'success',
105123
message: `Node added successfully`,
106-
data: {
107-
componentName,
108-
props,
109-
children
110-
}
124+
data: insertData
111125
}
112126

113127
return {

0 commit comments

Comments
 (0)