@yorha2b-lab/autodev 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/handlers/page-handler.js +2 -2
- package/src/commands/handlers/part-handler.js +2 -2
- package/src/services/llm.js +2 -2
- package/src/utils/utils.js +3 -2
- package/templates/react/handlebars/handleBlock.hbs +1 -0
- package/templates/react/handlebars/hookBlock.hbs +1 -0
- /package/src/schema/{page.json → react/page.json} +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = async filePath => {
|
|
|
9
9
|
const { get } = require('../../core/context')
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
|
-
config, language, menus,
|
|
12
|
+
config, language, menus, options,
|
|
13
13
|
pagePrompt, resourceTpl, indexTpl,
|
|
14
14
|
recognizePage, generateMock, resource, index
|
|
15
15
|
} = get()
|
|
@@ -52,7 +52,7 @@ module.exports = async filePath => {
|
|
|
52
52
|
`🤖 Pod 042: 正在上传视觉元数据至司令部进行语义分析...\n`,
|
|
53
53
|
`🤖 Pod 042: Uploading visual metadata to Command for semantic analysis...\n`
|
|
54
54
|
))
|
|
55
|
-
pageConfig = await recognizePage(pagePrompt, filePath)
|
|
55
|
+
pageConfig = await recognizePage({ prompt: pagePrompt, filePath, options })
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
fs.writeFileSync(path.join(targetDir, 'resource.js'), resource({ pageConfig, resourceTpl }))
|
|
@@ -6,7 +6,7 @@ const stringify = require('json-stringify-pretty-compact')
|
|
|
6
6
|
module.exports = async filePath => {
|
|
7
7
|
|
|
8
8
|
const { get } = require('../../core/context')
|
|
9
|
-
const { language, partPrompt, recognizePage } = get()
|
|
9
|
+
const { options, language, partPrompt, recognizePage } = get()
|
|
10
10
|
const { cleanCode, formatFormItemAndColumns } = require('../../utils/utils')
|
|
11
11
|
|
|
12
12
|
const startTime = Date.now()
|
|
@@ -25,7 +25,7 @@ module.exports = async filePath => {
|
|
|
25
25
|
`🤖 Pod 042: Extracting UI metadata from neural cloud network...\n`
|
|
26
26
|
))
|
|
27
27
|
|
|
28
|
-
const pageConfig = await recognizePage(partPrompt, filePath, 'part')
|
|
28
|
+
const pageConfig = await recognizePage({ prompt: partPrompt, filePath, options, taskType: 'part' })
|
|
29
29
|
|
|
30
30
|
const { formItems, dictBlocks, processedColumns } = formatFormItemAndColumns({ pageConfig })
|
|
31
31
|
|
package/src/services/llm.js
CHANGED
|
@@ -85,7 +85,7 @@ module.exports = {
|
|
|
85
85
|
]
|
|
86
86
|
})
|
|
87
87
|
},
|
|
88
|
-
recognizePage: async (prompt, filePath, taskType = 'page') => {
|
|
88
|
+
recognizePage: async ({ prompt, filePath, options, taskType = 'page' }) => {
|
|
89
89
|
const config = getConfig()
|
|
90
90
|
const { UI_DESIGNER } = require('../prompts/system.js')
|
|
91
91
|
const sharp = require('sharp')
|
|
@@ -107,7 +107,7 @@ module.exports = {
|
|
|
107
107
|
]
|
|
108
108
|
}
|
|
109
109
|
],
|
|
110
|
-
response_format: taskType === 'page' ? { type: 'json_schema', strict: true, json_schema: require(
|
|
110
|
+
response_format: taskType === 'page' ? { type: 'json_schema', strict: true, json_schema: require(`../schema/${options.template}/page.json`) } : { type: 'json_object' }
|
|
111
111
|
})
|
|
112
112
|
},
|
|
113
113
|
alignResponseFields: async (options, responseStr, resourceStr) => {
|
package/src/utils/utils.js
CHANGED
|
@@ -256,11 +256,9 @@ const formatFormItemAndColumns = ({ pageConfig }) => {
|
|
|
256
256
|
const dictBlocks = Array.from(new Set([...formDicts, ...tableDicts]))
|
|
257
257
|
|
|
258
258
|
const formItems = pageConfig.formItems?.map(item => {
|
|
259
|
-
|
|
260
259
|
if (item.type === 'text') {
|
|
261
260
|
delete item.type
|
|
262
261
|
}
|
|
263
|
-
|
|
264
262
|
return {
|
|
265
263
|
...item,
|
|
266
264
|
...(item.type === 'select' ? { options: `_CODE_${item.name}Options_CODE_` } : {})
|
|
@@ -268,6 +266,9 @@ const formatFormItemAndColumns = ({ pageConfig }) => {
|
|
|
268
266
|
})
|
|
269
267
|
|
|
270
268
|
const processedColumns = columns?.map(col => {
|
|
269
|
+
if (col.type === 'text') {
|
|
270
|
+
delete col.type
|
|
271
|
+
}
|
|
271
272
|
if (['image'].includes(col.type)) {
|
|
272
273
|
return { ...col, renderAction: true }
|
|
273
274
|
}
|
|
File without changes
|