@yorha2b-lab/autodev 7.5.2 → 7.5.4
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/bin/bunker.js +0 -1
- package/package.json +1 -1
- package/src/awakening/index.js +1 -0
- package/src/gateway/protocol.js +2 -1
- package/src/labs/council.js +21 -4
- package/src/units/striker.js +8 -8
- package/src/workshop/react/blueprint/molds/hookBlock.hbs +7 -0
- package/src/workshop/react/builder/index.js +1 -1
package/bin/bunker.js
CHANGED
package/package.json
CHANGED
package/src/awakening/index.js
CHANGED
package/src/gateway/protocol.js
CHANGED
|
@@ -29,7 +29,8 @@ module.exports = ({ yorha, sleep, dialog, openAI }) => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
yorha.commander.report(dialog.bunker.networkInstability(retryCount + 1))
|
|
32
|
-
|
|
32
|
+
const delay = Math.min(1000 * Math.pow(2, retryCount), 10000)
|
|
33
|
+
await sleep(delay)
|
|
33
34
|
return askAI({ model, messages, response_format, retryCount: retryCount + 1 })
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/labs/council.js
CHANGED
|
@@ -44,8 +44,19 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
|
|
|
44
44
|
const anchors = code.match(/BUNKER_API_ANCHOR_\w+/g) || []
|
|
45
45
|
anchors.forEach(a => allAnchors.add(a))
|
|
46
46
|
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const textMatches = code.match(/(?:['"`]([^'"`\n]{2,})['"`]|>([^<>{}\n]{2,})<)/g) || []
|
|
48
|
+
const uiSemantics = textMatches
|
|
49
|
+
.map(str => str.replace(/['"`><]/g, '').trim())
|
|
50
|
+
// 过滤掉纯代码路径(/api/xxx)、锚点占位符、纯数字和空字符
|
|
51
|
+
.filter(text => (
|
|
52
|
+
text.length >= 2 &&
|
|
53
|
+
!text.startsWith('/') &&
|
|
54
|
+
!text.startsWith('http') &&
|
|
55
|
+
!text.includes('BUNKER_API_ANCHOR') &&
|
|
56
|
+
!/^[0-9]+$/.test(text)
|
|
57
|
+
))
|
|
58
|
+
|
|
59
|
+
allSemantics.push(...uiSemantics)
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
if (allAnchors.size > 0) {
|
|
@@ -93,8 +104,14 @@ module.exports = async ({ llm, yorha, dialog, logistics }) => {
|
|
|
93
104
|
const pagesConfig = result?.['BUNKER_API_ANCHOR_pages']
|
|
94
105
|
if (pagesConfig) {
|
|
95
106
|
const { uri: pagesApi, method: pagesMethod } = pagesConfig
|
|
96
|
-
const
|
|
97
|
-
const
|
|
107
|
+
const schemas = apiData.definitions || apiData.components?.schemas || {}
|
|
108
|
+
const methodObj = apiData.paths[pagesApi]?.[pagesMethod] ?? apiData.paths[pagesApi]?.[pagesMethod?.toLowerCase()]
|
|
109
|
+
let schemaName = methodObj?.parameters?.flatMap(item => Object.values(item.schema ?? {})?.flatMap(def => def?.split('/')?.at(-1)))?.[0]
|
|
110
|
+
if (!schemaName && methodObj?.requestBody) {
|
|
111
|
+
const bodySchema = methodObj.requestBody.content?.['application/json']?.schema
|
|
112
|
+
schemaName = (bodySchema?.$ref || bodySchema?.items?.$ref)?.split('/')?.at(-1)
|
|
113
|
+
}
|
|
114
|
+
const parameters = schemas[schemaName]?.properties ?? {}
|
|
98
115
|
const enumParams = Object.entries(parameters)?.filter(([_, value]) => value.hasOwnProperty('enum')) || []
|
|
99
116
|
enumParamsMap[fileName] = contextStringify({
|
|
100
117
|
maxLength: 100,
|
package/src/units/striker.js
CHANGED
|
@@ -52,14 +52,14 @@ module.exports = {
|
|
|
52
52
|
} else {
|
|
53
53
|
pod042.update(spinner, dialog.pod042.uploadVisualMetadata)
|
|
54
54
|
pageConfig = await recognizePage({ prompt: striker, filePath: mission.input, schema: require(`../workshop/${template}/protocols/striker.json`) })
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
const { similarity } = await nameSimilarity({ fileName, english: pageConfig.title?.english })
|
|
56
|
+
const isGarbageName = /^(image|img|screen|capture|pic|temp|test|新建|未命名|[\d_-]+$)/i.test(fileName)
|
|
57
|
+
if (similarity < 0.3 || isGarbageName) {
|
|
58
|
+
fileName = pageConfig.title?.english
|
|
59
|
+
targetDir = path.join(process.cwd(), pagesDir, pageConfig.title?.english)
|
|
60
|
+
if (fs.existsSync(targetDir)) {
|
|
61
|
+
targetDir = `${targetDir}_temp`
|
|
62
|
+
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -3,6 +3,13 @@ const initialParams = {{initParams}}
|
|
|
3
3
|
|
|
4
4
|
const query = formatQuery(Object.fromEntries(new URLSearchParams(location.search).entries()), {{formItems}})
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* 💡 [BUNKER 战术锚点提示]
|
|
8
|
+
* 代码中带有 BUNKER_API_ANCHOR_ 前缀的为待通电接口。
|
|
9
|
+
* 1. 自动模式:配置 config.js 中的 apiDoc 后,系统将自动扫描 Swagger 并对齐真实路径;
|
|
10
|
+
* 2. 手动模式:搜索 BUNKER_API_ANCHOR 手动替换为真实接口。
|
|
11
|
+
*/
|
|
12
|
+
|
|
6
13
|
const { total, columns, loading, dataSource, search, setSearch, setDataSource, refresh } = useTableQuery({
|
|
7
14
|
cols:tableColumns,
|
|
8
15
|
initialParams: { ...initialParams, ...query },
|
|
@@ -111,7 +111,7 @@ module.exports = ({ template, logistics, headquarters }) => {
|
|
|
111
111
|
},
|
|
112
112
|
index: ({ fileName, pageConfig }) => {
|
|
113
113
|
const hasTabs = pageConfig.tabs?.length > 0
|
|
114
|
-
const hasPagination = pageConfig.table
|
|
114
|
+
const hasPagination = pageConfig.table?.pagination
|
|
115
115
|
const hasFormItems = pageConfig.formItems?.length > 0
|
|
116
116
|
const hasOperate = pageConfig.table?.operation?.length > 0
|
|
117
117
|
const hasImageColumn = pageConfig.table?.columns?.some(item => item.type === 'image')
|